# Calculate damage values from bullet velocity and size

I'm trying to make a top-down game using Javascript and Pixi which involves multiple different guns.

Instead of giving each gun an individual damage value, I wanted to calculate the damage by the bullet's dimensions and velocity as it leaves the gun (which is all available on Wikipedia).

However, I'm having issues where despite some damage values looking okay (e.g. UMP-45 has about 40, Mac-11 has about 22, TEC-9 has around 35 and Glock has about the same) some values are too high to offer a challenge to the player (AK-47 has 110, M4A1 has 220, Desert Eagle has 100+).

The current calculation I'm using is: $$\ \frac{velocity \times bullet\ length}{1000} \times \frac{bullet\ radius}{2}\$$
Or in pseudocode: (velocity*bulletLength/1000)*(bulletRadius/2)

Anyone have any ideas for tackling this issue, or is it best to just use straightforward values? The game would be a horde-like sandbox game, so the damage values can't be too low or it would be almost impossible.

• Make the AK ammo costy. Those things can hit trough multiple steel plates and still cause a deadly shot in the real world. Oct 24, 2016 at 8:47
• ah! i never even considered ammo rarity and cost. yes, that sounds like a relatively good solution. plus i thought maybe instead of having normal bullet penetration where the damage just gets reduced, id go for a more realistic model of an immediate damage increase but increased damaged fall off too Oct 24, 2016 at 8:50
• Lemme post it as ab answer Oct 24, 2016 at 8:54
• If you don't want to adjust rarity or pricing (after all who doesn't want to run around with an AK all game) you could also consider scaling your function a bit to keep values more in the range you want them to be. Off the top of my head you could try something like "float finalDamage = bulletDamage/Log(bulletDamage). This would adjust your numbers to something like Ump-45=25, Mac-11=16, Tec-9=23, AK-47=53, M4A1=93. Basically just divide your current result by some value that grows proportionally to damage to keep numbers in line. Jan 29, 2021 at 2:04

AKs and M4s are very strong. If you've ever played with an FPS like COD, then you know that you can't really do anything useful against a person with a higher end weapon using a pistol.

To balance things you could make the ammo for bigger guns more costy

• sounds like a valid idea, combined with realUser404's answer. maybe make enemies that are less vulnerable to other bullets to give rifles a proper use and nerf their overall power and usefulness, since players will want to preserve ammo for different enemies Oct 24, 2016 at 10:56

You could change your calculation to make it more fair. That is just trial and error until you are pleased.

What are the properties common to weapons you want to reduce? If you realize bullet size for example has too much impact, use sqrt(bulletradius) instead, change your values a little bit, see if it fits, then try again if not, until you finally get the formula you want.

• sounds like a good idea, except that some weapons are effected more heavily by different properties (eg the glock gets its firepower from the bulletlength, whereas the m4 gets it from the velocity). ill have a play with it though and find something that works Oct 24, 2016 at 10:57

http://www.shooterscalculator.com/bullet-kinetic-energy.php It's a bullet kinetic energy calculator.

But I suggest to put all results of calculation to game configs. It is more easy way to balance things. Not reason to re-calculate already calculated things.

Then use pre-defined shapes as multiplier. Let's say you have shape1 = 0.8 and shape2 = 1.4, and you have a flying bullet with kinetic energy = 10; then your damage = 10 * shape1 = 8; or same bullet with different shape will be 10 * shape2 = 14. Same value you can also use to calculate reducing speed of the bullet.

• but damage should be factored not only off energy but off bullet size and shape. i know a bit of physics myself, so finding out the energy of bullets shouldn't be too difficult. Oct 24, 2016 at 10:53
• Then use pre-defined shapes as multiplier. Let's say you have shape1 = 0.8 and shape2 = 1.4, and you have flying bullet with kinetic energy = 10; then your damage = 10 * shape1 = 8; or same bullet with different shape will be 10 * shape2 = 14. Same value you can also use to calculate reducing speed of the bullet. Oct 24, 2016 at 12:30

It might sound obvious, but as a game designer, you're in control of the game design.
For the sake of simplicity, games are not accurate representation of reality*.

You can change another stat of the ammo/weapon (cost, reload time, etc.) for balance, but you can also change stat of the ammo itself such as damage dealt, muzzle velocity, etc. to achieve balance within your game even if that contradicts real-life statistics.

In the end, don't forget that it's all up to you and to meat what goals you've set for your game: a more realistic game should obviously try to stick to real-life as possible, but there is a balance to find between realism and gameplay, because no matter how realistic you want your game to be, it won't be real-life.

(*) Keep in mind that althought games are inspired by reality, they do not mimic it 100%. IRL a bullet in your body might incapacitate you... But it might also just make you feel pain and 9 more extra bullet would be needed to stop you.
This would hold for different weapons: a 9mm Parabellum bullet might kill you while a 12.7mm bullet might only wound you.