# What damage formulas do you use?

#### Aoi Ninami

##### Veteran
The *100 and /100 in the above formula cancel out, and multiplying a fraction by a.atk is equivalent to multiplying the numerator by a.atk, so the formula can be written more simply as:

(a.atk*a.atk) / (a.atk + b.def)

It's very similar to my formula -- indeed, I first tried out exactly this formula (after seeing it recommended in another thread similar to this one) before deciding that in my low-numbers game, the damage it output was too low, so I multiplied the entire formula by 2. Then, I felt that defence wasn't having enough of an effect, and the early battles were a bit too tough -- which would be mitigated if defence had more impact, since the player had more defence than enemies. So I doubled the defence term, resulting in the formula I mentioned above:

(2*a.atk*a.atk) / (a.atk + 2*b.def)

Of course, I'm just explaining how I arrived at my formula; you might well find that your version is better suited to the needs of your project.

Last edited:

#### AssumedPseudonym

##### Lawful Neutral
Thanks for that! I’m still new enough to not really know how well decimals work in a damage formula, so that was actually done deliberately on my part. The idea was to make sure I didn’t hit a floor of zero in the middle of calculations, just in case. The rest of the formatting was me wanting to get a percentage to multiply `a.atk` by. (Beyond that, I’m plenty lazy enough to let the computer do the rest of the math. <.< >.> <.<; )

The fact that it’s been recommended before is encouraging, too. Means I can possibly at least pretend that I have some vague sort of idea what I’m doing. ^.^;

#### dennis_the_tennis

##### Veteran
Damage formulas are really interesting to me, because they can impact the game feel on such a fundamental level, and it's really important to understand the implications of your formula.

I also use the simple (base power)*(a.atk)/(b.def) for my game, and that formula has a lot of serious pros and cons.

Pros:
-Increasing your attack by x% increases damage dealt by x% (this is very intuitive).
-Doubling your defence reduces damage taken by 50%. This is easy to remember and somewhat intuitive, but not as much as the atk one, and it doesn't work well for other values (increasing defence by 20% reduces damage taken by 17%, for example). This does introduce diminishing returns to increasing defence that don't exist for increasing attack, which is desirable from a game design standpoint (encourages offence and avoids stalling).
-A skill with twice as much base power compared to another one will always do twice as much damage, making it easy for the player to compare their available options.

Cons (or at least, things to be aware of):
-Differences between character's stats lead to SEVERE differences in battle performance. If your game involves some classes having twice as much defence as others (plate armour vs cloth armour maybe) then you need to be aware that the cloth-wearers will be taking twice as much damage.
-This can actually be a positive feature if you design around it, however. My game uses the classic MMO 'dps/healer/tank' trifecta, which requires a tank that is absorbing way more damage than anyone else. To accomplish this, I have tank classes that are able to equip the best armour, giving them double or even triple the defence of everyone else.

In my case, the desire to have a 'tank' role is what lead me to a multiplicative damage formula, because it allows for very swingy damage amounts from actor to actor.

#### AphoticAmaranth

##### An Ordinary Human
I often like to use

(a.atk - b.def) * multiplier

It may be simple, but it works, and it's easier for the player to calculate how much damage they would deal. It's also oddly satisfying when you're overleveled for an area and the enemy deals no damage.

#### LordOfPotatos

##### Veteran
a.atk * ( (a.atk/10) * (a.atk/10) ) / ( (b.def/10) * (b.def/10) )

basically damage equals your atk multiplied by the proportion of your atk/the target's def, but it is exponential.

it's designed to scale naturally so abilities are never obsolete and to make small changes to stats very significant.

#### Frostorm

##### []D[][]V[][]D
So for the offensive portion of my formula is currently:

(a.atk ** (1 + a.agi / 1000) + a._weaponDmg) * multiplier

And I was thinking of simplifying it to something like this:

(a.atk + a._weaponDmg) * multiplier + a.agi

