Game Development Reference
In-Depth Information
Another relationship we identified earlier also involved the weapons. The
strength of a weapon is neither based only on the damage that it can do nor only on
the accuracy with which it can be used. We combine these two factors into a single
measurement. We measure it as the amount of damage that a weapon can do per
second when we factor in the probability of a hit. In the graph in Figure 14.6, we
labeled this “effectiveness.� By combining these two pieces of data into one concept,
we establish a relationship.
We can add another component to this relationship. This one makes it far
more useful and relevant to the decision we are trying to make. By taking into ac-
count the health of the target that we are considering, we can determine how long
it would take for us to kill that target with a given weapon at a given distance.
Of course, what is missing in the above equation is that Accuracy and Damage
are the results of the distance-based formulas for the weapons. Figure 14.10 shows
the entire cascade of relationships that leads us to the TimeToKill value.
FIGURE 14.10 As we add more relationships between our individual components
of data, we create data that is more useful to our overall decision process.
P UTTING I TIN C ODE
The code for this relationship is as simple as it seems. We create a function that takes
the accuracy rate, the damage rate, and the target's health and combines them into
one figure based on the formula above.
Search WWH ::




Custom Search