Post
Your character can only be in one state at a time -- idle, running, jumping, dead -- and the transitions between them define how the game feels.
A finite state machine (FSM) is a programming pattern where an entity exists in exactly one state at any time and transitions between states based on conditions. In games, state machines control character behavior (idle, walk, run, attack, stunned), animation blending, AI decision-making, menu navigation, and game flow. A character in the 'jumping' state cannot also be in the 'crouching' state. The transitions -- can I cancel this attack into a dodge? -- are where game feel lives. Hierarchical state machines add substates for complexity, and behavior trees extend the concept for more sophisticated AI.
Example
Hollow Knight's combat feel comes from meticulously tuned state machine transitions. The specific frames where you can cancel an attack into a dash, or chain a pogo bounce into a nail art, are all state transition windows that Team Cherry hand-tuned to perfection.
Why it matters
State machines are the backbone of predictable, debuggable game behavior. When a character glitches out and T-poses mid-combat, that is usually a broken state transition. Clean state machines are the difference between responsive controls and jank.
Related concepts