What damage formulas do you use?

Aoi Ninami

Veteran
Veteran
Joined
Sep 22, 2015
Messages
424
Reaction score
526
First Language
English
Primarily Uses
RMVXA
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
Veteran
Joined
Jul 15, 2021
Messages
71
Reaction score
80
First Language
English
Primarily Uses
RMMV
 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. ^.^;
 
Joined
Mar 19, 2018
Messages
14
Reaction score
9
First Language
English
Primarily Uses
RMMV
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
Veteran
Joined
Mar 29, 2020
Messages
37
Reaction score
25
First Language
English
Primarily Uses
RMMV
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

Villager
Member
Joined
Oct 9, 2015
Messages
27
Reaction score
8
First Language
english
Primarily Uses
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 aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
2,020
Reaction score
1,706
First Language
English
Primarily Uses
RMMV
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
Veteran
Joined
Sep 22, 2015
Messages
424
Reaction score
526
First Language
English
Primarily Uses
RMVXA
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 aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
2,020
Reaction score
1,706
First Language
English
Primarily Uses
RMMV
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 aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
2,020
Reaction score
1,706
First Language
English
Primarily Uses
RMMV
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)

1634334175905.png

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! :kaojoy:
 
Last edited:

GregorDuckman

Villager
Member
Joined
Oct 14, 2021
Messages
7
Reaction score
3
First Language
English
Primarily Uses
RMMZ
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.
 

tiabuni

Veteran
Veteran
Joined
Dec 27, 2020
Messages
68
Reaction score
25
First Language
Banana
Primarily Uses
RMMV
(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
Veteran
Joined
Jul 2, 2014
Messages
2,169
Reaction score
1,160
First Language
English
Primarily Uses
RMMV
(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).
 

Latest Threads

Latest Profile Posts

Doing RPG Maker News for 17th October 2021

That moment when you came up with a very good game title, but when you searched it, it has already been used... T.T
Crazy week. My anxiety decides to go nutz. Worse thing about it is that it causes me to lose focus on my work. I was able to leave early one day and take a nap. Seemed to help. How is everyone? Boosters coming soon here. Get my life back on track again.
Finally got my new Discord Server up & Running! I'm still improving it as much as I can, & I'm open for any Suggestions!
I've been busy trying out different art styles for my game.

Forum statistics

Threads
115,873
Messages
1,093,654
Members
151,118
Latest member
suratketerangansakit
Top