JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section

Part V: Using Items and Objects

The animats created so far are sensitive to particular aspects of the world (for instance, obstacles), but insensitive to most objects. They have broad senses but selective perception, because previous parts of this book focus on important behaviors and neglect little details.

This part remedies this problem, rounding out the animat's skills. Notably, they are taught how to interact with various objects in the world (for instance, picking up items, pressing buttons, and following on) and shown how to not use objects (for instance, putting a pin back in grenades and trying to catch rockets).


The main goal of this part is to deal with all the little details that make a good deathmatch nonplayer character (NPC). This involves actively collecting items such as armor, weapons, and ammunition. We also want our AI not to look stupid when encountering a ladder, platform, or door. The animats should not avoid doors like obstacles, lacking the perception and capability to deal with such contraptions. Essentially, the AI must make the most of all the items in the world.

There's also another aspect to this part: defensive behaviors. Dodging behaviors or evasive maneuvers can be seen as ways to use objects in the world—specifically avoiding projectiles. These instincts of survival also balance out the offensive behaviors developed previously.

The animats also learn to rocket jump, using the same technology as dodging fire. In fact, technically speaking, the following chapters provide a way to deal with many heterogeneous behaviors using similar AI technology.

As far as learning is concerned, an intuitive representation bridges the gap between hand-designed behaviors and learned ones by encoding action sequences in a way that's convenient for the computer and the designer, with advantages for both parties involved.


As more of the AI becomes complete, less time needs to be spent defining interfaces, so the time is used to brush up on some technology. Three chapters cover theory, two focus on practice, one chapter has a lesson, and one chapter discusses preparations:

Chapter 29, "Analysis and Specification." The first chapter of this part merges the three predevelopment phases together as preparation: analysis of the environment's involvement, understanding the behaviors from a human player's perspective, and specification of extensions to existing interfaces.

Chapter 30, "Fuzzy Logic." In this chapter, we focus on the theory behind a popular AI paradigm known as fuzzy logic. We show how fuzzy logic is better suited to represent linguistic concepts as defined by humans. To use fuzzy logic in practice, we need a fuzzy expert system—similar to standard rule-based systems.

Chapter 31, "Enhancing Movement Behaviors with a Fuzzy System." In this chapter, fuzzy logic is applied to enhance movement behaviors. Notably, fuzzy rules control the animats up ladders, onto platforms, and through doors. The fuzzy approach enables us to create very smooth-looking behaviors.

Chapter 32, "Genetic Algorithms." Now it's time for another chapter on theory—specifically, genetic algorithms. In essence, evolutionary principles are applied to optimize behaviors by letting only the fittest solutions survive.

Chapter 33, "Learning Classifier Systems." Combining genetic algorithms and representations based on rules, this chapter introduces learning classifier systems. This technique can be used to adapt behaviors to problems by trial and error in the environment. The best set of rules can be learned this way.

Chapter 34, "Adaptive Defensive Strategies with Genetic Algorithms." By using a genetic algorithm and similar concepts to classifier systems, the animats learn action sequences. Specifically, they adapt defensive strategies by dodging fire or using preventive maneuvers. Rocket jumping also is learned in this chapter with an evolutionary AI technique.

Chapter 35, "Designing Learning AI." The last chapter of this part is a lesson on learning AI. We discuss the different ways of simulating it, and the various approaches that can be taken. This chapter also presents tips and tricks to design a learning AI that avoids common pitfalls.


By this stage, an impressive amount of work has been done. Most of the code will obviously be reused, along with the tools, framework, and game engine:

  • The AI relies on previous behaviors for teaching the animats. The animats need to have basic movement, and their enemies must be able to shoot.

  • The world needs to have support for contraptions such as doors and platforms that behave automatically, as handled by the game logic. We expect the characters to have necessary low-level animations.

  • There are items in the world such as weapons, armor, and ammunition that the animat can perceive. The interaction with these items is also handled by the game engine, and the animations are dealt with transparently.

These are similar assumptions made throughout the previous parts and should be familiar by now. Be sure to visit the web site at for the corresponding code and setup instructions.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor