1

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 array of IPhaseSystems.

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 isVictory() method.

Initialization of the world requires a single AbsGameSystem and an IVictory.

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 pushSystem().

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.

Deduplicator
  • 8,591
  • 5
  • 31
  • 50
MLProgrammer-CiM
  • 333
  • 2
  • 13
  • While I can't remember the specifics of the abstraction, there was a bit about it (at a high, non-tech level, but one that could point you in the right direction) in [The Nudist on the Late Shift](http://www.amazon.com/The-Nudist-Late-Shift-Silicon/dp/0375502777). The implementation was that of Yahoo Games. Though *any* turn/rule based game could be a bit of a stretch. –  Nov 17 '14 at 00:54
  • This is a hard problem to solve top-down. Make it work for one game, then extend it to another, and another, until it's pretty general. If you make it work for at least two, it's hardly futile. – Fuhrmanator Nov 17 '14 at 21:36

0 Answers0