In an exercise of futility I'm trying to abstract and generalize a framework where to build any turn/rule based system. I've had a head start but after decompiling HearthStone I'm second-guessing that it may have higher complexity than I expected, at least for abstraction. So, I would like a peer review of the approach I am taking.
For the premises:
No UI or IO bindings to maintain decoupling and testability. You should be able to unitest a full game.
Entity-Component-System, better memory packing, data-oriented, deterministic.
Centralized pushdown automaton for state control.
At the heart of the architecture is the interface/trait
IPhaseSystem. It has a single method,
pushSystem(), which returns an
From that interface plus an entity processing system we compose an abstract
AbsGameSystem class, which requires a
process() method. ECS systems already give the possibility to override pre and post methods, but is not mandatory.
There is an interface
IVictory with a single
Initialization of the world requires a single
AbsGameSystem and an
My game world in every event-driven step processes the system atop of the pushdown automaton, and then proceeds to push all states returned by
In my mind, from this simple setup and a communication pattern for UI/IO calls, like an Event Bus would be, should suffice to express any kind of board game akin to Catan, Magic: The Gathering, Dominion or Stratego.