However, doing so means I'll lose out on the synergistic effect of ATK & AGI in the 1st formula. In the 2nd formula, AGI simply acts as a "flat" damage bonus. ATK will still generate the majority of the damage, as intended. Which formula do you guys think is better?

#### Aoi Ninami

##### Veteran
Well, it depends on your numbers. In my game, a.atk * (1 + a.agi/1000) would give something like 16 * 1.016 = 16.256 which rounds to just 16, so the agility stat has had no effect at all. Maybe calculate both formulas at level 1, at a high reachable level, and for early-game and late-game enemies to see how they work in practice?

#### Frostorm

##### []D[][]V[][]D
Well, it depends on your numbers. In my game, a.atk * (1 + a.agi/1000) would give something like 16 * 1.016 = 16.256 which rounds to just 16, so the agility stat has had no effect at all. Maybe calculate both formulas at level 1, at a high reachable level, and for early-game and late-game enemies to see how they work in practice?
Oh, that's an exponent btw, not a multiplication sign. As in, ATK^(1+AGI/1000). But yea, even in my project, stats start from high single digits and end up around 100-200 by max level. As you said, the AGI component has little to no effect when it's at such low values.

Using the "16" figure in your example, 16^(1+16/1000)≈16.7 which rounds to 17. So basically, the stats need to be ≥15 to have any effect. However, it does become more pronounced as the stats go up, due to the exponential nature of the formula. I did it cuz I wanted melee units to be more effective if they stacked both ATK & AGI, synergizing the 2 stats. Keep in mind, AGI typically offers many other bonuses, such as CRIT%, HIT%, & etc... The damage portion is just supposed to be the icing on top.

Anyway, I just wanted to clear up that the "**" is Javascript for an exponent (aka "^") and not a multiplication sign.

Last edited:

#### Frostorm

##### []D[][]V[][]D
I recently implemented an awesome idea that @Finnuval came up with! I took the classic Blunt/Slash/Pierce damage concept and gave every weapon a rating for each of those 3 elements. The ratings always add up to a total of 10, with any single rating having a minimum of 1. For example, a dagger would look like this: (weapon name is tentative for testing)

So this dagger has...
Blunt: 1
Slash: 3
Pierce: 6
...with weapon damage of 2.

I achieved this via the following:
JavaScript:
``````<On Creation Eval>
item._weaponDmg = 2;
item._crush = 3;
item._slash = 6;
item._pierce = 1;
</On Creation Eval>``````

This all comes together in the damage formula:
JavaScript:
``((b.elementRate(1) * a.equips()[0]._crush / 10) + (b.elementRate(2) * a.equips()[0]._slash / 10) + (b.elementRate(3) * a.equips()[0]._pierce / 10)) * (a.atk ** (1 + a.agi / 1000) + a.equips()[0]._weaponDmg) / 2 ** (target.def / (user.level * 3 + 7))``

So in effect, every weapon will deal some proportion of Blunt, Slash, & Pierce dmg. That way, if a monster is immune to Pierce dmg, for example, then our hero's attacks will still deal 10% & 30% Blunt & Slash damage respectively. I'm really happy with how this turned out!

Last edited:

#### GregorDuckman

##### Villager
I'm my humble opinion, this really depends on what your vision of these three interactions should look like:

>Low level vs. low level
>High level vs. high level
>High level vs. low level.

How big do you want damage numbers to look at the start of the game, and how big of an impact do you want minor updates to be? If you want small numbers with small changes leading to big impact, this is what the stock RM {a.atk - b.def} gets you. End game stats and equipment have to be adjusted accordingly, to have the right kind of numbers appear in that encounter. One of the downsides of this system is that the third consideration gets blown out the window- low level enemies are a joke, and high level enemies will blow you away without a chance.

