Functionalities

Turn-based games core features are :

  • Synchronization : orders may have to be handled in any predefined sequence.
  • Computation : orders are processed and the game state gets modified.
  • Visibility : users must only receive updates about game state entities they know about.
  • Distribution : users may not be at the same location than the game state.
  • Security : orders have to be checked in order to prevent cheating.

Synchronization

The game rules typically define a state machine in order to determine which player is allowed what orders and when.



In the game of chess each player alternatively sends one order.

In the board game Diplomacy all players send all their orders simultaneously.




The different possible synchronization mechanisms are :

  • Barrier : wait for all players to send one or several orders
  • Sequence : each player plays one after another
  • ...

Computation

Turn processing follows the game rules to resolve player actions and game events.

The game state gets modified during this phase.



Some orders may have to be handled immediatly while others should be delayed, grouped together or sorted.



Chat orders are most likely to be handled as soon as possible.

Auction orders should be gathered together and may be sorted according to the amount of money spent by the players.




All kind of orders cannot be handled separatly, some may require to be confronted to other orders.



Making players vote to elect one of them requires all vote orders to be taken into account simultaneously.



Chronology, explanation + how is it different from synchronization ?

The chronology traditionnaly ends with victory condition test and turn count incrementation.

Visiblity

Players may have only a partial knowledge of the game state, that is some information remains hidden depending on game rules.

Game state updates have to be filtered before reaching the players, thus creating a different view on the game state for each player.



In a strategy game players are often unaware of what is happening on the other side of the playing area (e.g. "fog of war").

Distribution

Sending the orders from the players to the moderator and propagating the game state modifications and turn results back require some distribution mechanisms.

Moreover, depending on the way a game works, a view on the game state per player might be maintained either on the moderator side or on the player side.

Security

The security issues fall into two different facets :

  • Static : immutable.
  • Dynamic : depending on the game state.

Static checks fall into several categories :

  • Validation : all order parameters must be valid.
  • Rights : a user may only be allowed a given set of orders.
  • ...

Dynamic checks depend on the game state.



In the game of chess, orders describe a move by a pair of coordinates : (square from which to move the piece, square to which to move the piece).

Checking that the coordinates are within the board is a static check.

Checking that a piece belonging to the player exists at the initial position is a dynamic check.

Checking that the piece at the initial coordinate can move in a way to reach the destination square is another dynamic check.