Tile-Matching Game Environment (TMGE)

Team Members: Xu (Carson) Wang, Yongkang (camerfoul) Man, George Liu, Junping Luo
Role:  Full stack丨UI/UX Designer
Duration: 2023 (March - June )
Project description
A flexible, extensible game framework built with Python 3.12 that powers multiple tile-matching games like Tetris and Candy Crash.
Purpose
A framework + library for tile-based games

🛠️ Technical Highlights

Design Patterns

Command Pattern (Operation, MatchingRule)
Observer Pattern (operation dispatch and board state)
Composite Pattern (PostHookOperation)

UML Diagrams

Class diagrams
Sequence diagrams

Notable Utilities

CanvasTile, SquareTile, ImageTile for flexible tile rendering. PlayerDataRepo for persistent profile management.

🚀 Key Features

Modular, generic architecture using advanced Python generics.
Built-in support for GUI via tkinter.
Implemented games: Tetris, Candy Crash.
Reusable core components: tiles, boards, operations, matching rules.
Supports persistence (Player profiles) and extensible operations.

👾Game Selection Menu

      The game selection menu allows users to choose games they would like to play between "Tetris" and "Candy Crush" using radio buttons.Depending on the selected game, the interface updates to present relevant settings:  

      - For "Tetris," users are able to set player names(player1 is required, player2 and player3 are optional) and adjust the board's height and width.  

      - For "Candy Crush," users are able to set player names(player1 and player2 are required), board size (width and height), and the goal score. Game instruction provide basic information to user about how to play the game user selected. Error message box was added in game selection menu to ensure that users could correct any issues before the game starts.

🎮Tetris

      The game rule is basically the same as a normal Tetris game. Specifically, the Nintendo rotation system is implemented along with wall kicks. However, since the Super rotation system (SRS) is not implemented, it would be very difficult to have last second rotations.

      For score calculations, each matched row will add 100 points, if four rows are matched together then 800 points are added instead. When the user drops floating tiles, the steps that the floating tiles move downward will be multiplied by 3 and added to the score.

This version of Tetris supports at most three players, with the following three sets of keybindings:
1. W - rotate, A - move left, S - drop immediately, D - move right
2. I - rotate, J - move left, K - drop immediately, L - move right
3. Arrow Up - rotate, Arrow Left - move left, Arrow Down - drop immediately, Arrow Right - move right

      If only one player joins the game, game will be in practice mode. If more than one players join the game, players will compete with each other. Each player will play in a separate board. For any player, the game ends for this player once a tile freezes the top row in the board. The game as a whole will ends after the game has ended for each player. If more than one player join the game, the player with the highest score will win.

🎮Candy Cru(a)sh

  Candy Crash is a puzzle-solving game similar to Candy Crush, but it supports cooperative two-player term-based playing.

Players share a single mouse to interact with the game, alternating turns to make their moves. Player 1 will use the mouse for the first turn. After completing a legal operation, they will pass the mouse to Player 2 for the next turn.

Game ends whenever any of following happens:
1. Total score of current game exceeds goal score.
2. The game reaches a dead end, which means no swap operation will lead to a valid match.

Players can choose to restart the game when it ends, and their profiles will be kept.

🎮Showcase