ABSTRACT

Finite-state machines are an architectural structure used to encapsulate the behavior of discrete states within a system and are commonly used in games for artificial intelligence (AI), animation, managing game states, and a variety of other tasks. The driver of the state machine is the StateMachine class. This class is owned by the intelligent GameObject and manages the behaviors for that object. Every possible state inside the state machine is linked to a sorted list of transition/state pairs. A metastate is a state that contains its own state machine, which has multiple internal states. The simplest way to manage this is by having a special MetaState subclass that internally has its own state machine. It would be tuned just like any other state machine and could refuse any existing states. The simplest performance improvement is to time-slice the state machine update by limiting how often the state machine is updated and how many game objects can update in a single frame.