A trigger is an object that defines a condition, which, when satisfied by an
agent, generates an action (it is triggered). Many of the triggers utilized in
commercial games have the property that they are triggered when a game
entity enters a trigger region: a predefined region of space that is attached
to the trigger. These regions can be any arbitrary shape but are usually cir-
cular or rectangular for 2D environments and spherical, cubic, or
cylindrical for 3D environments.
Triggers are a wonderfully useful tool for both game designers and AI
programmers. You can use them to create all sorts of events and behaviors.
For instance, triggers make doing stuff like this easy:
A game character wanders down a gloomy corridor. It steps onto a
pressure-sensitive plate and triggers a mechanism that rams forty
pointy sticks through its respiratory cavity. (This is one of the most
obvious uses for a trigger.)
You shoot a guard. When it dies a trigger is added to the game that
alerts other guards to the body if they wander within a specified dis
tance of it.
A game character shoots its gun. A trigger is added to the game that
alerts any other character within a specified radius to the noise.
A lever on a wall is implemented as a trigger. If an agent pulls it, it
opens a door.
You’ve implemented a puzzle in one corner of a room but you think
a few players will have difficulty solving it. As an aid, you can
Raven: An Overview | 303
Overview of the Game Architecture
Figure 7.2. UML class diagram showing the Raven projectile hierarchy