Vertigo
PSX Plan
NPC
Behavior
Language: C++
Libraries: NONE
Algorithms:.
Priority: High
Requisite Components: Engine, Collision
Detection
Platform Dependent: No
Data Structures:
Description: Non-player character
behavior is a crucial piece of the
game.
Every non-player character (NPC)
must
interact with the rest of the world.
This is
accomplished by assigning each NPC
an
object which encapsulates its current
state
and its update and collision functions.
The current state of the NPC describes
the
type of behavior which it is currently
performing. Possible states include
RUNNING_AWAY, CHASING, CRASHING,
RACING, etc. Each state may have
sub-states, for instance chasing
may have
three states, one when searching
for the
target, one for when the target is
spotted
but far, and another for when the
target is
near.
The update function for an NPC evaluates
the current environment in the context
of
the current state of the NPC. The
update
function can perform any action which
the
user characters are able to perform,
for
example, push to gain speed, start
or finish
turning, start a trick. User characters
which
are not skateboarders will have mush
simpler actions and therefore much
simpler options in the update function.
Each NPC may need a special collision
function. This is useful in the case
where
causing one member of a skate gang
to
crash will incite the other members
of the
skate gang to chase the player. In
this
case, the collision function will
update the
other skaters state to be CHASING.
|