# Damage per second

*733*pages on

this wiki

**Damage per second**, or *DPS*, is the total amount of damage that a unit can inflict on a target per second. It is usually a good approximation of the effectiveness of a weapon. Damage per second is calculated by the following formula:

Damage per second = Damage × Rate of fire × Hit rate

Another way of calculating the DPS is to leave out the hit rate because units do not have a predetermined hit chance, thus resulting in the following calculation:

Damage per second = Damage × Rate of fire

Both equations work, but the latter equation is easier to calculate due to the way Supreme Commander calculates hit chance(based on velocity of projectile and target).

- Damage
- The raw amount of damage the projectile deals when it hits a target.
- Rate of fire
- The number of shots fired per second, times the number of projectiles being fired.
- Hit rate
- Percentage chance that a shot fired will hit its intended target.

Weapons that do more damage are not necessarily more effective because they may fire less often. Similarly, weapons with high damage and high rate of fire may be less effective because they rarely hit their target.

Damage and rate of fire are attributes of the weapon, so they are easy to determine. Hit rate, however, depends on many environmental factors, such as the terrain and the maneuverability of the target. See hit rate for more information about estimating the hit rate.

An additional consideration of weapon effectiveness is damage radius, which allows the weapon to damage forces that were not specifically targeted. While more difficult to calculate because it varies largely on whether the opportunity to inflict spread damage exists or not, it is a factor that deserves consideration.

## Unit equivalence table Edit

A unit equivalence table can be built that uses the DPS as its basis. These tables are applicable to just about every RTS.

Some people develop iterative software (IE Javascripts) to develop these tables. These scripts actually compare shot by shot two units fighting it out. IMO this is just brute force method for what can be done with mathematics.

This article is a mathematical walk through of how to build this kind of table using two units from SUPCOM; the Mech Marine and the Flapjack.

## Basic Unit Equivalence Edit

Two basic statements can be made about a fight between Mech Marines and Flapjacks.

- Given enough time the Mech Marine(s) will destroy the Flapjack(s).
- Given enough time the Flapjack(s) will destroy the Mech Marine(s).

Using the following variables we can express the above statements:

- Md = damage per shot of a Mech Marine
- Mc = the cycle time of the Mech Marine weapon
- Mh = hit points of a Mech Marine
- Mx = the number of Mech Marines in the fight
- Fd = damage per shot of a Flapjack
- Fc = the cycle time of the Flapjack weapon
- Fh = hit points of a Flapjack
- Fx = the number of Flapjacks in the fight
- t = time

(Fx * Fh) - (Mx * Md/Mc)*t = 0

(Mx * Mh) - (Fx * Fd/Fc)*t = 0

To determine equivalence lets assume that the Flapjack destroy the Mech Marines at exactly the same time that the Mech Marines destroy the Flapjack. So that means time (t) is the same in both equations.

In this simple equation set we only have three unknowns: t, Fx, and Mx.

In just about every fight one unit will always have an advantage one on one. In this case a Flapjack is superior to a Mech Marine. So assume only 1 Flapjack is present in the fight (Fx = 1).

Now we have two equations and two unknowns: t and Mx

Using basic algebra we can solve for the number of mech marines equals one flapjack.

t = Fh/(Mx * Md/Mc) -> (Mx * Mh) - (Fd/Fc)*Fh/(Mx * Md/Mc) = 0 ->

(Mx * Mh) - (Fd * Fh * Mc)/(Mx * Md * Fc) = 0 -> Mx = SQRT((Fd*Fh*Mc)/(Mh*Fc*Md))

Plug in the numbers and you get 3.126 Mech Marines per Flapjack or so. Well, this is a model. And the error of this model is fairly significant. We have made several large assumptions that have lumped together to produce this error. The first of which is "overkill".

## Overkill Edit

Overkill is the extra damage a unit does when destroying another. In this example, the Flapjack does 470 dmg per shot.

