Game Development Reference
In-Depth Information
As with the weight example above, the denominator of the fraction here repre-
sents the maximum value that we are using as our “endpoint.� In the weight exam-
ple, we divided by the constant that represented the maximum weight a character
could carry. In this case, goal is the maximum number of soldiers we are striving
for. The approach is the same—actual number divided by maximum number. The
only difference is that we have an exponent in the formula. If we apply this expo-
nent to both the numerator and the denominator, the proportion of actual to max-
imum remains intact.
If we graph results from a number of different values of goal , we find that the
curve is identical for all of them (Figure 13.6). In all cases, the utility of the first sol-
dier is 1.0. Then as we move through the range from 1 to goal , the utility of each sol-
dier decreases as a rate proportional to how many total soldiers we are building.
When n = goal , the utility is 0. (In practice, we would adjust the formula so that the
utility reaches 0 after the last soldier by changing the denominator of the fraction to
( goal + 1) 3 . Otherwise, with a utility of 0, we would never build the last soldier. For
clarity of the graphs, I did not do so here.)
FIGURE 13.6 By constructing a formula that normalizes the utility values,
the results follow the same curve from 1 down to 0 regardless of how
many soldiers we are building.
Search WWH ::




Custom Search