• Welcome to AtomicTorch Studio Forums.
 

How is damage and DPS calculated?

Started by djs4000, October 13, 2014, 10:33:54 AM

djs4000

So I've been going through the game data, and I realize the <dmg> tag and the actual ingame reported damage don't always correspond. Best I can gather is sometimes the <dmg> is multiplied by the <duration>. And as far as DPS is concerned, I don't see which tag handles the "rate of fire".

Lurler

Not exactly. For most weapons it's straight value or value per second (lasers), but some other weapons like "shotgun" have multiple projectiles that are shot at the same time, so in that case all of their damage is combined and shown in the game. Basically dmg value in the game is always a sum of ALL damages discharged per one shooting cycle.

Hammish

Rate of fire is handled by the tag called <fire_sequence_delay_sec>.  This is the time that it takes the weapon to cool down between shots.  Then, as Lurler said, add together the damage for all projectiles if the projectile type is a bullet or missile and that's your total damage.  Be careful, though, since there are two different ways to assign multiple projectiles; you can have one projectile tag with <quantity> greater than 1 and fire multiple identical shots at the same time, or with weapons like the MLRS they all have independant projectile tags so that <shot_delay> can be used to space out the shots.  (Shot delay is the amount of time after the trigger is pulled that the projectile takes to launch)

So you could make a gun that fires for 50 damage ever 1.0s.  50 damage, 50 DPS.
You could make a gun that fires for 50 ever 0.5s.  50 damage, 100 DPS.
You could make a gun that fires TWO rounds for 50 every 1.0s.  100 damage (50+50), 100 DPS.
You could make a beam weapon that does 100 damage over 1.0s.  100 damage, 100 DPS.
You could make a beam set to 200 but only give it 0.5s of duration, 1.0s cooldown.  The game should report 200 damage, but it'll only be 100 DPS (because the beam is only active half the time)

The last one is important because so far as I understand it's the flat damage that matters when factoring in armor.  If you had 20 armor on a ship the gun that fires 2x ever 1.0s for 50 each would only cause (50-20) 30+30 every 1s, or 60 DPS.  The beam that does 200 over 0.5s ever 1.0s, though, will only drop from 200 to 180 over a full second, or 90 over the 0.5s it fires, for a total DPS of 90.

The calculation does seem to go off for scattering projectiles though, I'll say.  I've made things like a rocket that fires a subrocket after a short time.  Gave the launch rocket 50 damage, the subrocket 100 damage (to represent at least doing some damage before arming at minimum range), fires ever 1.0s.  At worst the game should report 150 DPS ((100+50)/1) but it always seems to weight scattering projectiles with higher DPS.   No idea why. :)