Game Development Reference
In-Depth Information
mpCurrentTarget = mvTargets[0].pDude;
mpCurrentWeapon = mvTargets[0].pWeapon;
}
Reading it in order, we score all the targets, sort the vector by the score, set our
target, and change our weapon. That's it. Easy enough. We did all the heavy lifting
in the layers of formulas that we built piece by piece (Figure 14.11).
FIGURE 14.11 The scoring algorithm for selecting a target and a weapon
combination cascades through many levels. We combine Time to Kill Enemy
with Time to Kill Me, to arrive at Threat Ratio, which we then
combine with Urgency to yield our final score for the target.
In Chapter 16, we will show some alternatives for selecting options that will
allow us to create less predictable, deeper-looking behaviors in our agents.
T ESTING THE A LGORITHM
We will now take our new algorithm for a complete test drive to test some combi-
nations of factors. When conducting this process, it is best to start with something
simple and predictable. For example, if we place our three Dudes the same distance
away from us and the same distance away from the detonator, and arm them all
with the same weapon, we eliminate many of the possible variables.
 
Search WWH ::




Custom Search