But each Mech Marine can only withstand 75 damage. So in "reality" the Flapjack is really only doing 75 dmg per shot, and 395 damage is overkill.

To introduce overkill into the above equation the damage that the Flapjack does must be reduced. The new damage is ratio of the Mech Marine hitpoints over the rounded up ratio of the Mech Marine hitpoints over the Flapjack damage per shot.

Fo = Flapjack Overkill Damage = Mh/(Roundup(Mh/Fd)) = 75 dmg

Mx = SQRT((Fo*Fh*Mc)/(Mh*Fc*Md)) = 1.24 Mech Marines per Flapjack

This is even more accurate, but its still not completely right. Another assumption made was that both units are within range when they engaged. But usually this is not true.

## Range & Speed Edit

The units in a RTS typically have a weapon range and a speed. Sometimes that speed is zero, but this is still useful information.

In this example the Flapjack well out distances a Mech Marine. So the Flapjack will typically get shot(s) in before the Mech Marines open fire. The above equation works fine for when both units are in range, but outside of the Mech Marine range a new set of equations is needed.

Units can typically do three things with respect to one another: run closer together, run away, or stand still. All three of these actions will determine the length of time that a unit is out of range of another.

For this example, the Mech Marines and the Flapjacks have 5 different speed combinations that should be considered. All of the following are written with respect to the Mech Marines.

- Ms = Mech Marine speed
- Fs = Flapjack speed

- Both units running at one another (Head to Heat). The speed in a head to head fight is the sum of both speeds of the units. In this example it is 120.7 m/s.
- Mech Marines running at a stationary Flapjack (Assault). This is the speed of the Mech Marine. 66.4 m/s
- Mech Marines chasing a Flapjack (Chase). This is the difference in speed between the Mech Marine and the Flapjack. 11.7 m/s
- Mech Marines stationary while the Flapjack runs at them (Defense). This is the speed of the Flapjack. 54.7 m/s
- Mech Marines running away from a Flapjack (Kite). This is the difference in speed between the Flapjack and the Mech Marines. 11.7 m/s

For all five of those situations you can determine the time it takes the Mech Marines to get within range, or conversly the time the Flapjack can fire its weapons before taking damage from the Mech Marines. The Kite distance is the same distance, but its the time needed to get out of the Flapjack's weapon range. In other cases its the time that the longer range unit can pummel the shorter range unit before it (they) get in range.

The distance needed to cover is the difference between the maximum weapon range for the Flapjack and the Mech Marines.

- Mr = Mech Marines Range
- Fr = Flapjack Range

Fr - Mr = Weapons Delta

This is 704 m. Now divide this distance by the speeds in the preceding situations to get time.

- Sh = Speed "Head to Head"
- Sa = Speed "Assault"
- Sc = Speed "Chase"
- Sd = Speed "Defense"
- Sk = Speed "Kite"

- Head to Head time = 5.832 seconds = (Fr - Mr) / Sh
- Assault time = 10.6 seconds = (Fr - Mr) / Sa
- Chase time = 60.17 seconds = (Fr - Mr) / Sc
- Defense time = 12.87 seconds = (Fr - Mr) / Sd
- Kite time = 60.17 seconds = (Fr - Mr) / Sk

This is the time the Flapjack has to pummell the Mech Marines before they open fire or escape. Now to determine how much damage the Flapjack can do, multiply the above numbers by the damage per second of the Flapjack, including overkill.

Range Damage = [(Fr - Mr) / Speed]*Fo

- 66.24 dmg
- 79.5 dmg
- 451.275 dmg
- 96.525 dmg
- 451.275 dmg

Divide the above damage by the hitpoints of a Mech Marine to determine how many Mech Marines are destroyed before the Mech Marines can even open fire.

The number of Mech Marines lost = Ml = Mh / Range Damage

- 0.8832 Mech Marines
- 1.06 Mech Marines
- 6.017 Mech Marines
- 1.2802 Mech Marines
- 6.017 Mech Marines

