JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section


HFSMs improve upon standard state machines by adding the ability to cluster state, to express general transitions, to refine states that are to complex to handle with one procedure, and even to express independent components. In practice, this can be achieved using different concepts:

  • Nested states allow states to be defined within others. Generalized transitions apply to these resulting superstates.

  • Entire state machines can be nested within each other instead, with each finite-state machine forming a level in the hierarchy.

To implement the system, it's necessary to define the interaction semantics. This specifies how control is passed from one state to another:

  • The master/slave approach processes the child components first, moving toward the root of the hierarchy. Higher-level state machines get priority.

  • A stack-based simulation only processes the active finite-state machine, which lies on top of the stack. This changes only when the state machine removes itself from the stack.

  • A level-of-detail approach uses a traversal of the hierarchy based on a threshold value, refining the behaviors when more detail is needed.

HFSMs are an incredibly powerful concept, ideally suited to game AI development. They extend finite-state machines—one of the most popular game AI techniques—and make them easier to design. Because pure finite-state machines are not appropriate for every problem, the concept of heterogeneous hierarchies (or AI architectures) can be used interchangeably.

The next chapter uses the concept of a hierarchy along with extensions to finite-state machines to create realistic emotions in animats.

Practical Demo

There's a simple animat, known as Rarchy, that uses nested finite-state machines to produce deathmatch behaviors. The top-level task is refined as subtasks, each corresponding to its own modular finite-state machine. The system is best understood as a tree representing the hierarchy, available online at Rarchy performs well and provides explicit control easily.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor