Game Development Reference
In-Depth Information
sophisticated approach and implement dynamic prioritization. With dynamic
prioritization, the valid transitions indicate how well they fit the state of the
Consider a more sophisticated monster AI. The transition that handles ''Flee
combat if health is low'' might be modified. The modified transition might factor
in how fast the player can move compared to the monster when computing
priority. A fast player would be able to run down the fleeing monster, so turning to
run would be suicidal. It might factor in if the player has missile weapons and there
is no cover. So in adverse conditions, the transition from Attack to Flee might still
be valid, but with a low priority. Why do this? Our more sophisticated monster AI
might have a Berserk state suitable for when all-out attacks are the only hope. Such
a behavior has a high entertainment potential for the player. Chances are that the
monster will become very scary and dangerous, but only for a very short time. The
transitions to the Berserk state have modest priority. The observed behavior is,
''When all the normally good ideas look like bad ideas, this normally bad idea is
actually the best idea.'' For a more in-depth coverage of useful techniques for
dynamic priorities, see Behavioral Mathematics for Game AI [Mark09].
This level of sophistication is not required in all cases, and might not be
observable. If it is not observable and the player cannot recognize it, it is wasted
effort. Games are an entertainment product first and foremost; everything in
them should be there for the player's benefit.
Note that not all of the transitions in Figure 3.2 needed to evaluate all of the
conditional data. In a good FSM implementation, the transitions do not take into
account every possible event or condition in the world, only those needed to
cause a particular transition and those needed to disambiguate similar transi-
tions. This simplifies life for the programmer. Note that there is no transition
from the Hiding state to the Flee state. It commonly happens that there will be
many fewer transitions than are possible, especially when there are many states.
This also simplifies life for the programmer. The maximum number of transi-
tions possible is N*(N 1) where N is the number of states. The only hard rule
about transitions is that there should only be one transition out of a state for any
unique set of conditions.
In actual implementation, programmers encounter complexity that is hidden by
the state diagram. For each state, there can be an entry function, an exit function,
Search Nedrilad ::

Custom Search