Formal Game Description
We want to provide a formal, mathematical description of the key elements in a game:
- Game State
- Game View
- Game Setup
- Player Actions
- Victory Conditions
- Progression of Play
--- config: theme: neutral --- flowchart LR; s((setup)) ==> s0(state 0) === p0[[progress]] ==> s1(state 1) ==> e1{{victory?}} ===|no| p2[[progress]] ==> s2(state 2) ==> v2{{...}} s0 -.-> v0([view 0]) a0[action 0] -.-> p0 s1 -.-> v1([view 1]) e1 --->|yes| e((end)) a1[action 1] -.-> p2
You can download the godot project that implements this material.
Game State
The essential information about the game.
- The set of players is .
- The set of boards is the set of matrices with entries from .
- The set of states is
- If we also define the following functions:
Game View
What part of a state is shown to player ?
If :
Other games might show only some part of the full state. For example, imagine a card game; the state describes each player's hands plus the deck and the stack; but, for each player, only her's own hand and possibly the cards on the desk are visible.
Game Setup
How does the game starts, i.e., what is the initial state?
Player Actions
What are the players actions and how do they define the next state.
The effect of action by player in state is defined by:
Legal actions define a new state while illegal ones keep the state unchanged.
Victory Conditions
When the player wins the game.
Here we also define a draw state as:
[!IMPORTANT] Note that e.g. states that, in state , all the elements in the third column are equal to .
Progression of Play
Given a state , the progress (next state) that results from action by player is:
The state only progress if it is not a ending state and the action is legal.