“What damage formula should I use?” is a common question among game design novices, so I’m hoping to provide an answer - or at least the start of an answer - while addressing how to think about this type of question.
Why Game Design is Hard
Most graphics programmers have a book shelf that looks something like this:
You can learn graphics programming from books. Not just from books - you need to experiment and do hands-on work. But if you read GPU Gems (and Jose Canseco’s Juiced…) you’re off to a good start, because graphics knowledge is highly transferable. Whether you’re working on a racing game or a 3D platformer or a first person shooter they all need to draw and shade triangles, they all use a z-buffer and transform coordinates from object to world to view space.
I’ve never read a game design book cover-to-cover and I don’t think that’s particularly rare among people who didn’t go to game design school. Of the books I’m familiar with some, like The Art of Game Design: A Book of Lenses, seem pretty good. Others, like Rules of Play: Game Design Fundamentals, seem pointless or actively harmful. But all of these books share the same problem: at best they can “help you learn how to learn” rather than teach you specific things, because games are just too broad. Video games encompass 12-hour AAA cinematic action-adventure games, 100-hour open-world RPGs, 3 hour visual novels and infinitely repayable falling block puzzle games.
Doing design work in a new genre often involves narrowly applicable specifics. For example here’s Masahrio Sakurai’s Eight Hit Stop Techniques video.
I particularly like this bit about the direction of hit-stop-shake:
When I encountered this video I’d just finished working through some character and camera shake issues. My first thought was to shake a character based on the direction of the incoming hit - so if they’re hit with a horizontal swipe shake them left to right and if they’re hit with a vertical one shake them up and down. But in practice that makes the character clip into and detach from the ground, which our gamer brains interpret as a technical failing. Similarly it’s sometimes best to constrain camera shake to two dimensions, so that it moves up/down and left/right but not forward/back.
You can spend years in games and never broach this topic at all.
If you’ve only worked on FPS games your first impulse in a platformer might be to use a capsule collider, only to find that produces unseemly results at platform edges. If you’ve never worked on an action or fighting game you may not have a solid idea of how to set up an input buffer or even that you need one.
It’s easy to step into a new domain thinking “how hard could this be?” only to find out it’s actually pretty hard, and that the available information is spotty.
Which brings me to the humble damage formula. At first glance it’s simple enough: you bonk an enemy and do some damage. Create an “attack” and “defense” stat, yada yada yada, job done. But we yada yada’d over the complicated bit.
The Setup
My goal here isn’t to find the “best” damage formula. Best is highly subjective and dependent on other aspects of the game. Instead the goal here is to examine different damage formulas, discuss their pros and cons, which types of games they’re suited for, and to develop a framework for evaluating them.
The formulas could be for an RPG (Dragon Quest), action-adventure game (God of War), or a tactics game (Fire Emblem). Any game where damage is based on a formula involving something like an “attack
” and “defense
” stat.
Formula 1: Simple Subtraction
Damage = Attack - Defense
Many older games, including Fire Emblem, use this formula or a basic variation.
This is a great formula for Fire Emblem. It’s easy for players to understand and calculate. Even though newer Fire Emblem games display a comprehensive attack preview, ease of calculation is still important as it allows players to plan many moves ahead.
That said, this is a formula with many potential pitfalls.
Imagine we’re a designer working on Elden Ring, editing a big Excel spreadsheet, and we get to the cell for the defense
of a later boss. What number do we type in here? Note that if enemy defense
is higher than player attack
the enemy takes no damage.
Fire Emblem games typically don’t have full equipment loadouts; characters have weapons and maybe one accessory, so the range of values is limited. The games are fairly linear and have only minor character customization. At any point in a game the designers have a good idea of what the player’s squad looks like, and can pick appropriate values for enemy stats.
But in Elden Ring the player could be using a greatsword or a dagger. Characters have many gear slots with huge variety for each slot. Not only is Elden Ring not linear, but we want players to encounter areas and enemies in the “wrong” order. So what number do we type in for boss defense
? 10? 50? 500?
In Fire Emblem the player controls an entire squad, so if a fast-but-weak character can’t damage an enemy the player can use a different character. In Elden Ring the player controls a single character; if that character can’t damage a boss that’s a catastrophic failure.
Designing with Users in Mind
A common trap devs fall into is forgetting the user. Or really, the two users: the player and the other team members. If you’re a tech artist creating an Unreal Material the environmental artists have to drag textures into slots and move sliders around. If you’re authoring a damage formula designers have to type numbers into an Excel spreadsheet that feeds that formula.
One of the best tips I’ve picked up is if you’re creating anything that other team members will use, pick field names and descriptions that make sense from their perspective, not from yours. So, for example, if you’re making a car racing gamemake the “top speed” kilometers-per-hour and not “units per second.” If you’re making a platforming game maybe that field should be “units per second”, where one unit is the width of one Goomba.
I have a fog formula that uses math stuff like natural log and my “fog density” field is often a number like “0.0032” - totally incomprehensible, even to me. I wish I had chosen to present it as “distance at which an object becomes totally obscured by fog.”
Sometimes a system may not be a good fit for the users, even if you try to present it in easily-understood terms. If you tried to use the Fire Emblem damage formula in Elden Ring I suspect this is what would happen:
Designers would type numbers into spreadsheets then run into cases where the player can’t damage enemies at all
They would try to fix those numbers, only to find them broken again with a different stat and item build or when they ran through the game in different order
After going through that a couple times designers would give every enemy low defense because that’s less error-prone, and to make a tough enemy they’d just crank up their HP
Further Objections to Simple Subtraction
If you have just enough attack to do 1 damage, adding 1 more attack doubles your damage output. If you already do 10 damage adding 1 more attack is only a 10% increase.
For Fire Emblem I think is mostly a theoretical objection. “Time to kill” as a metric doesn’t really make sense in this context. Fire Emblem isn’t about having one character continuously hit another character. Instead Fire Emblem is about breakpoints - if an enemy has 10 HP, your archer does 2 damage and your knight does 7 that leaves you one damage short. In that case adding 1 point of attack to either of your characters hits that same threshold, even if adding damage to the archer theoretically changes time to kill more dramatically.
Going from 1 to 2 damage is a huge increase, but going from zero to still zero (because your attack
is lower than enemy defense
) does nothing at all. So sometimes adding attack to a low damage unit is very valuable, but other times it’s totally valueless.
There are similar issues with defense: the less damage a character already takes the more valuable defense
is. If a unit only takes 2 damage a hit, adding one point of defense doubles their survivability. High-defense characters exist to sit on the front lines and take multiple hits, so “time to kill” is more relevant here.
But Fire Emblem units with high defense
tend to have low total stats, including speed and magic resistance, so if “defense is overpowered if you already have high defense” is true in some sense it’s rarely an issue in practice. It is something to keep in mind, though, as it will come up again with later formulas.
Simple Subtraction Wrap Up
It works pretty well for Fire Emblem. It’s very understandable for players. More generally it works well for more constrained games like NES-era RPGs where designers can realistically hand craft and plot out character and enemy stats. But it’s unforgiving. If you get the numbers wrong defense
either doesn’t do much or players can’t do damage, and the more complex a game is the more likely you are to hit these scenarios.
Formula 2: Percent Reduction
Damage = Attack * (100-Defense)/100
Here that defense ranges from 0 to 100 and represents a percentage damage reduction. So if the character has 60 defense that indicates a 60% damage reduction - for every 100 points of damage received that character takes 40.
Game design elements generally aren’t good or bad but depend on other design elements - that said I would avoid this formula in most cases.
It has some strong points. It’s easy to understand. In some sense it’s forgiving. When I need to fill in my Elden Ring enemy spreadsheet I can give Smorgleborg: The Meandering a physical defense of 70 (70% reduction) and feel good about it - that feels safe. Unless I enter values close to 100 to make him invincible to physical damage there’s no catastrophic failure case.
But there are major problems with this formula, particularly for player characters in games with highly customizable characters.
One issue is that small numbers feel negligible. As a player if I equip a shield that has 2 defense I don’t take 2 less damage per hit, I take 2% less damage. At the start of the game if rat hits me for 8 damage and I equip a 2 defense shield I might still take 8 damage due to rounding - the shield does nothing at all.
So maybe a starter shield should have 10 defense. Does that mean a more advanced shield should have 20 defense? But what if I also have a chest piece, helmet, boots, etc?
This formula has the pesky “defense is better with already-high defense” problem from earlier. Going from 0 to 1 defense with this formula does effectively nothing, but going from 98 to 99 halves the damage you take. In Fire Emblem this was a theoretical problem for many reasons, including that the definition of “already-high defense” depends on enemy attack. But here this is a real problem - as your defense approaches 100 it becomes much more valuable.
This is the “what number do I type into the spreadsheet” problem, but instead of the problematic spreadsheet being enemy stats it’s player equipment and ability stats. If I’m staring at the Excel entry for “metal shield” what do I enter? I need room for “wooden shield” and for “stout metal shield”, and I want equipping the shield to feel good, but I also want to avoid all the equipment (and buffs) adding up to close to 100.
Percentage reduction works well for categorical resistances - a fire elemental takes only 25% damage from fire attacks, or plate mail reduces slashing weapon damage by 50%. But that’s more a system on top of the base damage formula. Using percentage reduction as the base - in particular summing up the individual armor pieces to get a total percentage reduction - is hard to work with.
Instead of additive you can do something multiplicative - if you have 50 defense boots and a 50 defense hat instead of 100% reduction (zero damage taken!) you reduce 50% then 50% again, so 75% reduction total. This multiplicative approach is less numerically problematic but it’s much less understandable. In that case “total armor” isn’t a meaningful stat - instead we probably need to label the boots and hat with “50% damage reduction” and then have a total readout that says “75% damage reduction.” This isn’t that hard to understand with simple numbers. But if you have hat, gloves, helmet, body and shield with numbers like 14%, 5%, 20%, 40%, 30% who knows what the total damage reduction should be? You take 70% of 60% of 80% of 95% of 86% of the damage - to many players this won’t make sense beyond “bigger numbers better.” Is the final number the average, the sum? Something else? Is it better to upgrade the 5% gloves to 10%, or the 20% hat to 25%?
This multiplicative approach makes it easier to assign numbers to items in a spreadsheet without worrying about total reduction approaching 100, but it doesn’t solve the problem that damage reduction matters more the more of it you already have, or the problem that small numbers feel inconsequential.
Those problems are intrinsic to the formula. League of Legends switched from “cooldown reduction”, which used this sort of formula, to a different formula termed “ability haste”, because cooldown reduction had the same problem - the more you had the better it got.
Anther problem with this formula is that it’s boring. However the “fixed” version of this formula shares that problem, so I’ll move on to that one.
Formula 3: Effective Health
Damage = Attack * (100/(Defense+100))
When Defense = 100, Damage =Attack /2
When Defense = 200, Damage = Attack /3
When Defense = 300, Damage = Attack /4
With this formula each point of defense
increases effective health by 1%. When you have 100 physical defense you effectively have double the HP, since you’re taking half damage. When you have 200 physical defense you effectively have 200% additional HP, since you’re taking 1/3 damage.
Like the previous formula this one reduces all damage by a percentage, but it handles high defense numbers more gracefully. It’s very forgiving. As a designer you can’t choose dramatically wrong values for individual items, or values that combine poorly. It passes the “what number do I type into the spreadsheet” test - it doesn’t break if you enter 5 or if you enter 500. It’s not as understandable as “40 defense equals 40% damage reduction” but it’s not too bad, especially if players think in terms of effective HP. (“40 defense = 40% more HP”)
The problem with this formula is that it has very dull characteristics.
Consider the following scenario: you’re playing a tactics game where one of your squad members is a thief who attacks quickly with a low damage dagger, and another character is a knight with a huge slow hammer.
You’d naturally expect the thief to excel against unarmored units, and struggle against heavily armored ones. Conversely, you’d expect the knight with the giant hammer to excel against heavily-armored units. It makes sense intuitively and in video-game logic. A thief is an assassin type unit meant to get behind enemy lines and take out soft targets. And in real life stabbing a vulnerable person does a lot of damage, while stabbing someone in heavy armor with a thin blade doesn’t do much. Using a hammer to crack open armor makes sense - like using a crab-hammer to eat crab. I don’t know that using a giant hammer against armored knights is a valid military tactic - the point here isn’t absolute realism, just plausibility and intuitiveness.
A subtractive system supports this naturally. If three stabs have 15 attack each and a giant hammer has 30 attack these do different amounts of damage against different defense values. At no defense the stabs clearly prevail, doing 45 damage total. But versus 15 defense the three stabs do no damage while the hammer still does 15.
This is a nicely organic way of making different units, loadouts, and attacks (like weak vs strong in a God of War style game) more interesting and meaningful. It’s not a lock-and-key system like “water is good vs fire” or “gauntlet weapons are effective against shielded enemies.” It’s not hard-coded, it’s a natural consequence of the system. With a subtractive damage reduction system, weapons with different attack speeds and attack powers naturally have different uses.
I worked on an action-adventure game that used a subtractive damage formula. Against weak enemies I found my most effective combos used weak attacks, since they were quick, safe, and effective. But when I added high-defense enemies those combos did very little damage, and I had to switch to using the harder-hitting slower moves in my arsenal. It just felt right. I was using armor-cracking attacks against tough enemies, and it gave different moves and weapons more clarity of purpose.
In a percentage reduction system you get none of that - the higher DPS weapon is always better. If you want to differentiate hammers and daggers you need to do that in other ways.
Personally I think percentage reduction is also a bit dumb. The goal of a damage formula probably isn’t realism, but armor reducing the damage of a nuke and a spork proportionally is a little silly for my tastes.
League of Legends and Dota 2 both use an effective health setup. For those games it makes a lot of sense. You only control one character and that character has one basic attack. While you can buy items you can’t swap out weapons and armor the same way you can in an RPG or action-adventure game.
In League of Legends if you want to counter an enemy with high armor you don’t pick a character with a giant hammer. Instead of you pick a character that does magic damage, or that naturally builds armor penetration, or that lines up well against them in terms of abilities or macro strategy. Games like League of Legends already have plenty of counter strategies and character counter-picks, so adding an additional layer of “this character with a dagger can’t damage Malphite because he’s too rocky” would be overkill.
These games have enough other things happening in each 30 to 60 minute match. And while MOBAs are full of combat the combat systems themselves aren’t the focus. So this formula works well for that genre - it’s numerically stable, hard to screw up as a designer, and easy enough to understand as a player.
For a game like Fire Emblem or Dark Souls the formula is still attractive in how forgiving it is, but I’d be worried about the blandness.
The first purely subtractive formula is “broken” in that characters can do zero damage. But in Fire Emblem it’s cool that when a thief hits a giant armored General you hear a ping sound and do no damage. Formula two, the percent reduction, encourages you to invest in defense either a lot or a little, since defense is more valuable when you already have a lot. That may also be broken in some sense, but at least it presents two distinct paths - you can invest in defense and become a super-tank or blow it off and focus on something else.
This effective HP formula is almost too fair. Investing in defense a little, somewhat or a lot all differ by the same degree. It’s like a system where each point you invest into “vitality” gives you 10 extra HP - fine but totally unexciting. And, as covered earlier, it reduces weapon effectiveness to DPS, since incoming damage of all amounts is scaled proportionally.
Formula 4 (The Last): Subtraction Revisited
This one is hard to type out so here’s a picture. The two lines are the same formula written two different ways, where s and s2 are damage, a is attack and d is defense
The second is easier to read and parse:
When
attack
is higher thandefense
,damage = attack - defense/2
When
defense
is higher thanattack
,damage = attack * attack / (2 * defense)
The first version of the formula is the one I came up with originally - it looks more complicated but I think the logic is easier to grasp:
Start with half the
attack
as a baseline damageThen, depending on the ratio of
attack
todefense
, either add or subtract damage, such that the total range is betweenattack
and zero
I’ve created a Desmos page with an interactive formula - from this page you can change attack
and defense
values and see what the formula produces, and also see a graph of attack
vs a particular defense
value. I’ve also included a graph of the Fire Emblem formula, for comparison.
Green / top line = our formula, purple/ bottom line = Fire Emblem
When attack
is higher than defense
this formula is the Fire Emblem formula in shape. But as defense
outpaces attack
the damage dealt approaches zero rather than quickly crossing that threshold.
I don’t know that this is “fixed” exactly, but it improves on the “what number do I enter for boss defense?” problem of the original. It’s more forgiving in that if you enter 50 for defense
and the player only has 40 attack
the player doesn’t do zero damage, they just do greatly reduced damage. (In a way that’s more sophisticated than a minimum cap) At the same time, it retains the strengths of a subtractive system - high defense penalizes low attack more than it does high attack.
I’ll revisit the case of our triple-hitting dagger vs hammer, with the Fire Emblem and our new one
Fire Emblem formula:
30 Attack (hammer) vs 0 Defense: 30 damage
15 Attack(dagger) x3 vs 0 Defense: 45 damage
30 Attack vs 15 Defense: 15 damage
15 Attack x3 vs 15 Defense: 0 damage
New formula:
30 Attack vs 0 Defense: 30 damage
15 Attack x3 vs 0 Defense: 45 damage
30 Attack vs 15 Defense: 23 damage
15 Attack x3 vs 15 Defense: 24 damage
30 Attack vs 100 Defense: 5 damage
15 Attack x3 vs 100 Defense: 3 damage
Against a low defense target 3 quick stabs does more damage than one hammer blow, at medium defense they even out, and against very high defense the hammer blow is superior.
Tweaks and Additions
Our graph is asymptotic on the left side and linear on the right side - it could be more than linear on the right. I believe that some of the From Software games do this - if your attack is much larger than enemy defense you do bonus damage, which I imagine helps players quickly clear through “trash mobs” once they’re powerful.
Some games also take player and enemy level into account as a safety valve. With a naïve damage formula a level 1 character with the stats of a level 40 character effectively is level 40, which may not be what you want. By factoring in levels you can cheat a little: if a player is way over-leveled an enemy becomes easier, regardless of raw stats, and if a player is way under-leveled an enemy is tougher, regardless of the other math. This allows grinding to be a difficulty release valve, and prevents exploits like level 10 characters beating a level 90 boss by equipping end-game items. (Though you might consider this a feature)
Where Next
Asking “what number should this formula produce?” makes sense as you need to calculate that number and subtract it from HP.
But ultimately the best way to think about it, in my opinion, is to consider the two user groups.
When the player goes from a wooden sword to an iron sword what should happen? How significant should that feel? What about when the player encounters a way-too-tough enemy, or revisits the starting area and runs into way-too-easy ones? If the player equips a dagger vs a hammer how should that feel? Do we want the hammer in our game to be a armor-cracking weapon, or should hammer and dagger have the same effective DPS against different enemy types? (Vary in reach and play style but not damage)
And consider the other users - the coworkers (including sometimes yourself) who have to type numbers into spreadsheets. Do designers understand the range of those numbers? Can they reliably determine correct-ish values that make sense and play well together? How likely are designers to enter values that break the game, effectively do nothing, or have little underlying logic?
The math can get quite complicated, with floors and ceilings, exponents, natural logs, etc.
For example here’s a reverse-engineered Dark Souls 3 formula
This is easier to understand in graph form - damage ranges as an s-curve from 10% to 90% of attack power, where higher defense stretches the curve horizontally. (More or less)
As another example here’s how various Fallout games handle damage. Reading between the lines you can see the designers grappling with some of these issues - preferring subtraction, preferring percentage reduction, doing both, doing both but swapping the application order, and finally settling with Fallout 4 on a formula designed to handle a high range of values gracefully. (I think)
That formula, similar to the one I ended up on, uses the ratio of attack to defense, and when they’re equal attacks do half damage, same as mine. But the shape of the curve is different. Again: it can get quite complicated.
I’ve looked into various From Software formulas and, based on their use of cubes, logs, etc, my guess is they have a math whiz on the team. A small team might lack that math whiz, but for a small team complex formulas are probably overkill. A large team probably has a math whiz on it, even if it’s not you.
But the math is a means to an end - a way to accomplish the particular goals of the game.
This was a lot - and I never provided a real answer to “what damage formula should I use?” But hopefully I’ve provided at least a starting point.
(If you’re dying for a concrete answer: start with formula 4 and adjust to taste)
Pokémon has a different formula entirely: everything is multiplied, with a minimum damage value of 1. Level is in the formula, but the main part is that Damage = [Attack value] x [Pokemon's attacking stat] / [foe's defending stat]. There are other multipliers on top of these (including a random multiplier between 0.85 and 1), but the end result is still apparently strict enough that competitive players agonize over where to spend 1 additional point in stats.