Modular behaviors provide the basic building blocks of any AI engine. However, it’s usually necessary to combine lower-level behaviors into more complex ones. Using a hierarchy is the most obvious next step, and the most popular in the games industry.
So why does a hierarchy offer good ways of structuring AI logic? There are a few reasons:
It’s an intuitive way to think about organizing behaviors.
The dependencies between the behaviors in a hierarchy are obvious.
Many types of behaviors can be expressed as a hierarchy.
It’s an effective way to understand the actor’s current state of mind.
Having a hierarchy in your game AI is noticeable through the following factors:
The brain of your actors can be structured in layers.
Behaviors are organized as file folders on disk.
Designers can easily make smarter behaviors by adding elements to existing ones.
Common patterns are used to assemble complex behaviors from simpler ones.
Taken together, these advantages prove to be rather effective when developing AI. Hierarchies make the process of creating complex AI much more manageable.