//no target to shoot at so rotate facing to be parallel with the bot's
Notice how when the aiming position is predicted, a line-of-sight test must
be made to ensure the predicted position is unobstructed by walls. This is
not necessary if the weapon is aimed directly at the target because the LOS
to the target position is cached when the target’s memory record is updated.
Notice also how immediately before the weapon is fired, some noise is
added to the aiming position in order to prevent the shot from hitting the
target 100 percent of the time.
TIP For some games it’s a good idea to ensure an AI controlled agent always
misses the first time it takes a shot at the player. This is because the shot will
warn the player to the presence of the agent, enabling him to take appropriate
action without getting hurt immediately. This is particularly useful for scenarios
where a player often enters unexplored rooms full of baddies because it gives
him a chance to retreat a little and take stock of the situation instead of getting
Also, when deliberately shooting to miss, if the projectile or its trajectory can
easily be seen (like a rocket or arrow), you can add to the excitement by ensur-
ing the shot passes close by and within the player’s field of view.
Another good aiming tip is this: If the player’s health is very low, reduce the
aiming accuracy of any bots shooting at him. This way he gets a chance to pull
off an amazing recovery, which will enhance his game playing experience signif
icantly. (He gets to feel like Aragorn in the Battle for Helm’s Deep instead of like
Paul Newman and Robert Redford in the last few minutes of Butch Cassidy and
the Sundance Kid!)
Putting It All Together
Figure 7.8 shows how the AI components discussed in the last few pages
interrelate. Note how the
Goal_Think object has no direct control of
low-level components such as movement and weapon handling. Its purpose
is to arbitrate between and manage the processing of high-level goals. Indi
vidual goals utilize the lower-level components as and when required.
Raven: An Overview | 327