The above numbers now need to be added to the Overkill equation to determine how many Mech Marines will be destroyed by Flapjacks for equivalence. (Except for the kite, since the Mech Marines' range is less than the Flapjack's range.)

Ml + Mx = Total # of Mech Marines lost per engagement for equivalence

- 2.1232 Mech Marines
- 2.3 Mech Marines
- 7.257 Mech Marines
- 2.448 Mech Marines
- 6.017 Mech Marines

In longer equation form:

- Head to Head ((((Fr-Mr)/(Ms + Fs))*(Fo/Fc))/Mh) + Mx = ((((Fr-Mr)/(Ms + Fs))*(Fo/Fc))/Mh) + SQRT((Mh/(Roundup(Mh/Fd))*Fh*Mc)/(Mh*Fc*Md))
- Assault ((((Fr-Mr)/Ms)*(Fo/Fc))/Mh) + Mx = ((((Fr-Mr)/Ms)*(Fo/Fc))/Mh) + SQRT((Mh/(Roundup(Mh/Fd))*Fh*Mc)/(Mh*Fc*Md))
- Chase ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh) + Mx = ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh) + SQRT((Mh/(Roundup(Mh/Fd))*Fh*Mc)/(Mh*Fc*Md))
- Defense ((((Fr-Mr)/Fs)*(Fo/Fc))/Mh) + Mx = ((((Fr-Mr)/Fs)*(Fo/Fc))/Mh) + SQRT((Mh/(Roundup(Mh/Fd))*Fh*Mc)/(Mh*Fc*Md))
- Kite This is a little bit more complex. It turns out kiting depends on the range and damage differences between the units.

- If Fr > Mr and Ms > Fs -> ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh)
- If Fr < Mr and Ms > Fs -> Then the Mech Marines would always win since they can run away and outrange.
- If Fr > Mr and Ms < Fs -> ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh) + Mx = ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh) + SQRT((Mh/(Roundup(Mh/Fd))*Fh*Mc)/(Mh*Fc*Md))
- If Fr < Mr and Ms < Fs -> ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh) + Mx = ((((Fr-Mr)/(Ms - Fs))*(Fo/Fc))/Mh) + SQRT((Mh/(Roundup(Mh/Fd))*Fh*Mc)/(Mh*Fc*Md))

This accounts for the range, the speed, and the first shot advantage of many units. But its still not completely accurate. Another problem with the above equation is that as the Flapjack fires it is causing Mech Marine attrition and thus reducing the damage the Mech Marines are doing per unit time.

## Unit Attrition Edit

Unit Attrition is when units are lost in a fight. In our example Mech Marines will be dying off everytime the Flapjack fires. So you cannot assume that the Mech Marines will be doing Mx * (Md/Mc) damage every second. In fact, Mx is now a function of time. ( Mx(t) ) But this is only applicable when both units are within range.

There are several ways to model unit attrition. Probably one of the easier methods is to look at what exactly is happening in the fight.

In our example both sides start firing at each other. Lets consider "rounds" or "time periods" to be the time it takes the Flapjack to destroy a Mech Marine. It only takes one shot for a Flapjack to destroy a Mech Marine. So the length of the round is the cycle time of the Flapjack weapon. (Fc) But that doesnt apply in all cases, so the unit of time we have been using is different. Instead of using seconds as our standard measure of time, we are using T, which represents the time in a round.

If Fd >= Mh

T = Fc

Fa = Flapjack Attrition Damage = Mh = 75 dmg (since a Mech Marine is destroyed every round)

Ma = Mech Marine Attrition Damage = T * Md/Mc = 169.23 dmg

If Fd < Mh

