What damage formulas do you use?

ScorchedGround

Blizzards most disappointed fan (More than ever)
Veteran
Joined
Apr 12, 2020
Messages
644
Reaction score
888
First Language
German
Primarily Uses
RMMV
@G-G-Games
Fair point, but the opposite is true aswell.
Because variance goes both ways, it's possible that you need MORE hits sometimes than usual.

Without Variance:
2 hits on lvl 1
1 hit on lvl 2

With Variance:
2 hits on lvl 1
2 hits on lvl 2 (low%)
1 hit on lvl 2 (high%)
 

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
239
Reaction score
348
First Language
English
Primarily Uses
RMVXA
I'm using a formula for my current project
ATK / ((DEF / 100) + 1)

To read this a lot easier:
ATK / X
X = 1 + (DEF / 100)

So DEF will be calculated like this:
0 DEF (unarmored) means 1 + 0/100 which will equal 1, thus making it ATK / 1.
280 DEF means 1+ 280 / 100 which means 1+ 2.8 which equals 3.8 making the damage formula = ATK / 3.8

If I were to make a DEF table:
0 DEF = 1
40 DEF = 1.4
90 DEF = 1.9
120 DEF = 2.2
So on and so forth.

I find this to be pretty easy to balance (incredibly easy in fact).

An add-on to this that I haven't decided on yet is for multihits to deal less damage per hit against DEF because with my formula, 5 hits of 20dmg or 1 hit of 100dmg does the same amount of damage. If a multihit, for example, added a hidden 10 bonus to DEF per extra hit, then it would make multihits good against HP units and single target burst good against armored units.

Because, by design, multihits are innately stronger due to usually inflicting same amount of damage, having numerous chances to inflict debuffs, isn't a "hit or nothing" attack, etc.
 

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
970
Reaction score
432
First Language
english
Primarily Uses
RMMV
i like 10% variance over 20% because i tend to raise my damage multiplier by 2 for stronger tier skills.
when its 20% the lower tier skill hitting at high variance does more damage then the higher tier skills at low variance.
when its only 10% the higher tier skill is just more damage, period.
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
83
Reaction score
102
First Language
English
Primarily Uses
RMMZ
I have one for attacks that result in damage absorption via elemental immunity. It doesn't have to account for anything and since you can't die from absorbed attacks, the amount absorbed doesn't matter.

Code:
DamageAbsorbed = Math.round((DamageTaken / 2) * (target._absorbRate + (target.mdf / 400)))
Base rate is 100%. Every 4 points of mdf is a 1% increase. Imagine having 200 mdf and getting hit with a 1500 damage attack that has an element you're immune you and you absorb 1125 damage.

I'm not so sure how to tackle an all purpose damage formula yet.
 

tiabuni

Veteran
Veteran
Joined
Dec 27, 2020
Messages
75
Reaction score
33
First Language
Banana
Primarily Uses
RMMV
I really dislike complicated formulas, big numbers, and stuff, so I go with a Paper Mario-like style where a skill that deals 5 damage will do 5 damage, period. 0 variance. Unless the foe is affected by some kind of defensive buff.
 

Ghalundra

Warper
Member
Joined
Aug 21, 2021
Messages
4
Reaction score
3
First Language
English
Primarily Uses
Other
I really dislike complicated formulas, big numbers, and stuff, so I go with a Paper Mario-like style where a skill that deals 5 damage will do 5 damage, period. 0 variance. Unless the foe is affected by some kind of defensive buff.
Simple can be good, but I enjoy more complicated formulas even when I'm aiming for triple digit or low 4 digit max HP totals (massive 5+ digit stats annoy me, so I don't do that). That said, I list the modifiers on spells in the description, so you should always know "Magic Ball is 5x MAT" and the scaling reduction from DEF and MDF is explained in game.

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

If you have 100 attack and hit something with 30 armor, you would do 76.92 damage before varience. Magic uses the same formula, only with MAT and MDF. There are special attacks that target the opposite defense attribute or hybrid attacks too, so:

((a.atk+a.mat)/2) * mod) * (100/(100+(b.def+b.mdf)/2))

I used to sprinkle in LUK in there to make it a more useful stat, but that got tedious and I stopped doing that in my projects.
 
Last edited:

AssumedPseudonym

Lawful Neutral
Veteran
Joined
Jul 15, 2021
Messages
71
Reaction score
84
First Language
English
Primarily Uses
RMMV
I’m going to be aiming for lower stats — probably topping out at 50 for most of them and HP not making it as high as four digits — and have weapons that don’t really scale much in numerical power, opting instead for adding stats, hit/crit rate, elements, and the like (with similar ideas for armor). I haven’t tested this yet at all yet, but my currently planned basic damage formula is going to be (and forgive me for not having this formatted):

(actor base atk * equipment atk) - b.def

and

a.atk - (actor base def * equipment def)

Magic will work more or less the same way, with actor base mat/mdf instead, and each spell having its own mat to multiply by.

Whether this will work or not, I don’t know yet, but that’s the current plan I’ll be experimenting with once I get as far as poking at combat and database stuff. I think I’ll be able to balance around that, though.
 

