Crafting Tactical Behaviors
Tactical behaviors are high-level components composed of primitive actions. Defining commonly used behaviors not only assists human engineers in developing strategies, but also simplifies the task of learning AI.
Reusing and Customizing Capabilities
Because most behaviors exhibit common functionality, each will depend on the components developed throughout this book (for instance, moving, shooting, or selecting weapons). This is shown in Figure 45.1. Although the behaviors depend on common functionality, the parameters passed to these components are customized as necessary.
Figure 45.1. Hierarchy of dependencies with AI modules that are customized to provide specific functionality. The explore behavior relies on wandering movement, looking around, and selecting a weapon for rapid retaliation.
Some of the behaviors do not depend on existing capabilities because they are trivial to handle without modularity (for instance, looking around). In the other cases, customization can happen in multiple ways:
The tactical behaviors themselves can be created freely with any technique. Most behaviors discussed in this book are well suited to managing the functionality of nested components in a hierarchy. For example, finite-state machines consider nested states as dependent functions; rule-based systems depend on functionality to provide the body of production rules; scripts or native programming languages can be used.
Despite each of the child components being customizable, we'll assume that each of the behaviors can be called without any parameters (an Explore() function, in this case). Nevertheless, the behaviors can—and often will—be context dependent; the parameters will be gathered implicitly by the behaviors (for instance, query of the environment).
Using the behaviors of human players as examples will assist the development of the AI. Neutral behaviors are analyzed first:
In deathmatch games, offensive behaviors are needed to score points:
Naturally, there are defensive counterparts to these behaviors: