Engine to play (tabletop) games. Focused on implementing the rules, not a great visualisation.
Intended use as engine for games varying from TicTacToe to MtG.
Should be usable for single player and multi player games.
While the core parts should focus on implmenting and enforcing game rules, a REST API is envisioned to allow for interaction - possibly by bot implemantions. Visualization and interaction possibly with a web client using some trendy JavaScript/UI Framework.
Central Interface is IGame with an abstract Implementation BaseGame. IGame exposes a simple C# API with methods to control the overall running state of the game. The phases for Game objects are
- Constructed (new() called)
- Initialized (Init() called)
- Ready (to be started, enough players are registered)
- Running (Start() called)
- Over (Abort() called or some winning condition met) After reconstruction from persistence layer a game may start in Initialized-State.
Properties and Methods in IGame
- enum GameState State { get; }
- void Init()
- bool AddPlayer(IPlayer)
- void Start()
- void Abort()
- event Notification { add; remove; }
An implementation may add further specific methods like MarkCell(int x, int y)
The entire game flow is represented as messages that flow through the system.
The standard abstract BaseGame implementation handles state and player registration.
Further inheritance levels introduce different player/turn mechanics.
Furhter abstract game mechanics may be added through IContext implementations. A context is registered with BaseGame.
Interfaces and Base-Implementations