T = Mh /(Fc * (Roundup(Mh/Fd))

Fa = Flapjack Attrition Damage = Mh

Ma = Mech Marine Attrition Damage = T * Md/Mc

Now that time is being looked at in a more discrete manner, lets see what happens every round. Below are the round breakdowns for the fight:

- Flapjack Dmg = 75, Mech Marine Dmg = Mx * Ma
- Flapjack Dmg = 75, Mech Marine Dmg = (Mx-1) * Ma
- Flapjack Dmg = 75, Mech Marine Dmg = (Mx-2) * Ma
- Flapjack Dmg = 75, Mech Marine Dmg = (Mx-3) * Ma

What this says is that every round another Mech Marine is being destroyed, thus reducing the amount of damage the Mech Marines can do to the Flapjack.

Looking at the above rounds you will notice that we are creating an arithmatic summation. Every round we are reducing the amount of the Mech Marines by an incrementing number. Round 2 we reduce by 1. Round 2 we reduce by 2. Etc.

This summation series can be converted into a polynomial. I'm going to skip some steps here because it would take some real time to work through them and explain everything. But here are the results:

Polynomial Form:

Ax^2 + Bx + c = 0

Where:

- a = -0.5 * Ma
- b = -0.5 * Ma
- c = Fh

Solving for the roots of this equation provides us with the number of Mech Marines needed to match a Flapjack when both are within range.

Mxa = The number of mech marines needed due to attrition =

-b-SQRT((b^2)-(4*a*c)))/(2*a) = ~1.34 Mech Marines per Flapjack

This number (Mxa) can then be added to the Range & Speed numbers.

- 2.2132 Mech Marines
- 2.39 Mech Marines
- 7.347 Mech Marines
- 2.538 Mech Marines
- 6.017 Mech Marines (no change)

This is again much more accurate of a calculation. And it is a fairly good model of what is really going on in the game.

It does not take into consideration damage reduction attributes (shield recharge, anti-torpedo, hit rate). Nor does it include splash damage affects. But it can be easily modified to accomadate those attributes.

But it can be improved once again. This calculation does not match up well with the Speed vs Range Calculation and it does not take into account the "initial shot" of the Flapjack.

## Initial Shot Edit

When a larger unit is within range of a smaller unit, sometimes the first shot will destroy one of the smaller units. To model this damage the Speed and Range calculations need a slight tweaking to match up well with the "Attrition" calculation.

The issue in this example is that a Mech Marine is removed from the field when the group of Mech Marines first comes within range of the Flapjack (more or less). Then there is a pause between when the Mech Marines get within range of the Flapjack and when the Flapjack fires next. Once the Mech Marines are in range they can open fire and take down some of the life of the Flapjack before the Flapjack fires again and removes another Mech Marine.

We know the time it takes the Mech Marines to get into range of the Flapjack, but how long do they have to fire before the Flapjack fires back?

Call this time "Cutoff Time" (Tk)since it removes a few units of life before both units are in range to open fire. For simplicity, lets just consider the head to head fight at first.

Tk = ((Fr - Mr) / Sh)-Fc

This is the time the Mech Marines have to hit the Flapjack. So this damage must be removed from the polynomial "Attrition" calculation above.

d2*(X^2) + d2*(X) + Fh = 0 Where X is the initial number of mech marines, in the next round.

d2*(X^2) + d2*(X) + Fh - Tk*(Md/Mc)*(X+1) = 0

d2*(X^2) + (d2-Tk*(Md/Mc))*(X) + (Fh-Tk*(Md/Mc)) = 0

Solve that equation for X and you have the inital number of Mech Marines needed in the next round. Since the Flapjack outrange the Mech Marines and can one shot destroy them, we need to calculate the number of Mech Marines destroyed before the next round.

Mb = Mech Marines destroyed early = Roundup(((Fr - Mr) / Sh)/Fc,0) + 1

So the initial number of Mech Marines needed to fight a Flapjack is the solution to the polynomial + Mb. This number turns out to be about 2.72 Mech Marines/Flapjacks. This number ignores splash damage, hit rate, and a couple of other things. Those attributes can be added in easily.

There is also an associated error with this calculation. But its not a significant error and shouldnt invalidate the model.