Skip to content

PapkovNikita/Core-Match-3-Mechanics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Core-Match-3-Mechanics

I focused more on the code and architecture (extensibility, testability, performance) rather than the game itself. As a result, visually, it appears as simple as possible with basic Match-3 mechanics.

Demonstration of the results: Integrational test example:
(Performs 1000000 random swaps)
Unit tests:

Stack

  • Unity 2021.3.16f1
  • VContainer (a lightweight, fast DIContainer with code generation capability)
  • UniTask (a more convenient and modern alternative to coroutines and callbacks)
  • UniTaskPubSub (an asynchronous MessageBroker to fully separate the UI and Model layers)
  • DoTween (for various animations)

For testing:

  • Unity Test Framework
  • Moq

Architecture

For the architecture, I chose a 2-Tier Architecture, which includes a model layer (Game logic, Service Layer, Game settings, etc.) and UI.

The model layer knows absolutely nothing about the game's interface layer. All interaction between the model and UI occurs through an event bus in a unidirectional manner, and if the game lacks an interface, nothing breaks. This makes testing convenient and quick.

For game state management, I went with a state machine as a flexible tool, which clearly outlines responsibilities.

If needed, you can quickly and easily add a new state, for instance, for handling and activating special tiles (like bombs and so on).

You might also find the following classes interesting:

  • GameController - The entry-point in this project
  • BoardService - Manages everything that happens with the board (deletion, addition, moving of tiles)
  • BoardGenerator - Responsible for generating tiles without initial matches
  • MatchDetectionService - Handles match detection on the board
  • SwipeHandler - Manages game swipes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Languages