Well there is a calculation of the DPS ingame.
Here is a function for all weapons and how to calculate the DPS:
(With debug function)
- Code: Select all
function GetWeaponDPS(bp,weapon)
local DPS = {}
DPS.Damage = 0
DPS.RateOfFire = 0
DPS.DPS = 0
-- enable debug text
local bugtext = false
local WeaponEco = __blueprints[weapon.ProjectileId].Economy or nil
if WeaponEco and bp.Economy.BuildRate > 1 and WeaponEco.BuildTime > 1 and (WeaponEco.BuildCostEnergy > 1 or WeaponEco.BuildCostMass > 1) then
if bugtext == true then
LOG(' BuildTime')
end
local MuzzleSalvoSize = weapon.MuzzleSalvoSize or 1
DPS.RateOfFire = 1 / (__blueprints[weapon.ProjectileId].Economy.BuildTime / bp.Economy.BuildRate)
if weapon.NukeInnerRingDamage > 0 then
DPS.Damage = weapon.NukeInnerRingDamage + weapon.NukeOuterRingDamage
else
DPS.Damage = weapon.Damage * MuzzleSalvoSize
end
elseif weapon.DoTPulses then
if bugtext == true then
LOG(' DoTPulses')
end
DPS.RateOfFire = 1 / (math.round(10/weapon.RateOfFire) / 10)
DPS.Damage = weapon.Damage * weapon.MuzzleSalvoSize * weapon.DoTPulses
elseif weapon.ContinuousBeam then
-- ual0401
if bugtext == true then
LOG(' Continuous Beam')
end
--LOG(' weapon.BeamCollisionDelay='..weapon.BeamCollisionDelay)
local temp = weapon.BeamCollisionDelay == 0 and 1 or weapon.BeamCollisionDelay
--LOG(' temp='..temp)
DPS.RateOfFire = 1 / (weapon.BeamCollisionDelay == 0 and 1 or weapon.BeamCollisionDelay)
DPS.Damage = weapon.Damage * 10
elseif (weapon.BeamLifetime and weapon.BeamLifetime > 0) then
-- xsb2301 xea0002
if bugtext == true then
LOG(' Pulse Beam')
end
local BeamCollisionDelay = weapon.BeamCollisionDelay or 0
local BeamLifetime = weapon.BeamLifetime or 1
if BeamLifetime > 5 then
BeamLifetime = 5
end
DPS.RateOfFire = 1 / (math.round(10/weapon.RateOfFire) / 10)
DPS.Damage = weapon.Damage * BeamLifetime * 10
elseif (weapon.RackSalvoReloadTime and weapon.RackSalvoReloadTime > 0) and not weapon.RackSalvoFiresAfterCharge then
if bugtext == true then
LOG(' Salvos')
end
-- Salvos don't use weapon.RateOfFire
DPS.RateOfFire = 1 / ((weapon.MuzzleSalvoSize * weapon.MuzzleSalvoDelay + weapon.RackSalvoReloadTime))
DPS.Damage = weapon.Damage * weapon.MuzzleSalvoSize
else
-- ueb2101
if bugtext == true then
LOG(' One Shot')
end
local ProjectilesPerOnFire = weapon.ProjectilesPerOnFire or 1
local AttackGroundTries = weapon.AttackGroundTries or 1
local MuzzleSalvoSize = weapon.MuzzleSalvoSize or 1
-- don't use ProjectilesPerOnFire if MuzzleSalvoSize is present.
if MuzzleSalvoSize > 1 and ProjectilesPerOnFire > 1 then
if MuzzleSalvoSize ~= ProjectilesPerOnFire then
WARN('unit ['..bp.BlueprintId..'] has wrong ProjectilesPerOnFire in Weapon ['..weapon.DisplayName..']')
end
ProjectilesPerOnFire = 1
end
DPS.RateOfFire = 1 / (math.round(10/weapon.RateOfFire) / 10)
DPS.Damage = weapon.Damage * MuzzleSalvoSize * ProjectilesPerOnFire
end
if DPS.RateOfFire == 0 then DPS.RateOfFire = 1 end
--LOG(' Damage: '..DPS.Damage..' - RateOfFire: '..DPS.RateOfFire..' - new DPS: '..(DPS.Damage*DPS.RateOfFire))
DPS.DPS = DPS.Damage*DPS.RateOfFire
return DPS
end
This function is included inside my (private) tooltip mod:
http://faforever.uveso.de/forum/SmartUnitTooltipV2.zip(Needs option "Show Armament Build in Factory Menu" enabled)
This mod also displays the original FAF game calculation and Hussars calculation from the unit manager.
You will see that all 3 DPS values from the different source almost have the same dps.
But you can't calculate all weapons correctly because you don't have all needed date inside the unit blueprints.
There are some weapons with racks or multiple shoots that can't be calculated without a helper-variable added to the unitblueprint.
That's why all attempts stoped at this point.