Gamecraft
0/462
The machine: all 32 words

State machine

Also said as Finite state machine, FSM

A thing is in exactly one of a list of states, and a table says which event moves it to which state. An enemy might have Patrol, Chase and Flee, joined by events like "saw the player".

It stops the impossible, like attacking while dead, and it makes behaviour readable. It gets out of hand as states multiply, because every new state needs arrows to and from all the others.

“Give the player a state machine with Idle, Run, Jump, Fall and Dodge. Jumping is only legal from Idle and Run, and that alone fixes the double-jump bug.”

Each ghost in Pac-Man is always in one of three modes, chase, scatter or frightened, and the mode decides where it heads. Eating an energizer is the event that sends them all to frightened.

A state machine remembers where it is and waits for an event. A behaviour tree remembers almost nothing, and asks again from the top each time.

Name a word, or describe what you mean in everyday language.