Game Design

(Elliott) #1

Of the games I have worked on,The Sufferingrelied the most on scripted AI behav-
iors to make its characters appear smart and to create a compelling gameplay
experience for the player. This scripting took a number of forms. Frequently, we would
use some light scripting to introduce a creature into the environment. For example,
when the player runs through a trigger along the top of a wall, we then activated a num-
ber of creatures to jump up onto the wall and run down it toward the player. After the
creatures landed on the wall, they would follow a path toward the trigger the player hit,
breaking off from that path as soon as they took damage or when they detected the
player as a viable target. One particularly crafty creature early in the game was scripted
to rip a door off its hinges (which happens in a cut-scene), and then run to the various
dark corners of the room until the creature either takes damage or a timer runs out.
This gives it the illusion of playing cat and mouse with the player. This only happened
until the player was able to damage the creature, since after that it seemed foolish to
continue taunting. There were a number of places in the game where players were able
to attack NPCs with ranged weapons from a high and inaccessible position where the
melee combat based NPCs were unable to retaliate. Unfortunately, the creatures were
unable to figure this out on their own, so without some type of scripting they would
tend to fruitlessly attempt to navigate to the player’s position and ended up looking
fairly stupid doing so. In these situations, we added scripting that would switch the
NPCs between a hostile and a flee behavior depending on whether the player was in the
sniper spot or not.
The human companions the player encounters throughout the game were heavily
scripted. Some of these characters lead the player from location to location over the
course of a particular level. These destinations were specifically mapped out by the
level designer ahead of time. Sometimes they were set to be on the watch for hostile
creatures while moving to those positions, while other times they are set to blindly
move to a location and only then become hostile to whatever threats they might find.
Typically the AI agent would then stay hostile until a certain success condition was met
in the environment, such as all the creatures in an area being killed or the player having
solved a particular puzzle. Only then would they be triggered to move to the next desti-
nation. Typically, only the specific destination point is specified by the level designer,
with the AI dynamically figuring out the best path to get to that location based on its
current position. These friendly NPCs also tended to be big talkers, and hence said spe-
cific dialog at different points throughout the level, all integrated into the more active
behaviors they performed as part of their scripting.
Beyond event-based scripting,The Sufferingalso used a lot of NPC “helper”
objects that were set up by hand by level designers. These took primarily two forms:
flee positions and targeting positions. The NPCs would know to use the former when
they needed to flee from combat in a room, and we placed these positions in little nooks,
behind pillars, and in other places that it would look intelligent for an NPC to hide.
Before actually using one of these positions, the AI agent would need to analyze all the
locations within a certain radius around it, picking the one where its enemies did not
have line-of-sight to it and where, in order to reach that position, it would not need to
pass too close to any active threats. Even once the AI picked a particular flee location to
use, the AI would continually reevaluate its decision, potentially moving to a different
position if an enemy ran too close to a given location and thereby made it significantly


170 Chapter 9: Artificial Intelligence

Free download pdf