What damage formulas do you use?

GregorDuckman

Villager
Member
Joined
Oct 14, 2021
Messages
25
Reaction score
21
First Language
English
Primarily Uses
RMMZ
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? :distrust:
I would be very careful about using the kinds of formulas you've chosen here. Your damage numbers are quadratic and your defence value is exponential and these are going to become very unwieldy at high levels, and you will probably end up constantly tweaking parameters chasing weird interactions you discover - you might end up doing pitiful damage to high level targets with appropriate equipment, but then doing literally millions of damage to early game enemies.

If I had to pick two favorites, I'd say SMT/Persona (square root of atk/def) and DOTA/World of Warcraft (atk damage is linear, defense reduction is asymptotic to 75%) are the easiest to keep reasonable numbers inside of.
 

freakytapir

Veteran
Veteran
Joined
Jun 13, 2014
Messages
230
Reaction score
243
First Language
English
Primarily Uses
RMMV
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

My damage formulas too started from this base idea that I wanted two stats, but instead of you not wanting them to be equally valuable, I did want them to be equally valuable.

I don't like one stat to be the 'superstat' to just min max.

So I do use

a.atk1*a.atk2/b.(m)d(e)f

with atk 1 being determined by the magic/physical split so either atk or mat, and the second atk stat by the ... element or weapon used.

So swords go by attack and agility, hammers go by attack and defence.
Fire would go by magic attack and physical attack, while earth would go by magic attack and defence.


