Game Development Reference
In-Depth Information
To construct these formulas, we use some of the suggestions in Chapter 10. To
exhibit the characteristic of decreasing damage, we need to have a formula that was
at its maximum result at a distance of 0 (with one exception, as we shall see). From
there, we want it to fall away at an increasing rate. The natural starting point was a
parabolic curve that we subtract from our maximum point.
All four weapons use the same base formula. This ensures that the general,
distance dependency characteristic is present. Each weapon has specific values for
each variable, however, which is what separates one weapon from another. The
formulas are
Notice that the structure of the two formulas is the same. The magic of each
happens with the numbers that we plug in. There are a few things to note, however.
First, it is possible that the formula can generate a number less than 0. As we shall
see, this is by design. Because we can't have negative damage or negative accuracy,
we need to clamp the result to a minimum of 0.
As cryptic as the formulas look in this form, they begin to make more sense as
we plug in the weapon-specific values. The figures for each weapon are:
Value
Pistol
Shotgun
Mach. Gun
Rocket L.
Range
137
57
300
300
Base Damage (/sec)
10
50
30
100
Dmg. Decay Exp.
2.2
2.1
2.0
2.0
Dmg. Decay Divisor
5,000
100
5,000
1,500
Dmg. Decay Shift
0
0
0
50
Base Accuracy
0.70
0.95
0.80
0.50
Acc. Decay Exp.
1.5
2.2
1.8
2.0
Acc. Decay Divisor
3,000
15,000
50,000
30,000
Acc. Decay Shift
0
0
0
50
Search WWH ::




Custom Search