Finite State Machines (FSMs)
Finite State Machines (FSMs) are a simple yet powerful way to model AI behavior by defining a limited number of 'states' an agent can be in, and 'transitions' between these states based on specific conditions. For example, an enemy might have states like 'Patrolling,' 'Chasing,' and 'Attacking,' with rules governing when it switches from one to another (e.g., from 'Patrolling' to 'Chasing' when a player is sighted). This provides clear, discrete blocks of behavior for AI agents.
Imagine a traffic light, which has distinct states like 'red', 'yellow', and 'green', and rules for when it changes from one color to the next.
FSMs provide a clear, understandable, and computationally inexpensive way to manage basic AI behaviors, forming a foundation for more complex systems.
Learn one new AI thing every day.
Daily Deck sends you seven plain-English cards like this every morning. Free.
Start free