Monday, July 30, 2018

Attack Vs DPS

 This post is unrelated to TNR project, but if you're an aspiring developer, I recommend you to read.

People usually makes a formula to determinate what is the dps of a weapon when attacking, generally getting the weapon speed, pass it to seconds and then multiply by the base damage of the weapon, but what If one wants to make the weapon deal the exact dps damage per hit?

Having the damage being discounted before checking the defense of the enemy, or if it's a critical hit, may cause devaluation of the equipment, causing the weapon itself to feel really not worth using compared to a one second attacking weapon, so what you have to do is leave that calculation of dps to after you have the final value of the damage to inflict.

Let's say that I have a weapon that inflicts 40 damage, the enemy has 10 of defense, but it's dps is of 0,8 seconds, that's when I build the formula:
Damage * Dps - Defense
If I do the calculation on that formula, the damage inflicted will be 22.
40 * 0.8 - 10 =  22
Ps:. In this case I didn't needed to round the result, since 40 * 0.8 results in 32, but if your game health status isn't a decimal variable, you'll have to convert it to integer when placing the value, or rounding it.

But If I do the calculation:
 (Damage - Defense) * Dps
The damage actually will actually be:
 (40 - 10) * 0.8 = 24

Do you notice the difference? It's small but very significant, that little difference of 2 numbers may end up defining if the equipment is worth using or not, aswell as cause frustration on the players, a player may find a dagger that inflicts damage every 0,33 seconds of use, is actually better at damage dealing than a hammer that takes 1,5 seconds to use, the players may avoid using it due to the low damage dealt per second, compared to a weapon that has the damage near 1 second of use, so when you attempt to make a game where the inflicted damage of the weapon is actually the dps, do not discount the damage before the defense calculation, do the damage minus defense calculation first, and then apply the DPS mod.

That's all for my developer blog post.

No comments:

Post a Comment