How can you get around this? You have to make the damage formulas have more complicated dynamics - instead of being linear (addition and subtraction) they need to be nonlinear (multiplication and division, square roots, etc).
In one example, Pokemon uses {a.atk/b.def} (it's more complicated than this but this is the fundamental step). This means a Pokemon with twice as much attack as your defense will deal twice as much damage, but in the stock system this ratio can mean many different things (ATK = 4, Def = 3, DMG = 1; ATK = 8, def = 3, DMG = 5; five times the damage for a doubling of attack) depending on the exact attack and defense. Is doubling your attack to do twice as much damage more intuitive even though the calculation is less intuitive? Probably. You're less likely to be utterly crushed by higher level differences, but small changes will usually make smaller impacts than stock.

Some games make it even less obvious. Persona 3/4/5 uses (if I recall correctly) something like the square root of what Pokemon does, so small changes make even less of an impact. It does add additional depth though, because multi hit moves, let's say double hit, do more than one hit with twice as much base power (100 a/d, 10 after the square root, 20 when you add both attacks together, versus 200 a/d, 14 after the square root, 20 > 14 damage).

You really need to think about what you want these numbers to look like, and pick the damage formulas that gets the closest to your vision.

#### DrBuni

##### Veteran
(a.atk + 5) - b.def

With the 5 being how much damage the attack always does regardless of the opponent's defensive stats. I like simple stuff, the variety and complexity comes from enemy design instead of an annoying fancy damage formula. An intricate job system, monster families like in Dragon Quest and a quasi-elemental types system like in Pokémon gives my game enough complexity so that the player doesn't need to worry about the math behind whatever attack they want to use.

#### ATT_Turan

##### Forewarner of the Black Wind
(a.atk + 5) - b.def

With the 5 being how much damage the attack always does regardless of the opponent's defensive stats.
That isn't how that math is going to work - if the opponent's defense is 5 or higher than your attack, it will still do no damage. For example, `(10+5)-15=0`

If you really want a minimum damage amount, you need to use the Math.max() function - this will use whichever number is higher. So, `Math.max(a.atk-b.def, 5)` (or you can still be adding the 5 while also leaving it as the minimum value, whatever you want to do).

#### Arctica

##### Veteran
After so long, I've come up with a formula for base spell damage.

JavaScript:
``((mag * spellTier) + level) * (spellPower / 4)``
spellTier = e.g. Ice I, Ice II, Ice III... Mag x 1, 2, 3, etc.

Weapon damage, resistances, bonuses not accounted for. The whole thing was built around keeping a tier 1 spell's damage realisitically small in the low level range and I tweaked the higher tiers from there.

Yeah it's simple and you might think "how long did it take you to come up with that?" Considering that before that I was experimenting with exponents, logs, squareroots and other advance stuff and not getting the range of values I wanted.

Edit: Alright worked out the kind of resistance I wanted.
JavaScript:
``````function setMagicDamage(spellTier, a, b, spellPower) {
const casterLevel = a.isActor() ? a.level : 1;
const magicDamage = ((a.mat * spellTier) + casterLevel) * (spellPower / 4);
const magicResist = b.mdf / 500;
return magicDamage - (magicDamage * magicResist);
};``````

Last edited:

#### Frostorm

##### []D[][]V[][]D
@Arctica Shouldn't it be `a.mat` instead of `a.mag`? Or did MZ change it from MAT to MAG? Also, if you were using stuff like exponents, logs, roots, etc...you're gonna want to graph your formula. In addition, I found it immensely helpful to use standard/vertex notation if you're doing anything w/ parabolas. Speaking of parabolas...I've tweaked my formulas as well, including a segment of an upside-down parabola for a portion of my formula. This is what I got now as a base formula for spells (not including spell coefficient/modifiers):
`a.mat ** (1 + a.mdf / (-900 / 2401 * (a.level - 50) ** 2 + 1000)) / 2 ** (target.mdf / (target.level * 3 + 7))`

Last edited:

#### Arctica

##### Veteran
Yes you're right, that's a typo and should be a.mat.
Admittedly I wrote that while half awake.

#### Frostorm

##### []D[][]V[][]D
I decided I wanted to give Dexterity (AGI) another purpose. Instead of using it as part of that convoluted exponent, I've decided to use it as extra armor penetration damage. So the new base formula for attack is:

JavaScript:
``````((b.elementRate(1) * a.equips()[0]._blunt / 10) + (b.elementRate(2) * a.equips()[0]._slash / 10) + (b.elementRate(3) * a.equips()[0]._pierce / 10)) *
(a.atk + a.equips()[0]._weaponDmg) * (a.equips()[0].wtypeId == 1 || a.equips()[1] ? v[9] = 0.8 : v[9] = 1) / 2 ** (b.def / (b.level * 3 + 7)) + (a.agi / 5) * v[9]``````
…of course, it's written out much more elegantly in the formula box via the use of macros and such. Now, AGI basically grants a flat amount of extra damage, ignoring armor. Lol anyway, I think I'm finally content w/ my formula!

#### Synrec

##### Veteran
I just take the user values, damage calculation is rather dynamic in my game based on the current action of the enemy.
First I use ATK * (A flat value) to determine the base damage.
Then perform damage resistance calculations (User MATK VS target MDEF, different names in game))
Then On projectile hit, if enemy is guarding, perform a calculation based on user ATK VS target DEF.