r66r

Fantasy dreamer... sometimes.
Veteran
Joined
Jan 5, 2020
Messages
41
Reaction score
38
First Language
French
Primarily Uses
RMMZ
In my case, I prefer to use a basic formula that I can adapt to my needs and the context of the game. The ones I prefer are:
  • Physical formula: variable * skill power * a.atk/b.def
  • Magical formula: variable * skill power * a.mat/b.mdf
The variable factor can then be linked, for example:
  • to the user's level (a.level)
  • to his physical state (a.hp/a.mhp), where the weaker he is, the less hard he hits
  • to another stat of the user, or of the enemy
  • to the game difficulty (easy x2, normal x1, difficult x0.5)
  • ...
The only limitations/difficulties I encounter (for now) with this type of formula are the following.

1. The choice of the atk/def or mat/mdf stats values

These stats must be >10 by default, otherwise there is too much risk of unbalancing the fight with the increase of the character's level. For example:
  • Player level 1 with atk = 1 and enemy with def = 1: the enemy will receive 1x the skill power
  • Player level 2 with atk = 2 and enemy with def = 1: the enemy will receive 2x the skill power
  • Player level 3 with atk = 3 and enemy with def = 1: the enemy will receive 3x the skill power
Compare to this:
  • Player level 1 with atk = 10 and enemy with def = 15: the enemy will receive 0.66x the skill power
  • Player level 2 with atk = 20 and enemy with def = 15: the enemy will receive 1.33x the skill power
  • Player level 3 with atk = 30 and enemy with def = 15: the enemy will receive 2x the skill power
2. What about stats for weapons/armors

If atk/def or mat/mdf stats increase with character level, these same stats for weapons and armors should be limited to a few units to limit their impact in the formula.

Imagine a character with atk = 10 using a weapon with atk = 100 against an enemy with def = 15... this would completely destroy the balance of the fight.

For this reason, I usually prefer to give equipment buffs/debuffs or specific new skills, or even possibly increase some additional stats (luck, agility, hit/crit rate), rather than changing the basic stats used in the formula.

3. Balancing the max HP

In this case, if the atk/def or mat/mdf stats are well chosen, it only remains to adapt the Max HP to the power of the available skills and to the average level of the character in the current area of the map... which can sometimes not be obvious.
 

Antilurker77

Villager
Member
Joined
Oct 31, 2018
Messages
15
Reaction score
4
First Language
English
Primarily Uses
RMMZ
I use a variant of World of Warcraft's physical damage formula.

It's essentially ATK * Coefficient * (1 - DEFMitigation). DEFMitagation is determined by the attacker's level and the target's DEF. The higher the attacker's level, the more DEF you need for each 1% of damage reduction. I keep a spreadsheet which tells me how much DEF is needed for 50% damage reduction at a given level for balancing. I've also modified the formula to make differences in DEF more extreme, so say cutting DEF in my game results in much more damage taken then halving armor in WoW.

This also means I don't really have skill tiers; each skill will scale all the way to endgame and always stay relative to each other (ex. a skill that does 200% attack damage will always deal twice the normal attack damage at level 1 or 99). I feel like this makes my game smooth to balance.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,954
Reaction score
14,798
First Language
English
Primarily Uses
RMVXA
Mine was this in my last game:

[(a.atk + strength of skill + a.level) * (a.atk) / (b.def+20) ] * 2 then + a.level.

The attacker's level basically became the minimum damage of the skill as the first part cannot go below 0 as none of those terms can be negative.
 

AfroKat

Veteran
Veteran
Joined
Feb 4, 2017
Messages
95
Reaction score
60
First Language
English
Primarily Uses
RMMV
((a.atk * a.atk) * ((100-b.def)/100)) * skill multiplier ex: (1.0/1.25/1.5)

aka most formulas look like this:

a.atk * a.atk * 1(most foes defense is zero) * 1.5(skill multiplier)

So Defense is a percentage, so 10 = 10% damage reduction, 80 is 80%. So This is a game with High HP, low Defenses.
 

AssumedPseudonym

Lawful Neutral
Veteran
Joined
Jul 15, 2021
Messages
71
Reaction score
84
First Language
English
Primarily Uses
RMMV
 I’ve updated mine from above so that I don’t need separate Attack skills for actors and enemies. To save on scrollback, the basic idea was to multiply base attack and weapon attack values (and the same for armor) to get the final numbers I want. As a bonus, states like Confused will work properly now, and I can do unarmed combat where I need it. It’s kinda messy, but for a game where ATK/DEF won’t top out over around 50 and weapons/armor will like max out at 10 or so, this should do nicely:

(a.paramBase(2)*Math.max((a.atk-a.paramBase(2)),1))-(b.paramBase(3)*Math.max((b.def-b.paramBase(2)),1))

 (Before y’all say it: No, I’m not sure how I’m going to handle attack/defense buffs/debuffs yet. I’ll get to that once I really start focusing on combat.)
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
2,039
Reaction score
1,711
First Language
English
Primarily Uses
RMMV
Hmm...I'm thinking of changing the defensive portion of my formula. Currently, it's: value /= 2 ** (armor / user.atk), here "armor" is either b.def, b.mdf, or their average.

