Game Development Reference
In-Depth Information
} else {
return GOAL_ARMOR_HEALTH;
}
}
The above function is now able to decide based on any values we throw at it. No
matter what the travel times are or what the damage rate is, we will find out which
of the three approaches is best.
One More Factor Couldn't Hurt
Upon further examination of the details of this adventure, we can prove that getting
the Armor first is always the correct thing to do. The reason is that the sum of the
lengths of two sides of a triangle is always longer than the length of the third. Given
the parameters of our situation, it is better to be wearing armor while running two
sides rather than running only one.
However, this is a visitor from the realm of cold geometric theory. If we could
guarantee that all our scenarios ONLY had those components in them, that would
be, as they say in certain geometric circles, peachy. However, trying to teach our
bots basic theories and getting them to apply them at the appropriate times is a bit
outside the scope of game development. Our job, instead, is to provide them with
tools they can apply in any situation.
If we add one more component to this example, we ruin the simple triangle
theory. Let's assume the value of the Health Kit declines over time at a rate of 1 point
per second. Therefore, the quicker we get to it, the more benefit we get from it. Now
we are dealing with two different changes over time. The amount of change in our
health from taking fire and the amount of benefit we get from the Health Kit.
Tweaking our example once again, let's assume that a Health Kit starts at 100
points and declines by 1 point per second.
Leg
Time
Rate
Damage
Health Added
Net
Cover to Health Kit
3
2
-6
+97
Health Kit to Armor
8
2
-16
Armor to Cover
7
1
-7
Total
-
-
-29
+97
+68
We would sustain 29 points of damage and gain 97 health. This results in a net
gain of 68 points.
Search WWH ::




Custom Search