HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Calculating a unit's DPS

05-10-2008, 03:53 PM#1
darkwulfv
I think I'm doing this right, so please correct me if I'm wrong. Also let me know if I'm calculating the damage w/ dice incorrectly. I have a feeling what I'm doing is wrong, so let me know if this:

Damage / Cooldown = DPS

would be the proper method.


I'll use 4 examples.

Unit A: 1.25 attack cooldown, 18 base damage, 2 dice with 3 sides.
Damage: 20-26.
Calculation: Multiply the min/max attack damage by .25 (it's over 1) and subtract it from each, respectively.
Becomes: 15-19.5

Unit B: .75 attack cooldown, 12 base damage, 1 dice with 5 sides.
Damage: 13-18.
Calculation: Multiply the min/max damage by .25 (how much it's under 1) and add to each, respectively.
Becomes: 16.25-22.5

(I think this one is completely wrong)
Unit C: 2.6 cooldown, 40 base damage, 3 dice with 3 sides.
Damage: 43-52.
Calculation: Divide each by 1.6 (it's at least a full second over 1) and subtract respectively.
Becomes: 16.125-19.5

Unit D 1 cooldown, 34 base damage, 3 dice with 2 sides.
Damage: 37-43.
Calculation: None (it's 1 second)
Becomes: 37-43 DPS


Sorry if my calculations are completely wrong. I was just guessing, really. Unit C's calculation looks completely off, so any help would be great.
05-10-2008, 04:04 PM#2
TheSecretArts
DPS range is
(Lower DPS / Cooldown) - (Higher DPS / Cooldown)
I dont care if its a decimal or a fraction or whatever.
Unit A = (20/1.25) - (26/1.25) = 16 - 20.8 (you multiply by .8 becauses the recipricol is 1/1.25 = 8)
B = (13/.75) - (18/.75) = 17.333333333333333333333333333333 - 24 (multiply by the recipricol... again)
C = (43/2.6 (not 1.6)) - (52/2.6) = 16.538461538461538461538461538462 - 20
D = same

Don't play with the numbers, just keep them as is.
05-10-2008, 04:14 PM#3
darkwulfv
Ooohh, thanks. +rep
05-10-2008, 04:34 PM#4
Toadcop
imo DPS =
attack interval MUST BE NOT 0 !
((min+max dmg) / attack interval)/2 O_o ?

so... in fact (according to this formula ("my"))

4-6 dmg =

((4+6)/1)/2 = 5
imo it's obvious.
05-10-2008, 05:28 PM#5
darkwulfv
Uhh... Toad, that's finding the average. And that's not really DPS anyways. SecretArts has the right formula.
05-10-2008, 05:48 PM#6
Rising_Dusk
Wulf, TC has the right idea though. Damage per second should be a single weighted average value, not a range. His method is how it should be done, and TSA's is sketchy at best.
Code:
[(Min+Max)/Cooldown]/2
Hence...
[(4+6)/1.25]/2 = 4 DPS

Let's take one of your examples and see what we can concoct.
[(20+26)/1.25]/2 = 18.4 DPS

That should make perfect sense, your DPS goes down by a weighted factor of your attack speed. What you could do to test this is just have a damage tracker in your map and see what the thing spits out. In the trigger, you'd actually calculate the damage per second a very similar way.

Code:
(Damage dealt to current time)/(Current time - Start time)
Hey, that looks like an average, doesn't it? :)
05-10-2008, 06:45 PM#7
darkwulfv
Ohh, I see what TC was doing now (I didn't realize he was getting the average of the two). I can do that no problem.
11-13-2009, 01:17 AM#8
mystafox
Hi,
I also want to know how we calculate the dps of a unit - a tower like in TD maps. I'm totaly new with all the modding, world editor etc... I'm just learning...
The answer given in this threat are "too" obvious for me, and i wanted to ask if the following unit fiels play a role in the calculation:

Combat - Attack x - Cooldown Time (Real)
Combat - Attack x - Damage Base (Integer)
Combat - Attack x - Damage Number of Dice (Integer)
Combat - Attack x - Damage Sides per Die (Integer)
Combat - Attack x - Animation Backswing Point (Real)
Combat - Attack x - Animation Damage Point (Real)
Combat - Acquisition Range (Real)
*Combat - Attack x - Projectile Arc (Real)
Combat - Attack x - Projectile Speed (Integer)
Combat - Attack x - Range (Integer)
Combat - Attack x - Range Motion Buffer (Real)
*Art - Projectile Impact - Z (Real)
*Art - Projectile Impact - Z (Swimming) (Real)
*Art - Projectile Launch - X (Real)
*Art - Projectile Launch - Y (Real)

*Art - Projectile Launch - Z (Real)
*Art - Projectile Launch - Z (Swimming) (Real)


CASE 1
Lets say the unit is in sight of the tower and doesnt move, furthemore we dont count the initial hit. How does :Combat - Attack x - Animation Backswing Point and Combat - Attack x - Animation Damage Point affect the DPS?
a) it doesnt influence the cooldown at all thus the DPS is still what has been said in the previous posts (DPS = (Damage Base + 1/2 * Damage Number of Dice * (1+ Damage Sides per Die) / Cooldown Time)
b) cooldown = Combat - Attack x - Cooldown Time + Combat - Attack x - Animation Backswing Point + Combat - Attack x - Animation Damage Point
c) cooldown = max[Combat - Attack x - Cooldown Time , Combat - Attack x - Animation Backswing Point + Combat - Attack x - Animation Damage Point]
c) cooldown = min[Combat - Attack x - Cooldown Time , Combat - Attack x - Animation Backswing Point + Combat - Attack x - Animation Damage Point]

CASE 2
Now to make things more complicate and more realistic for TD maps, suppose we have a wave of creeps spawning at point A going to point B and a tower partially protecting the path by shooting a those creeps. There is no spash or special effects. The interval between 2 creeps is x second and each creep take y second to cross the guarded path. How do we calculate the DPS -_-' ?
I suppose the range fields determines when and how long a creep enter/stay in the guarded path.
We must take into account that the tower switches targets => we must now take into account the first shoot, thus :
the distance between the creep and the tower & Combat - Attack x - Projectile Speed (Integer)
The distance being calculate with all the files with[*]
To count the DPS in this case we must calculate how many times the tower switches target in average and take into account the first hit delay ? If i do that, and i dont take into account the first creep entering the range, the tower will switch from creep to creep every x sec. The tower first shot will take n sec to reach the creep (n is calculate by knowing the distance and projectile speed) then the previous DPS (the dps from case 1) applies during the (x-n) seconds before the tower change target. Thus the new DPS is in this case ((x-n)*DPS)/x

Am i right or is this totally wrong?
11-13-2009, 02:38 AM#9
67chrome
Combat - Attack x - Cooldown Time (Real)
Combat - Attack x - Damage Base (Integer)
Combat - Attack x - Damage Number of Dice (Integer)
Combat - Attack x - Damage Sides per Die (Integer)

The above values have all been gone over in just about every post on this thread.

Combat - Attack x - Range Motion Buffer (Real)
*Art - Projectile Impact - Z (Real)
*Art - Projectile Impact - Z (Swimming) (Real)
*Art - Projectile Launch - X (Real)
*Art - Projectile Launch - Y (Real)
*Art - Projectile Launch - Z (Real)
*Art - Projectile Launch - Z (Swimming) (Real)

Most of the above just have to do with on what point of the model the projectiles are launched from, and would really have nothing to do with the actual dps, unless they are launched from a position much further away from the tower, in which the concerns would be more easily approached by looking at things such as projectile speed and attack range.

Attack Range would most certainly effect the damage a tower is able to contribute to a maze, this would be due to the amount of time it could damage targets. This contribution could vary greatly depending on how the map is laid out, if the tower was placed on an inner corner, outer corner, or middle lane. Also, how far apart the units are from the tower and for how many seconds the tower could attack units would effect the amount of time a tower's range could allow it to damage units, and the target's movement speed would effect this as well.

Acquisition range is essentially the same thing as attack range, and only really matters for mobile units that have a shorter attack range than an acquisition range. However, if a unit's acquisition range is lower than their attack range, the unit's attack range will become their acquisition range. This is only really useful for making creeps ignore you unless you come within melee range, almost duplicating the "yellow" aggravation type of WoW creeps, though units modified in this way will still call for help when attacked.

Projectile speed could play a role in dps, if the projectile speed is low enough for the tower to keep attacking a unit after it has launched enough projectiles to kill it, essentially lowering it's dps with lower projectile speed values. If the projectile speed is to low for any of the tower's missiles to hit a target before it reaches the end of the maze it's dps would essentially be 0. I don't believe missile arc effects projectile speed at all, only the aesthetics of the missile traveling through the air.

I think range motion buffer is how far a unit can move out of the line of fire before receiving half damage from moving out of the way, though I could be wrong here.

Attack types of Missile Splash, Missile Line, Artillery, Artillery Line, Missile Bounce all effect dps as well, due to the added bonus that attacks can hit multiple targets. Missile Bounce would be the easiest to calculate in a TD situation, given the bounce radius was high enough to consistently hit another unit, and the bonus damage caused from bouncing projectiles could be easily factored in.

Artillery and Splash missiles would depend on the splash radius, as well as how far apart the units are spaced and how many targets on average could be hit with each attack, as well as what damage % the units would take based on the splash damage. Missile and artillery line can hit additional units that the projectile passes to it's destination, though units often target the closest target, and from testing with these attack types I'm suspicious they are a little buggy.

Most of these would be hard to find the average value of effects upon damage output to calculate, though abilities such as critical strike, poison damage, and so on would be much easier to immediately add to dps :)