So a versatile mage could just raise MAT and get kind of good at all elements, and a versatile weapon user would just raise ATK, and rely on natural statgrowth for the secondary stat of his ever growing pile of weapons. (Weapons don't really give stat boosts in my game. There is no upgrade mill.)
Or he could go 'I'm going fire mage, might as wel grab myself some flaming sword attacks', or the earth mage choosing a hammer over a staff, imbueing it with the weight of the land.

There are enough stat points to max out about two stats, with some points left over for a third stat.
Stats go from -- to - 0 to + to ++, to +++, each step costing one stat point, and adding 10 % Base stat (10*1.1**(lvl)) So, a single step in stats is like being one level ahead.
At level up, all your stats jump 10%, but your preferred stats always remain higher. Stat points are every five levels, so even if you start with a -- you can get it up to +++ by level 25 (max level is planned to be 50).

Now, how does this relate to my damage formula?

(Warning, I do round some of these values to the nearest five)

It means, that at equal level, the difference between, given the same opponent, the max spec character, and the absolute worst is a factor of 2.64 while on offence, (0.8*0.8 vs 1.3*1.3), so about 65 damage vs 170 damage when the base would be 100. Not that terrible a range.
On the defence side, it would mean the difference between max defence and lowest possible defense at a given level would be taking 125 versus 75 damage, so a factor 1.6 .

The system might look like it rewards maxing out your attack, but maxing attack costs twice as much (two stats to raise).
Then again, if you want to be a good tank, you'd better raise MDF too.

Now, on level differences, it means that every level you are higher than your opponent, you're dealing 20 % more damage, and taking 10% less.
But the reverse also goes for the enemies. So taking on a boss a level above you is doable, two levels above you is hard, and three levels above you is near suicide if you don't play perfect, as 'nearly kill the party' AoE's become instant wipes unless you utilize lot of buffs and debuffs (Each buff is about two level's worth).
This might not fit everyone's needs, but it does mine, where I intend to keep the player tightly within a certain level bracket, while still allowing some non linearity. (Do the level 3 or lvl 4 dungeon first? Your choice, but even though you've unlocked the level five one already, you'd better get stronger first.)

So long story short, all my spells/abilities/weapon atttacks have their own damage formula.

Some examples:

Ice: a.mat*a.mdf/mdf
Fire: a.atk*a.mat/b.mdf

Now, this all sounds simple, right? But then I got to thinking ... Not every weapon needs to use atk.

What about bows? Agility should help there, right? But Wisdom, and a calm mind should too. So maybe bows are Agility and Wisdom.
What if I have a cross over ability like Flaming blade? It's a sword attack so it should use Attack and Agility, but it's also a fire spell, so maybe it should use MAT as well?

So for the combined attacks, I edited the formula slightly to be:

a.atk1*a.atk2*a.atk3/(b.def1*b.def2)

If you put in the numbers it works out. For something like a 'Fire blade' ability to a.atk*a.mat*a.agi/(b.def*b.mdf)

Now, you ask, wouldn't that make stat buffs way better? Well no. If you raise one stat, by 20% for example, it still increases the damage by only 20%, and you'd have to debuff both defence stats to actually make it matter.
It does however raise the 'buff cap', but I mean, player spends three turns buffing his stats, and two debuffing the enemy, let him have his 'super' effective attack.

That seemed to work, until I got to the combined elemental attacks, you know, for example a blizzard spell, which would be both air (uses AGI) and ice (uses MDF), so the attack should be a.mat*a.mdf*a.agi. I can't leave out any stat, and it should still be a purely magical attack so what do I do? I can't just use mdf twice, or square it, that would make debuffs too good.

So, for the cases where I need two defenses but have only one that makes sense, I just replaced one of them with ... the average stat an enemy would have at that level. Math.Floor(10*Math.Power(1.1, b.lvl)). Boom, I now have a generic defence stat.
This does require an 'enemy level' plugin, but I'm using that anyways for my 'deep dungeon' part of the game.

Then I started getting experimental.
I know what player HP will be by a certain level.
Why not have Blood magic run off of "Percentage your MaxHP is higher than average for your level" so the damage formula there became :(MaxHP/"HP formula for lvl")*a.mat/b.mdf

Holy? Yeah, that punishes agressors. b.atk*a.mdf/b.mdf

Now I got to thinking, daggers, would just be atk and agi, right? But then we'd overlap with the sword. What if daggers keyed off of critical hit and agility? Giving a straight up damage boost if you have higher CRI?
And here we have the same problem as we had with the 'Blizzard' Spell. a.agi*(1+CRI)/b.def doesn't work, and neither does a.agi²*(1+CRI)/b.def, because that would supercharge any agi boost you got. So the generic 'This is what your average stat is at this level' lakes another appearance, so we finally get : a.agi*Math.Floor(10*Math.Power(1.1, b.lvl))*(0.95+CRI)/b.def. This generates a 'fake stat that is then modified by crit percentage, assuming 5% crit as the baseline.

Now the worst thing is, I need to communicate all this to my players.
That's the thing I'm working on. As seen earlier in this thread, I use symbols, but I'll need to make sure I have it written out somewhere too.
The easies way would off course be to have the weapon in question raise the relevant stats.
So a dueling rapier, that increases it's damage with AGI and CNT would grant an increase in agility and CNT.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,740
Reaction score
2,296
First Language
English
Primarily Uses
RMMV
Now the worst thing is, I need to communicate all this to my players.
Do you use Yanfly's YEP_X_EquipRequirements.js? I use it as an extended armor/weapon description page. via <Custom Equip Requirement Text>. Example:
JavaScript:
<Custom Equip Requirement Text>
text = "Weapon Type: \\c[8]Light\n";
text += "Damage: \\c[8]1\\c   Range: \\c[8]1\\c \\i[125]\n";
text += "Bonuses:\n";
text += "+\\c[8]1\\c \\i[94]Dexterity\n";
text += "+\\c[8]5\\c% \\i[255]Focus Regen";
</Custom Equip Requirement Text>
<On Creation Eval>
item._weaponDmg = Math.floor(Math.random() * 2) + 1;
</On Creation Eval>
<Replace Attack: 2>
<letbs_commands>
attack 76,
</letbs_commands>
1653977951844.png
 

freakytapir

Veteran
Veteran
Joined
Jun 13, 2014
Messages
230
Reaction score
243
First Language
English
Primarily Uses
RMMV
Do you use Yanfly's YEP_X_EquipRequirements.js? I use it as an extended armor/weapon description page. via <Custom Equip Requirement Text>. Example:
JavaScript:
<Custom Equip Requirement Text>
text = "Weapon Type: \\c[8]Light\n";
text += "Damage: \\c[8]1\\c   Range: \\c[8]1\\c \\i[125]\n";
text += "Bonuses:\n";
text += "+\\c[8]1\\c \\i[94]Dexterity\n";
text += "+\\c[8]5\\c% \\i[255]Focus Regen";
</Custom Equip Requirement Text>
<On Creation Eval>
item._weaponDmg = Math.floor(Math.random() * 2) + 1;
</On Creation Eval>
<Replace Attack: 2>
<letbs_commands>
attack 76,
</letbs_commands>
View attachment 227698
Thank you so much. This is exactly what I needed.
Yes, I do have the plugin ( even paid for it, well all of the plugins after I lost my original copies in a pc crash and he had gone behind a paywall by then).

I mean, I plan on having every weapon and element to have it's own mechanics, and I don't want that info hidden in a tutorial or Glossary, or cramped in a small textbox.

Now that I think about it, if I implement a 'soul stone' like system for switching classes, I could dump some class info in there.
 

NamEtag

Veteran
Veteran
Joined
Jun 27, 2020
Messages
62
Reaction score
43
First Language
English
Primarily Uses
N/A
So I tried to make a stupidly complex damage reduction formula that turned out to be very similar to Fallout calculations.

Sigmoid Damage Reduction.PNG

The short explanation is that DEF matters a lot, up until 75% damage reduction at ATK=DEF. More DEF than that is basically useless. ATK is essentially your armor penetration stat, while squishy mages can take at most 4x as much damage as your tank.

I also suspect this will be a rather inefficient formula on processing power.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,740
Reaction score
2,296
First Language
English
Primarily Uses
RMMV
I would be very careful about using the kinds of formulas you've chosen here. Your damage numbers are quadratic and your defence value is exponential and these are going to become very unwieldy at high levels, and you will probably end up constantly tweaking parameters chasing weird interactions you discover - you might end up doing pitiful damage to high level targets with appropriate equipment, but then doing literally millions of damage to early game enemies.
See, that's where you're wrong. The exponential component really only ranges from 1.0->1.2, so it's actually quite tame in that regard. As for the defensive component, it simply divides the pre-defense damage value by 2 if the target's DEF (or MDF) value is level appropriate. If their DEF/MDF value is 0, then the pre-defense damage value is divided by 1 (i.e. no change). It's actually really hard to increase DEF/MDF to the point where the pre-defense damage value is divided by more than 3.

I also suspect this will be a rather inefficient formula on processing power.
It's probably a negligible amount when considering modern processing power, lol.
 

IschmarVI

Villager
Member
Joined
Jun 4, 2022
Messages
15
Reaction score
5
First Language
German
Primarily Uses
RMMV
In my current projects, all damage formulas essentially follow the following concept:

x * a.atk * (1 - b.def/100)

where x determines, how much "oomph" that skill has. This is, because in that game, def und mdf are representing percentage damage reduction rather than flat. The way it works is essentially "every point in def reduces your physical damage taken by 1%". This has the advantage that the defense stats don't need to change based on leveling which makes it easier for me to, for example, adjust the health of an enemy (or actor).

Yes, I do realize that I am essentially imitating the effects of "pdr" and "mdr" with that but imo, using def/mdf instead has a few advantages - at least for the way I work with them.

Oh, and I should mention that in the one game where you actually get to equip yourself with armor etc. (my main project actually only uses armor/weapons as "skin items"), I messed around with the way, the game calculates your total def/mdf so that, if an armor piece has "20 def" it reduces the physical damage you take by 20% when compared to wearing nothing in that slot, so the stat should never reach 100 until you flatout get a piece that gives 100.


But yeah, in short: I am using def/mdf as percentage mitigation because it makes it easier for me to balance fights.
 

Latest Threads

Latest Profile Posts

Took some trial and error, but I managed to create "visuals" for underground dig path regions.
Couldn't sleep at all so I started working on the topmost deck. I've had to make several deviations from the Imperator/Berengaria's deck-plans to accommodate MV's movement, but 100% accuracy was never my intention.
Still no name for the poor ship...:kaodes:
Screenshot-2022-06-25-053308.png
ScreenShot_6_24_2022_9_20_7.png
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.

Forum statistics

Threads
123,028
Messages
1,153,511
Members
161,370
Latest member
BuiTra
Top