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

Frame900 p/s (30 p/f)400 p/s (13.33 p/f)400 w/round800 p/s (26.66 p/f)800 w/round
000.0000
13013.31326.727
26026.72653.354
39040.03980.081
412053.352106.7108
515066.765133.3135
618080.078160.0162
721093.391186.7189
8240106.7104213.3216
9270120.0117240.0243
10300133.3130266.7270
11330146.7143293.3297
12360160.0156320.0324
13390173.3169346.7351
14420186.7182373.3378
15450200.0195400.0405
16480213.3208426.7432
17510226.7221453.3459
18540240.0234480.0486
19570253.3247506.7513
20600266.7260533.3540
21630280.0273560.0567
22660293.3286586.7594
23690306.7299613.3621
24720320.0312640.0648
25750333.3325666.7675
26780346.7338693.3702
27810360.0351720.0729
28840373.3364746.7756
29870386.7377773.3783
30900400.0390800.0810

Table 2: Fixed emplacement laser weaponed units

Nameweaponvelocity
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

Nameweaponvelocity
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

Nameweaponvelocity
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

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²

MapVersionGravity
Aqua VerdigrisBT170
Gods of WarOTA132
Caldera's RimOTA128
Etorrep GlacierOTA128
Ring AtollOTA128
Canal CrossingBT125
Long LakesDL125
Starfish IsleDL125
Brilliant Cut LakeBT105
Full MoonOTA100
Moon QuartetCC60
Comet CatcherCC60
Dark SideOTA20

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

Nameweaponvelocityrangerange (98)range (112)
CORE F-PS2 "Intimidator"10005120102048933
ARM ARM-LRC "Big Bertha"800409665315713
ARM ARM-GUARD "Guardian"350125012501097
CORE COR-PUN "Punisher"350120012501097

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.

Trajectories

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’.


Figure 1: Gravity effects upon the Arm Guardian's range. The 20 p/s² trajectory requires over-ranging

Time of Flight

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.


Figure 2: Designated range trajectory comparison

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)

Figure 3: Time of flight comparisons

Over-ranging

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

Namerangemax_rangeOver Range %
CORE TB-LG "Leveler"260700269%
CORE ARM-MRJ "Snapper"290601207%
CORE F-MPS4 "Buzzsaw"38007234190%
ARM ARM-QLRC "Vulcan"30805713186%
CORE F-PS2 "Intimidator"51208933175%
CORE KA-PS6 "Thud230396172%
CORE ARM-GUARD "Toaster"8851290146%
CORE PS20 "Goliath"400560140%
ARM ARM-LRC "Big Bertha"40965713140%
ARM ARM-MRA "Luger"620855138%
CORE MB-PS15 "Mobile Artillery"620855138%
CORE TBA-PS9 "Crock"320430134%
ARM ARM-HA8 "Bulldog"320396124%
ARM ARM-KA "Hammer"320396124%
ARM ARM-CROC "Triton"320396124%
CORE TB-PS4 "Reaper"320396124%
ARM ASD-SD "Crusader"660806122%
CORE SA-AS4 "Enforcer"660806122%
ARM ARM-GUARD "Ambusher"9101097121%
CORE KA-PS6 "Morty"655752115%
ARM ARM-FA5 "Stumpy"240256107%
ARM ARM-KI2 "Warrior"240256107%
CORE PS12 "Raider"240256107%
CORE COR-PUN "Punisher"1200109791%
ARM ARM-GUARD "Guardian"1250109788%
ARM ASD-SB "Millenium"1250109788%
ARM ASD-SB "Millenium"1250109788%
CORE SB-AS6 "Warlord"1250109788%
ARM ASD-SC "Conqueror"1300109784%
CORE ASD-SC "Executioner"1300109784%


Figure 4: Example LRPC force-attack positions for over-ranging


Figure 5: Two examples of Big Bertha overranging range extensions as shown on the OTA map 'Painted Desert'. The green ring represents the nominal range while the red ring shows the over-range value

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.


Figure 6: Leveller over-ranging and reverse over-ranging comparison


Figure 7: Goliath over-ranging and reverse over-ranging comparison

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.


Figure 8: Dark Side over-ranging map for stumpies

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.