Game Development Reference
In-Depth Information
Somewhere in the middle, we pass through values similar to what we had initially
defined for the damaged value.
By changing the formulas we can tweak the behaviors to tailor them to what we
are trying to accomplish. For example, I decided that, even if the agent is about to
die, there should still be a 10% chance that it would attack. Depending on the
behavior I was trying to emulate, this might be unreasonable. A different formula
would yield something entirely different. Let's change the attack formula to the
following:
We now have a result in which the initial attack percentage is about the same
(80.75) but falls to zero as the agent's health gets to 15%. Below that, the only op-
tions are to hide or flee with the appropriate percentages. (Note that we would have
to be careful to not use the negative numbers generated by this formula in the cal-
culations of our hide and flee values.) This change leads to a completely different
behavior for the agent—and a very different experience for the player. As before,
the player will see severely wounded agents using the various retreat behaviors
more and more often, but they will never see a critically wounded agent attacking.
Using a formulaic approach leads to smoother changes in values and, if con-
structed properly, is often very computationally efficient. There are also plenty of
variations that we can apply to this approach. Rather than simply linear formulas,
we can use exponential, logarithmic, or even complex polynomial expressions to
define our behaviors. Each of these types of lines and curves has its own character-
istics and, therefore, can be used to create very different behavioral responses.
On the other hand, we experience some loss of control by putting things en-
tirely in formulaic terms. Notice that in the original three-column version (Figure
3.5) there was a subtle rise in the hide value when the agent was in the damaged
state. Using our strictly linear approach (Figure 3.6), we lost that subtlety. In fact,
it may have been difficult to find an appropriate combination of formulas that sat-
isfied exactly what we wanted. If a formula makes things too sterile, a hand-crafted
approach may be more appropriate.
There is generally no “right answer� to which approach to use. The number of
possibilities is, for all intents and purposes, infinite. The trick is to select one that
best approximates whatever it is that we are trying to emulate. We will investigate
more of theses strategies in Part III, “Mathematical Modeling.�
 
Search WWH ::




Custom Search