State Machines¶
State Machines (also known as Finite State Machines or FSM) are the most basic form of AI.
As its name implies, an entity can be in just one state at a time and can only transition to another state which is linked to the current one.
Simple FSM
For example, a very simple State Machine could define the behavior of a guard. We could define two states:
- Patrolling
- Attacking the Player
The guard would start in the Patrolling state and only transition to the Attacking Player state if the player is in sight.