Computation

The heart of the framework design deals with operating on commands for both players and moderator.

A computation handler receives a command flow and uses the information it contains to provide a service and potentially to alter the game state.



Received commands fall into two seperate types :

  • single commands : can be executed independently
  • multi-commands : a command execution depends on other commands

A move order in the game of chess is self-sufficient.

All orders in the board game Diplomacy must be resolved together as a whole.



Computation handlers are able to deal with single and multi-commands uniformly by using strategies.

Strategy

A strategy is an object that receives each command sequentially and that applies a specific algorithm.

The strategy is notified before and after the flow has been handled via pre- and post-strategy events.

Chronology

A turn computation falls into several phases, each one managed by a dedicated computation handler.

Processing a turn stands for sending a command flow to several computation handlers in a chronological pattern.

The chronology of a turn is the ordered list of handlers used to compute game turn phases.



The board game Diplomacy has only one phase per turn : resolving player armies moves.

A turn in the board game Junta is split into several phases.



A computation handler can even only use the received flow as a trigger event and not pay attention to the commands it contains.



In Spaceward'ho! players receive an income based on populations on their planets at the end of each turn.



A specific handler is responsible for increasing the current turn number in a context.

This handler is more likely to be triggered at then end of the chronology.