Game Development Reference
In-Depth Information
FIG 5.10 Debug lines showing paths
in a waypoint graph.
represent an NPC's current behavior or state of mind. Formally, an FSM consists
of a set of states, S, and a set of state transitions, T. For example, an FSM might
be defined as S = {WANDER, ATTACK, PURSUE} and T={out of sight, sighted, out of
range, in range, dead} as shown in Table 5.1 .
In short, the state transitions define how to get from one state to another. For
example, in Table 5.1 , if the NPC is in state WANDER and it sights its opponent,
then the state transitions to PURSUE. The state is used to determine elements
of the NPC's behavior, for example, when the NPC is in state ATTACK the
appropriate attacking animation should be used.
TABLE 5.1 State transition for an FSM
Transitions ( opponent is… )
State
out of
sight
sighted
out of
range
in range
dead
WANDER
WANDER
PURSUE
-
-
-
PURSUE
WANDER
-
PURSUE
AT TACK
-
AT TACK
-
-
PURSUE
AT TACK
WANDER
Search Nedrilad ::




Custom Search