JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section

Behavior Enhancements

Players in the game can take advantage of these items and contraptions with specific behaviors. This section investigates such behaviors, starting with an examination of the human approach. The criteria for evaluating AI at this task are discussed, and a case study of the behaviors required finishes the section.

Human Approach

The use of items is the most important ability for humans, then dealing with contraptions, and, finally, behaviors involving objects indirectly.

Picking Up Items

Collecting objects in first-person shooters is mostly a matter of moving toward them and walking over them. The items are automatically used by the player, either added to the inventory or processed directly.

We've already discussed movement as a preventive measure for avoiding obstacles, and even movement with loose goals such as exploration or wandering. The process of picking up items is more focused; it requires moving in a very specific direction.

Humans do this almost subconsciously, combined with the other movement behaviors (such as preventing collision). Picking up objects can be considered a short-term goal-directed behavior that only leads to small detours. Rarely does seeking a target affect the primitive movement abilities, such as avoiding ledges and preventing collision; humans are very good at combining these sometimes contradictory requests.

Using Contraptions

Handling contraptions in the environment (for instance, ladders or platforms) is more of a challenge; the movement required is not a special case of wandering behaviors. Additional skills such as pressing switches (voluntary contact), waiting for an event, or moving vertically on ladders are more sophisticated behaviors.

On top of this, players also need to combine abilities together to get through contraptions. Sequences of actions are needed to move through open doors or catch an elevator. Each action is triggered by events or conditions that arise from the previous action. For this reason, these short "plans" can be considered as reactive because they are driven by direct observations.

These sequences of actions are therefore very simple. After the decision has been made to use the contraption, it's just a matter of acting reactively according to a set pattern—with little or no variation. Apart from the actions required to activate the contraptions, few other actions are taken.

Behavior Enhancers

This part of book covers not only the direct use of objects, but also behaviors that involve objects in a less-obvious manner—for example, animats that rocket jump or even dodge incoming projectiles. Just like the use of contraptions, behavior enhancers can be considered as a sequence of reactive actions. The difference, however, is that the behaviors are triggered at arbitrary moments rather than in specific locations.

Naturally, players determine the most appropriate moment to dodge weapons or rocket jump—instead of doing it all the time. The question of dodging projectiles is relatively straightforward, because it's only possible when a weapon has been fired. On the other hand, determining when to rocket jump is instead dependent on the height of the obstacle in front, and the desire of the player to lose health to get over that.


Just like for other reactive behaviors, certain properties are expected to maintain the illusion of realism. Luckily, the AI relies on existing movement capabilities developed in Part II, so much of the work is already done—guaranteeing smooth, humanlike motion.

In this part, we must pay attention not to abuse the "enhanced" behaviors to prevent them from standing out too much. Even if they are realistic, it's good practice to try and keep their use to a minimum. A good way to achieve this is to abide by the following criteria:

  • Effectiveness— By making the behavior as efficient as possible (for instance, no wasteful moves or pauses), the result will be close to what was intended by the design of the door or platform. The optimal behavior is easy for the AI to learn, but also comes close to human behavior.

  • Consistency— The actions need to be justifiable. The last thing we need is an AI that performs one action, but does not follow up on it—for instance, opening a door but not going through it. The entire sequence of actions needs to be consistent.

These are the basic criteria we'll use to evaluate our animat's behaviors from a high-level perspective. We need a case study to explain the lower-level details.

Case Study

Because there's little common ground among the behaviors, they need to be analyzed separately:

  • When opening a door, the player walks toward the switch and it gets pressed automatically on contact. The player stands back while the door opens, and walks through as soon as it opens wide enough.

  • Getting onto a platform first involves pressing a switch, and then waiting for the platform to reach its destination. When it's in place, the player gets on and the platform will generally move up automatically.

  • To get on ladders, the player must move forward until contact is made. The player must face in the direction of the ladder at all times in order not to fall off. Climbing is achieved by looking upward and moving forward.

  • Jump pads just need to be walked on, at which point the player gets projected into the air. By moving when in the air, the player can control the fall.

  • Dodging incoming missiles is a matter of moving away from the line of fire, as well as moving away from the estimated point of impact.

  • Rocket jumping is a matter of looking down, jumping using the standard command, and then releasing a rocket into the ground.

Such capabilities will enhance our animats to a level that matches the reactive behaviors of humans.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor