Skip to content

Finite State Machines

WhatIsFSM

Finite state machines are a core building block of many different systems in computer science and video games. They remain in one state until a transition condition lets them move to the next state.

They can be useful for many different state based gameplay systems. Take a menu UI with [Start / Load / Options / Exit]. Each one of those could be a state the user is in. Options could be a nested state machine with multiple sub states. Transition rules might be if the user is pressing the arrow key or is clicking on the UI widget. In the event all other states might link to each other you can use an Any State node to simplify the graph.

When determining if you need to use a state machine, consider if your object needs to be represented in different states, and if there are clear rules to move between states.