Game Development Reference
In-Depth Information
We need to include a way of adding that priority into our target selection algo-
rithm. Before we do that, however, we need to define what “close to� and “increased
priority� mean. To do that, we construct another formula. Once again, we tap into
a type of formula from Chapter 10. We will define Urgency as the result of a formula
with an exponent that is less than 1 (a root ). By subtracting from the high value, 1.0,
we arrange it so that as distance from the detonator increases, the urgency of the
target drops away from 1.0. The formula we will use is
Once again, the effect of this formula is easier to visualize as a graph (Figure
14.8). In this case, we are using a parabola to simulate the rise in Urgency as the
range decreases. The nature of an exponent-based curve is such that the range of
change is very significant near the vertex ( Range = 0, Urgency = 1.0). While there is
an increase in Urgency as the distance diminishes throughout the entire range of the
graph, the rate of change increases markedly as the distance approaches 0.
FIGURE 14.8 As the range to the detonator increases, the urgency level
for the target drops. As the target's range to the detonator decreases,
especially as it closes within 25 feet, the urgency rises rapidly.
A Jumble of Blocks
We have now defined all of the pieces and parts that we will use in our decision. We
have not only set values for the various Dudes that we will encounter, but we have
established formulas for calculating more complex (yet still concrete) values such
as the range-based damage and accuracy figures. However, none of these parts
work together . We have lots of facts and formulas, but no cohesion.
Search WWH ::




Custom Search