AGI is used for move speed, LUK for status effects.

It's simple but it works given the combat system I'm going for.

#### Arctica

##### Veteran
Changed mine. Every point of magic attack is added to the damage, so no need to sacrifice points to get multipliers. If I want bigger numbers in the later levels, I can just use a bigger spell power. Magic defense caps at 51 % still. Also blah blah must account for mobs not having levels again.

JavaScript:
`` (spellPower * (a.level / 10 * 2) + a.mat) * (1 - (b.mdf / 500))``

#### Cyberhawk

Currently using the FF7 power formula in MZ from the visu battle core. But i Usually use the basic a.atk * 2 - b.def formula.
Though it can get really annoying since there's no command to make magical spells be undeflectable. I'm not a JS math expert either but, Certain hit healing spells still don't heal nearly as much as their magical hit counter part. (Still figuring that out)
Though I'm mildly tempted to revert to standard RM formula and rework the entire skill formulas as the late/end game can get chaotic with dmg numbers on both ends.

#### Frostorm

##### []D[][]V[][]D
I've recently finalized the defensive portion of my damage formulas:
value /= 2 ** (armor * 1.4 / (user.level * 4 + 10))
…where armor is either DEF, MDF, or (DEF+MDF)/2.

But now I'm on the fence on whether or not to redo the offensive portion of my damage formulas. I was thinking of using the formula for Kinetic Energy as a base: K.E. = ½m*v² …in which:
m = mass
v = velocity

So I was thinking of something along the lines of...
damage = 0.5 * weaponDmg * a.atk * a.agi
I basically substituted mass for weaponDmg, which is just a custom attribute I created for in-game weapons and should be fairly representative of a weapon's weight. Then, instead of velocity², I multiplied a.atk (Strength) with a.agi (Dexterity). This seems logically sound enough for me, but it's quite obvious that such a formula would mean ATK and AGI would be equally valuable in terms of raw damage output. I would much rather have ATK be the primary damage modifier while AGI provides various secondary bonuses (HIT, CRI, CNT, etc...).
With that in mind, I could just as easily use a.atk² instead:
damage = 0.5 * weaponDmg * a.atk ** 2

Of course, these formulas are a huge departure from my current formulas. I can easily tell the values given by the Kinetic Energy formula could get to be very large due to the exponential nature of the formula. I would need to have the output divided by another stat/value similar in magnitude to ATK in order to balance this. Or I can simply scrap this idea and start from scratch again, lol...

Edit: Or, I can go back to one of my earlier iterations...
damage = a.atk ** (1 + a.agi / (-900 / 2401 * (a.level - 50) ** 2 + 1000)) + weaponDmg
…which I suppose could also be written as:
damage = Math.pow(a.atk, 1 + (a.agi / (-900 / 2401 * Math.pow(a.level - 50, 2) + 1000))) + weaponDmg
…hmm, did I get all the parenthesis right? Or do I need more for the Math.pow terms?

Last edited:

### Latest Profile Posts

Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it!
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!