The idea here is to have the core implementation and the basic funcionalities of a turn-based game working in a clean repository, so every time a new project/prototype comes along I may use this implementation and skip rebuilding the basic mechanics.
Structures and funcionalities:
- Two players, Top and Bottom; (can be extended to more players)
- Events such as Start and End match integrated with an UI;
- Events like Player Started and Finished Turn also integrated with a simple UI;
- Restart point.
I am not going to go further with details about the implementation because you can check the repo. But the idea is to have a MVC with a separation between Model and UI.
All the comunication UI and Model is done using the Singleton Pattern and the Observer Pattern.
- State Machine that controls the game flow
- Game Model
- Game Controller
- Game Events
- Patterns and Tools
Gif for a better visualization of the game flow:
I made as example the project in this link using this idea.