Game Development Reference
In-Depth Information
In Chapter 9, we explored the idea of relative utility. The decision that we often
had to make at each step of the process was to decide if two items or actions were
equally important or if one was more desirable than the other. We also had to decide
how much more important one selection was than the other. This leads to a decision
on how to weigh the utility of each action (Chapter 13). This is what we must do
now to build a connection between the independent values of TimeToKillEnemy
and TimeToKillMe .
Certainly, we would prefer a situation where it takes us less time to vanquish
our foe than it does for him to annihilate us. On the other hand, we also want to
pick off the targets that are quick for us to kill. If we get them out of our hair, we
have less to worry about. We will call the figure we are calculating ThreatRatio .
After experimenting with various combinations, we can arrive at something
that “feels� reasonable. We will define ThreatRatio with the following formula:
By multiplying TimeToKillEnemy by 3, we are making it three times as impor-
tant as TimeToKillMe . By dividing the weighted sum by 4, we are converting it to a
weighted average.
It's worth noting that we are, once again, relying on the principle of compart-
mentalized confidence. We trust that the processes that led us to the two “time to kill�
values are valid. With that trust, we can turn all of our exploration and experimenta-
tion to the components we are adding—the numbers involved in the weighted sum.
By selecting a few examples, we can visualize the effect of our formula. For now,
we will ignore how we arrived at these numbers (because we are confident, remember?)
and instead focus only on the effect of the weighted average.
TimeToKillMe
TimeToKillEnemy
ThreatRatio
5.1
3.3
3.76
5.1
427.1
321.56
12.6
4.7
6.69
12.6
1,000.0
753.15
39.9
1.0
10.72
39.9
10.7
18.02
In the examples above, we can see a few extremes. The “best� score is the lowest,
so we see that the first line is the best option for us to select. In that example, we are
facing an enemy who can kill us more quickly than the other examples (5.1 seconds).
 
Search WWH ::




Custom Search