Learn more about game states and what you can use them for.
Game states are an easy way to keep track of what’s currently happening in your game. A game state is either Active or Inactive, the game can have multiple active states at the same time. Game states are set up in the Makinom editor (Game > Game States).
Game states are mostly used as conditions for starting machines or displaying HUDs, and can be checked in schematics to decide the next nodes that will be executed.
Changing Game States
Game states can be changed by schematics (using a Change Game State node) or automatically through certain events or other game states being activated or inactivated.
A game state can be automatically activated or inactivated by the following events:
- Start Game
When the game is started (using a Start Game node).
- Stop Game
When the game is stopped (using a Stop Game node).
- Pause Game
When the game is paused (e.g. using a Pause Game node).
- Unpause Game
When the game is unpaused (e.g. using a Pause Game node).
- Start Scene Change
When starting a scene change (before fading out).
- End Scene Change
When ending a scene change (after fading in).
- Start Blocking Machine
When starting a Blocking execution type machine.
- End Blocking Machine
When ending a Blocking execution type machine.
- Block Player Control
When the player control is blocked (e.g. using a Block Player Control node).
- Unblock Player Control
When the player control is unblocked (e.g. using a Block Player Control node).
- Block Camera Control
When the camera control is blocked (e.g. using a Block Camera Control node).
- Unblock Camera Control
When the camera control is unblocked (e.g. using a Block Camera Control node).
The events can be added in the game state’s settings in the Makinom editor.
The game state Game Running is auto activated by the event Start Game and auto inactivated by the event Stop Game.
While the player is playing the game (e.g. started through a main menu), the Game Running state will be active and can be used to display HUDs.
The game state In Control is auto activated by the event Unblock Player Control and auto inactivated by the event Block Player Control.
The machine handling player control (e.g. a tick machine) and all interaction machines will only start if the In Control state is active. The game can only be controlled while the player controls aren’t blocked.
Changing by other Game States
You can add game states that will be changed when a game state is activated and inactivated in the game state’s settings in the Makinom editor.
Game State Conditions
The current state of game states can be checked by Game State Conditions.
Game state conditions can check multiple conditions. Either all or only one of the check conditions must be valid for the game state condition to be valid.
A single condition can check:
- Game State
Checks if a single game state is active or inactive.
Checks multiple game states, either all or only one of the game state checks must be valid.
This can be used to create complex game state conditions.
Checks a game state condition template.
Schematics can check game state conditions using a Check Game State node. The next node that will be executed is determined by the conditions being valid or not.
Machine components and global machines can use game state conditions to determine if the machine can start.
HUDs can use game state conditions to determine if they’ll be displayed.
A game state condition has 2 conditions, one of them must be valid:
- Condition 1 (Game State)
Checks if the single game state A is active.
- Condition 2 (Conditions)
Checks if the game states B and C are active (i.e. all checks must be valid).
Game states A and C are inactive, game state B is active – the whole condition is invalid.
Game state A is active – the whole condition is valid, game states B and C don’t matter.
Game state A is inactive, B and C are active – the whole condition is valid.
Usually, you’ll keep checking the same game state conditions very often in a game. To prevent setting up a condition each time you need it, you can create a Game State Condition Template, that can be used by game state conditions.
You can create templates in the Makinom editor (Templates > Game State Condition Templates).