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 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.
Game states are set up in Game > 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:
The events can be added in the game state’s settings in the Makinom editor.
You can also create custom events by deriving your class from the BaseGameStateChangeType class. Check the classes for the available events for examples.
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.
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.
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:
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.
You can also check the start conditions of a machine in it’s running schematic using a Check Start Conditions node.
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:
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 Templates > Game State Condition Templates.
© 2015 Gaming is Love e.U.
Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!