Game Development Reference
In-Depth Information
Similarly, if we run to the Armor, the formula would be:
And, if we ran between the Health Kit and Armor (assuming we did not yet
have the armor), we would incur:
The common thread here is that it is always the damage rate multiplied by the
time spent . Assuming the values of the items themselves never change, the whole de-
cision would be based on the time we are exposed to enemy fire and under what
conditions (e.g., armored or not). Therefore, it is a simple and logical next step to
condense the above three functions into a more generalized one that provides us
the amount of damage we are going to incur in a period of time given a damage rate.
With this utility function, we can throw any combination of time and damage rate
we want at the problem. To solve our problem, we need three of these combinations
—one for each leg of the trip. The times would be dependant on the distance and
any other considerations we need to take into account (e.g., running slower while
wearing the Armor). The damage rate, of course, would be based on whether or not
we had picked up the Armor.
To test our theory, we need to try a couple of examples. Since the rate of dam-
age taken on different legs of the journey is a factor, it would be best to have our
first examples expose that as the deciding factor. Therefore, let's assume that the
time to get to the Health Kit and the Armor are the same—five seconds. The long
run from the Health Kit to the Armor (or vice versa) is eight seconds.
In the first test, let's assume that we are going to retrieve the Health Kit first and
then go to the Armor. Using our damage utility function above, we arrive at the fol-
lowing results for each leg of the foray:
Leg
Time
Rate
Damage
Cover to Health Kit
5
2
10
Health Kit to Armor
8
2
16
Armor to Cover
5
1
5
Total
-
-
31
The total amount of damage that would be taken is 31.
Search WWH ::




Custom Search