The part I dislike rn is how the ATK (or MAT) stat is referenced twice. Once in the offensive portion of a skill's formula, and once more here. For example, normal attack is: a.atk ** (1 + a.agi / 1000) + a.equips()[0]._weaponDamage.

And so, I'm looking to tweak my formula so the ATK (or MAT) stat can be omitted from the defensive portion. One trait I'd like to retain is how DEF (or MDF) plays a significant role in dmg mitigation.

I've tried to have DEF balance against "Level * X" but haven't been able to find a good sweet spot. It's just not as target.def / user.atk.
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
83
Reaction score
102
First Language
English
Primarily Uses
RMMZ
I've started out small and simple. It's taken directly from suikoden 2 with a few of my own twists involved. For one thing 3 attack mods from that game were moved from the general formula and placed else where.

For the attack command:
JavaScript:
if (a.atk - b.def < 0) {
    1;
} else {
    a.atk - b.def;
};
I don't allow 0 damage from the attack command unless elemental immunity is involved and the game handles that on its own. There are mobs like crabs who will have naturally high defense that are likely to run the first condition.

For magic:
JavaScript:
if (a.actorAttackElement() === 3) {
   
    Math.floor((5 * 1.2) + a.mat) - b.mdf;

} else {
    (5 + a.mat) - b.mdf;
}
5 is the power + magic. This is an ice element spell, so it gives a 20% bonus if the person casting it has an ice attack element(actor only, there are no weapon elements in my game).

This is only works if HP/def, etc are tailored to the formulas similar to Suikoden 2, it wont work for anything else for obvious reasons.
 

Aoi Ninami

Veteran
Veteran
Joined
Sep 22, 2015
Messages
425
Reaction score
529
First Language
English
Primarily Uses
RMVXA
Hi, it's been a while since I was last here, and I've decided to start (and hopefully finish) a small new project before trying to continue my old one. However, I liked the old formula I was using, so I'm going to stick with it:

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

For piercing attacks, where I want defence to have less impact on the outcome, I simply remove the *2 in the denominator. Magical attacks are piercing by default (magic defence is only applied once), so that magical damage has a slight edge over physical, making it worth using even though it costs MP.
 
Last edited:

miragewolf

Villager
Member
Joined
Jul 23, 2019
Messages
28
Reaction score
2
First Language
Traditional Chi
Primarily Uses
RMMV
My basic attack default is this a.atk (weapon damage) + m.atk (strength) - 10 - b.def (variance 100%)

Most weapon damage is under 5, and attributes numbers are low, under 20 for players and barely increase. It's to emulate D&D damage and stats except 1 point above or under 10 equals 1 bonus/penalty. Due to lack of attributes I combine some stats. Also setting up damage and defense as attributes make it easier to add things like unarmed attacks (through damage formula) and unarmored defense (as passive state).

I also put states that change physical damage output to both weapons (bonus) and shield (penalty) to emulate two handed damages, or 1 handed. Vanilla 2 handed weapons get 50% boost, other 1 handed get 30%, finesse get 10%. Tower shield -50%, other shield have difference penalties.
 
Last edited:

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
2,039
Reaction score
1,711
First Language
English
Primarily Uses
RMMV
Yay! I finally got my formula's balance to a good point where both the lv1 and lv50 attacks feel good.

The offensive portion remains the same (e.g. normal attack):
a.atk ** (1 + a.agi / 1000) + a.equips()[0]._weaponDamage

But the defensive portion has been revised to this (armor = DEF or MDF):
value /= 2 ** (armor / (user.level * 3 + 7))

This allows me to retain the weighty impact DEF or MDF has on total damage while not referencing the attacker's stat twice.
 

AssumedPseudonym

Lawful Neutral
Veteran
Joined
Jul 15, 2021
Messages
71
Reaction score
84
First Language
English
Primarily Uses
RMMV
 After using the one I posted above in the Boss Battle Build Bout (and not being entirely happy with how it felt), I’m going to be trying out a different one for my One Map Game Challenge entry:

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

 Basically: Given equal a.atk and b.def, the attacker will do 50% of their ATK in damage. If a.atk is three times b.def, it’s 75% of ATK; if b.def is three times a.atk, it’s 25% of ATK.
 

Latest Threads

Latest Posts

Latest Profile Posts

Even though I spent 100's of dollars on my game already. I think I might just have to give it away for free. Since I haven't heard back from people if I could use some of their graphics. Even from a global mod here. Maybe I can make a donation thing.
you know, some days you get resentful that game dev is even considered a "fun job" and other days it's like, welp, time to roll up my sleeves and code these molotov cocktails
If you suck at playing trumpets, that is probably why.
Been sick with a stomach virus for seven days now. Not going to work tomorrow because I'm still contagious according to my doctor.
Much as I love my job, I really hate playing "office politics". It would be nice if I didn't have to pretend to be someone else all day long.

Forum statistics

Threads
115,960
Messages
1,094,397
Members
151,231
Latest member
DadOfSpaceMonkey
Top