Weapon Physics | [Go Back] |
There are several weapon types, which I've characterised into the following categories:
Constant velocity [TOP]
These simple weapons include Laser, Gauss, E.M.G., Lightning and Disintegrator weapons. The 'round' travels at a constant velocity from when it fires to its target without any acceleration.
The velocity units are pixels per second (p/s). The TA engine likely evaluates the following basic relationship on a per frame basis at 30 frames per second (30 f/s). Note that the velocities need to be divided by 30 f/s to convert from p/s.
x_pos += x_vel | (1) | |
Equation 1 works by taking an initial position and adding the velocity to it. In the next time step (frame) the new position has the velocity added to it and so on. Table 1 compares a few values and also shows how rounding to an integer pixel value can give slightly different results.
Table 1: Frame based engine calculations for a range of weapon velocities
Frame | 900 p/s (30 p/f) | 400 p/s (13.33 p/f) | 400 w/round | 800 p/s (26.66 p/f) | 800 w/round |
0 | 0 | 0.0 | 0 | 0 | 0 |
1 | 30 | 13.3 | 13 | 26.7 | 27 |
2 | 60 | 26.7 | 26 | 53.3 | 54 |
3 | 90 | 40.0 | 39 | 80.0 | 81 |
4 | 120 | 53.3 | 52 | 106.7 | 108 |
5 | 150 | 66.7 | 65 | 133.3 | 135 |
6 | 180 | 80.0 | 78 | 160.0 | 162 |
7 | 210 | 93.3 | 91 | 186.7 | 189 |
8 | 240 | 106.7 | 104 | 213.3 | 216 |
9 | 270 | 120.0 | 117 | 240.0 | 243 |
10 | 300 | 133.3 | 130 | 266.7 | 270 |
11 | 330 | 146.7 | 143 | 293.3 | 297 |
12 | 360 | 160.0 | 156 | 320.0 | 324 |
13 | 390 | 173.3 | 169 | 346.7 | 351 |
14 | 420 | 186.7 | 182 | 373.3 | 378 |
15 | 450 | 200.0 | 195 | 400.0 | 405 |
16 | 480 | 213.3 | 208 | 426.7 | 432 |
17 | 510 | 226.7 | 221 | 453.3 | 459 |
18 | 540 | 240.0 | 234 | 480.0 | 486 |
19 | 570 | 253.3 | 247 | 506.7 | 513 |
20 | 600 | 266.7 | 260 | 533.3 | 540 |
21 | 630 | 280.0 | 273 | 560.0 | 567 |
22 | 660 | 293.3 | 286 | 586.7 | 594 |
23 | 690 | 306.7 | 299 | 613.3 | 621 |
24 | 720 | 320.0 | 312 | 640.0 | 648 |
25 | 750 | 333.3 | 325 | 666.7 | 675 |
26 | 780 | 346.7 | 338 | 693.3 | 702 |
27 | 810 | 360.0 | 351 | 720.0 | 729 |
28 | 840 | 373.3 | 364 | 746.7 | 756 |
29 | 870 | 386.7 | 377 | 773.3 | 783 |
30 | 900 | 400.0 | 390 | 800.0 | 810 |
Table 2: Fixed emplacement laser weaponed units
Name | weaponvelocity |
ARM ARM-ANN1 "Annihilator" | 1000 |
CORE COR-ANN1 "Doomsday Machine" | 1000 |
ARM ARM-LDT "L.L.T." | 900 |
ARM ARM-FHL "Stingray" | 800 |
ARM ARM-HLT "Sentinel" | 800 |
CORE F-TL8 "Viper" | 800 |
CORE F-L44 "Light Laser Tower" | 800 |
CORE COR-ANN1 "Doomsday Machine" | 800 |
CORE SB-AS6 "Warlord" | 700 |
CORE FF-ML4 "Thunderbolt" | 700 |
CORE F-ML21 "Gaat Gun" | 700 |
CORE COR-ANN1 "Doomsday Machine" | 700 |
Table 3: Mobile laser weaponed units
Name | weaponvelocity |
CORE ARM-KL "Krogoth" | 1000 |
ARM ARM-HA8 "Penetrator" | 1000 |
ARM BK-CD4 "Shooter" | 1000 |
ARM AFD-HAB "Phoenix" | 900 |
CORE VA-B3 "Hurricane" | 900 |
ARM ARM-KS "Flea" | 900 |
CORE KB-LM2 "Gimp" | 700 |
CORE KG-EHL "Sumo" | 700 |
CORE KA-L8 "The Can" | 700 |
ARM ARM-WKML "Pelican" | 500 |
ARM ARM-HLL "Skimmer" | 450 |
CORE KB-LXS "Freaker" | 450 |
CORE COR-MRJ "Scrubber" | 400 |
ARM ARM-KS "Zipper" | 400 |
ARM ARM-WM "Commander" | 400 |
CORE CX-D3 "Commander" | 400 |
ARM ARM-DWM "Decoy Commander" | 400 |
CORE COR-DWM "Decoy Commander" | 400 |
ARM ARM-FAV1 "Jeffy" | 400 |
CORE KA-L4 "A.K." | 400 |
CORE MA-L8 "Weasel" | 400 |
CORE ASD-SS "Searcher" | 400 |
ARM ASD-SS "Skeeter" | 400 |
Table 4: Miscellaneous constant velocity weaponed units
Name | weaponvelocity |
ARM ATAS "Spider" | 600 |
ARM ARM-KG "Fido" | 450 |
CORE ARM-KL "Krogoth" | 450 |
ARM AFD-J17 "Brawler" | 450 |
ARM ARM-HG "Anaconda" | 350 |
ARM ARM-SS "Maverick" | 350 |
CORE COR-PLAS "Immolator" | 310 |
ARM ARM-KI2 "Warrior" | 300 |
ARM FAT3 "Flash" | 300 |
ARM ARM-KI "Peewee" | 300 |
ARM ARM-LAA2 "Panther" | 400 |
ARM ARM-KL "Zeus" | 400 |
ARM ARM-WM "Commander" | 200 |
CORE CX-D3 "Commander" | 200 |
As tables 2-4 show, there is not a lot of variation in velocity values among the units.
Constant acceleration [TOP]A little more complicated but essentially identical physics to unit motion (without turn). More to come...
Constant acceleration and turn [TOP]An extra step above constant acceleration. The turn rate essentially brings the physics into 2D. I really need to work on this a bit more...
Ballistics [TOP]TA treats ballistic weapons in a remarkably realistic way. Key values; map gravity, g, weapon velocity, v, and barrel angle, θ, determine a shells trajectory and ultimate range.
In reality it works a little backwards. A unit or particular position is targeted so the distance, d, is set. In the simple 1-dimensional case, the appropriate barrel angle is then calculated from equation 1.
θ = ½arcsin(gd/v²) | (1) | |
It is also worth noting that in TA an additional range constant (from the .tdf wepons file) is applied to artificially limit weapon range. This is likely an effort to provide a ‘reasonable’ in-game time-of-flight experience. This artificial limit can be usefully overridden with some manual effort in many cases, an action termed ‘over-ranging’ which is analysed in more detail in the over-ranging section.
Gravity, as specified within the .ota map file can range from 0-255 p/s². Actual Cavedog values don’t have a lot of variation with nearly all of Cavedog’s maps specifying a gravity of 112 p/s². Table 1 lists the 13 Cavedog maps where the gravity is not 112 p/s².
Table 1: Cavedog maps where gravity is not the usual 112 p/s²
Map | Version | Gravity |
Aqua Verdigris | BT | 170 |
Gods of War | OTA | 132 |
Caldera's Rim | OTA | 128 |
Etorrep Glacier | OTA | 128 |
Ring Atoll | OTA | 128 |
Canal Crossing | BT | 125 |
Long Lakes | DL | 125 |
Starfish Isle | DL | 125 |
Brilliant Cut Lake | BT | 105 |
Full Moon | OTA | 100 |
Moon Quartet | CC | 60 |
Comet Catcher | CC | 60 |
Dark Side | OTA | 20 |
Interestingly, it looks like ‘normal’ gravity is actually an earth-like 98 p/s². (Standard earth gravity is actually 9.81m/s².) This is based upon the results presented in table 2 which compares Cavedog’s prescribed range to that as calculated by solving (1) for distance d, at maximum range, or θ=45º [sin(2θ)=1].
d = v²sin(2θ)/g = v²/g | (2) | |
Table 2: Comparison of gravity on range
Name | weaponvelocity | range | range (98) | range (112) |
CORE F-PS2 "Intimidator" | 1000 | 5120 | 10204 | 8933 |
ARM ARM-LRC "Big Bertha" | 800 | 4096 | 6531 | 5713 |
ARM ARM-GUARD "Guardian" | 350 | 1250 | 1250 | 1097 |
CORE COR-PUN "Punisher" | 350 | 1200 | 1250 | 1097 |
Table 2 shows us a couple of interesting things. First, we see that the Guardian’s range value matches the maximum range at 45º where the gravity is set to 98 p/s². Note also that because the Punisher has the same weapon velocity that it should also share the same range value, but it is actually limited to a slightly lower value. However, on the vast majority of maps where gravity is 112 p/s² the actual range for either Guardian or Punisher is 1097 pixels which is less than either of their range limits. It is worth adding that ballistic weapons automatically reduce their range in strong gravity so as a result the Guardian and Punisher can be shown to have the same range on any map with a gravity greater than 102 p/s².
Accepting 98 p/s² as normal earth gravity can also be useful to give us a sense of scale in TA, as in that we can equate 98 p/s² = 9.8 m/s² we get 10 pixel = 1 m. So, given that one footprint is 16x16p, this makes most vehicles either 3.2x3.2m for 2x2 footprints, or 4.8x4.8m for 3x3 footprints. These machines are pretty substantial! And how about THE War Machine, Commanders? How tall are these guys? From the 3D model we have a height of about 16 cob’s (yeah, a pretty random unit where 1 cob = 2.5 pixel’s). So 16 cob x 2.5 p/cob = 30 p. And 30 p / 10 p/m = 3 m. So Commanders are around 3 meters tall. That would be a quite impressive sight!
Table 2 also shows significant differences in range based on gravity alone.
The path a projectile traces between launch and impact is its trajectory. These trajectories can be calculated from equations 3-7 using the angle calculated in (1).
x_vel = vcosθ | (3) | |
y_vel(initial) = vsinθ | (4) | |
An initial vertical velocity, y_vel, is determined, and this is effectively modified in subsequent time steps (frames,f) by the gravity value. Note that the velocity and gravity values need to be converted from time units of seconds to frames. For velocity this is to divide by 30 f/s, and for gravity this is to divide by (30 f/s)², or 900f²/s².
x_pos += x_vel | (5) | |
y_pos += y_vel | (6) | |
y_vel += gravity | (7) | |
Figure 1 shows how gravity can effect the non-limited trajectory of an Arm Guardian Medium Range Plasma Cannon (MRPC). The value of 20 p/s² is from the small moon OTA map ‘Dark Side’, while the 170 p/s² value of from BT Acid world map ‘Aqua Verdigris’.
Table 2 shows a large difference between the LRPC designated range and the calculated ranges. As mentioned this is likely due to maintaining reasonable time-of-flight experiences for players. This is achieved by setting higher velocities and limiting designated ranges. Shallower firing angles result as can be seen in the comparisons of trajectories in figure 2.
If we re-plot figure 2 in terms of Height vs. Time (figure 3) as calculated from equation 8, we see that a similar ToF is maintained for both MRPC and LRPC’s.
t = d/(vcosθ) | (8) | |
Gnug tip #41. "That little extra ... mile!"
Scratch the "few extra inches due to the BB's randomness" tip. How would you like adding a few extra screen lengths to it's range?
It's pretty easy, actually; just hard to be precise with it. Try targeting as close as possible to your own Bertha using "A" Forced Attack. The Bertha will fire it's shot in the same direction, but somewhere between 30-40% further than it's usual max range. Target a little farther away and it will fire a wee bit closer, but still outside max range. It's not as if this is a game-winning trick for big maps, but I can definitely picture it coming in handy in those games where you've got your DT rows and several Bertha's already in place on Painted Desert.
This trick does however practically double the worth of a Vulcan/Buzzsaw though, as their short range render them relatively worthless otherwise, and inaccuracy not an issue anyway.
As mentioned TA applies a range limit (from the .tdf weapons file) likely in an effort to provide a ‘reasonable’ in-game time-of-flight experience. This artificial limit can be usefully overridden with some manual effort in most applicable cases, an action termed ‘over-ranging’.
Table 3 lists ballistic weaponed units and compares the prescribed range limit to the calculated maximum range based upon the weapon's velocity. It is ordered by the effective % increase in range possible.
Table 3: Differences between prescribed range and calculated maximum range at 45º with 112 p/s² gravity
Name | range | max_range | Over Range % |
CORE TB-LG "Leveler" | 260 | 700 | 269% |
CORE ARM-MRJ "Snapper" | 290 | 601 | 207% |
CORE F-MPS4 "Buzzsaw" | 3800 | 7234 | 190% |
ARM ARM-QLRC "Vulcan" | 3080 | 5713 | 186% |
CORE F-PS2 "Intimidator" | 5120 | 8933 | 175% |
CORE KA-PS6 "Thud | 230 | 396 | 172% |
CORE ARM-GUARD "Toaster" | 885 | 1290 | 146% |
CORE PS20 "Goliath" | 400 | 560 | 140% |
ARM ARM-LRC "Big Bertha" | 4096 | 5713 | 140% |
ARM ARM-MRA "Luger" | 620 | 855 | 138% |
CORE MB-PS15 "Mobile Artillery" | 620 | 855 | 138% |
CORE TBA-PS9 "Crock" | 320 | 430 | 134% |
ARM ARM-HA8 "Bulldog" | 320 | 396 | 124% |
ARM ARM-KA "Hammer" | 320 | 396 | 124% |
ARM ARM-CROC "Triton" | 320 | 396 | 124% |
CORE TB-PS4 "Reaper" | 320 | 396 | 124% |
ARM ASD-SD "Crusader" | 660 | 806 | 122% |
CORE SA-AS4 "Enforcer" | 660 | 806 | 122% |
ARM ARM-GUARD "Ambusher" | 910 | 1097 | 121% |
CORE KA-PS6 "Morty" | 655 | 752 | 115% |
ARM ARM-FA5 "Stumpy" | 240 | 256 | 107% |
ARM ARM-KI2 "Warrior" | 240 | 256 | 107% |
CORE PS12 "Raider" | 240 | 256 | 107% |
CORE COR-PUN "Punisher" | 1200 | 1097 | 91% |
ARM ARM-GUARD "Guardian" | 1250 | 1097 | 88% |
ARM ASD-SB "Millenium" | 1250 | 1097 | 88% |
ARM ASD-SB "Millenium" | 1250 | 1097 | 88% |
CORE SB-AS6 "Warlord" | 1250 | 1097 | 88% |
ARM ASD-SC "Conqueror" | 1300 | 1097 | 84% |
CORE ASD-SC "Executioner" | 1300 | 1097 | 84% |
I've found that the forced attack position near the unit actually relates from that point to the units turret. Essentially there is a ring about a turret; inside the ring, and the unit will not fire, at the outside edge over-ranging transitions from to a usual forced attack for that range. To be most effective, we need to target at the inside ring edge. Some units, tanks especially, have turrets to the rear of the unit. Applying a force attack at the rear of the unit closest to the turret will give the best over-ranging effect. Levellers can shoot across the whole of the Dark Side OTA map by reverse over-ranging.
Figures 6-7 demonstrate the significance of turret positioning to over-range effectiveness. The vertical blue line signifies the nominal unit range.
And finally, figure 8 shows an extreme example of over-ranging akin to artillery cloud-mapping used in Battlefield 1942. An over-range map for (back over-ranged) stumpies on the OTA map Dark Side. Stumpy units positioned anywhere upon a ring quite easily hit the metal extractors the ring circumscribes. Locating stumpies at the intersection of rings allows it to reach more mex's from the same position although this takes some practice :) Full size image linked.
Some other random things: There is a bug with destroyers and cruisers in that their plasma weapon cannot be force fired to a position outside their depth-charge range. They will move to be within that range before firing. If you actually over-range with these ships you can lay suppressing fire at the usual range limits. Although the Gimp has a plasma weapon it cannot be force fired so I've left it off the list. The same goes for the flakker units. Wind also affects ballistic motion in TA, this is likely implemented as x_vel -= wind. I've not bothered to analyse these effects as they appear small and I believe it changes direction which could greatly complicate the analysis for little reward.