It's impossible to keep track of every single entity's state in a game with just if and else branches.

The concept of Finite State Machines solves the complexity of keeping track of states within a game. A state machine takes a set of inputs and responds to those inputs by changing its state.

A character can either be Idle, Walk, Jump

What are the rules for Finite State Machines?

This flowchart is a State Machine:
Pasted image 20260216134657.png