O'Reilly logo

Programming Game AI by Example by Mat Buckland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

such as a weapon or health. To facilitate this process, each bot owns a dedi
-
cated path planning class that its decision-making component can use to
request paths.
The evolution of the Raven path planner component is discussed in
detail in Chapter 8.
Perception
For many game genres (but not all), modeling perception accurately is one
of the keys to maintaining the illusion of intelligence since an agent’s
awareness of its environment should be consistent with its embodiment. If
a game character has two eyes and two ears situated on its head in a similar
fashion to a human, then it should perceive its environment accordingly.
This is not to say we have to model stereo vision and hearing, but it is para
-
mount that in a game of this type an agent’s decision logic is consistent
with what it should and should not be able to perceive within its sensory
horizon. If there is any inconsistency the player will grow disillusioned and
his enjoyment of the game will be greatly diminished. For instance, I’m
sure most of us have witnessed behavior similar to the following.
n
You approach a bot silently from the rear, but it immediately turns
around (maybe it hears you blink) and fragments your intestines with
a chaingun.
n
You run and hide. It’s impossible for your enemy to know you have
shut yourself in a tiny storage room, but nevertheless it proceeds
directly to your location, opens the door, and lobs a grenade inside.
n
You notice two guards in a guard tower. They sweep the ground with
a powerful searchlight but you notice a path to the base of the tower
that is always in darkness. You quietly and confidently crawl along
your chosen route. The searchlight never goes near you, yet one of
the guards shouts “Achtung” and pops a cap in your ass.
These types of events occur because the programmer has given the AI total
access to the game’s data, thereby bestowing the agents with the gift of
sensory omnipotence. He’s done it because it was easier, or because he
didn’t have time to separate out truth vs. perception, or perhaps just
because he didn’t give it any thought. In any event, this is a big “no-no”
with gamers. They will lose interest in the game because they will believe
the AI is cheating (which, of course, it is).
Ü
NOTE This type of sensory modeling is not as important for RTS-type games
where the CPU/memory overhead of implementing such a system for hundreds
of agents will likely be prohibitive. It’s also doubtful that significant improve
-
ments in gameplay will be made from implementing such a system.
To prevent these perceptual inconsistencies an agent’s sense of vision and
hearing must be filtered to ensure consistency with its visual and aural
capabilities. For example, in a game where each bot must exhibit similar
316 | Chapter 7
AI Implementation

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required