thethomasink

Villager
Member
Joined
Jan 3, 2023
Messages
21
Reaction score
1
First Language
English
Primarily Uses
RMMV
Howdy all, I've experimented with damage formulas before but none have ever really stuck, probably because I'm bad with math. However, when working on a new project, I had a neat idea for once and came up with using a formula that scales the damage based on a multiplicative found by dividing the attack and defense. The basic form of the formula looks like this:

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

I also decided to toss in a small bonus to the b.def by adding together their agility and luck and dividing it, meant as a small, helpful boost, and I multiplied the initial attack by 3 to give it a higher damage output than just the base stat. Coming out to this:

(3 * a.atk) * (a.atk/(b.def + ((b.agi + b.luk)/3))

It's a bit of a jargon salad but hopefully I've illustrated what I'm getting at. Anywho, I would appreciate any feedback given by those who are wiser in the way of numbers than I. I thank you for your time and hope you have a nice day!
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,672
Reaction score
11,189
First Language
English
Primarily Uses
RMMV
It's...a formula? :biggrin:

Whether it works well for you depends on how you want to balance your parameters. If a well-rounded character has parameters of about the same value, you're really weighting it in the favor of the divisor by combining defense, agility and luck there. Of course, if you don't actually want to be seeing that full value of 3 * a.atk, then that's what you want.

Mathematically, that first set of parentheses doesn't mean anything, going left to right that operation is happening first anyway.

I find the best way to evaluate a damage formula is to test it. You can pretty easily plug everything into an Excel sheet and add in sample numbers for atk, def, etc. (don't forget to take into account equipment at different levels).

And, of course, there's how the battles feel when actually playtesting, but it saves a lot of time to do out the equations on a sheet. Then you can make sure the progression is what you want before even booting it up.
 

thethomasink

Villager
Member
Joined
Jan 3, 2023
Messages
21
Reaction score
1
First Language
English
Primarily Uses
RMMV
It's...a formula? :biggrin:
Indeed, you have been called upon. Seriously though, thank you!

Whether it works well for you depends on how you want to balance your parameters. If a well-rounded character has parameters of about the same value, you're really weighting it in the favor of the divisor by combining defense, agility and luck there. Of course, if you don't actually want to be seeing that full value of 3 * a.atk, then that's what you want.
The game is meant to be on the challenging side, so siding the result on the side of the enemy works well. The game is more equipment focused than stats and all stats increase uniformly with each level. The formula is also used against the player, so that could potentially be pretty fun and satisfying for those who like heavy armor and tanking.

Mathematically, that first set of parentheses doesn't mean anything, going left to right that operation is happening first anyway.
And that's why I consult people who know this stuff better than me :hswt:
I think I did that out of instinct after working on the latter half of the formula.

I find the best way to evaluate a damage formula is to test it. You can pretty easily plug everything into an Excel sheet and add in sample numbers for atk, def, etc. (don't forget to take into account equipment at different levels).
Yeah but every time I open Excel, I can't help but feel the same encroaching entropy and despair that every office worker feels. Joking aside, you're probably right there and it's something I'll keep in mind when I get around to working on the numbers side of the project.

Thank you for taking the time to respond!
 

woootbm

Super Sand Legend
Regular
Joined
Apr 26, 2014
Messages
503
Reaction score
626
First Language
English
Primarily Uses
RMMV
Whether it works well for you depends on how you want to balance your parameters. If a well-rounded character has parameters of about the same value, you're really weighting it in the favor of the divisor by combining defense, agility and luck there.
This needs more attention. You might carefully monitor the stats to make this work, but there's a lot of volatility here. The obvious part is what ATT_Turan is saying; that there's a lot of "b" stats being added together. But I wanted to point out that if the "a" stats are ever bigger than the sum of the "b" stats, you get a very big multiplier.

A couple examples:
a.atk = 10
b.def = 10
b.agi = 2
b.luk = 1
Result = ~27

a.atk = 10
b.def = 1
b.agi = 2
b.luk = 1
Result = 150

a.atk = 1000
b.def = 1
b.agi = 2
b.luk = 1
Result = 1500000

See how those zeroes are rapidly going nuts? I'd probably just use a math.min to prevent the formula from going crazy when meeting a low stat enemy:

Math.min(3 * a.atk * (a.atk/(b.def + ((b.agi + b.luk)/3)), 3 * a.atk)
In this example the most damage you could do would be 3 * atk, so the result from the second example would be 30 and the third would be 3000.

But iunno, maybe you want a scenario where you start getting huge multipliers because your atk outweighs enemy stats.
 

thethomasink

Villager
Member
Joined
Jan 3, 2023
Messages
21
Reaction score
1
First Language
English
Primarily Uses
RMMV
A couple examples:
a.atk = 10
b.def = 10
b.agi = 2
b.luk = 1
Result = ~27

a.atk = 10
b.def = 1
b.agi = 2
b.luk = 1
Result = 150

a.atk = 1000
b.def = 1
b.agi = 2
b.luk = 1
Result = 1500000
This is a good point. For this project, I'm aiming for the enemies to hit hard but if the player prepares and gets stronger, they can hit just as hard back. I don't necessarily mind if a player can overpower an enemy; if they went out of their way to level up and find the good loot, they should be allowed to throw their weight around. As long as it's fun.

But if they're too much of steamroller and bowl over any enemy they come across or if the enemies always crush them into paste, that might present an issue or two.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,672
Reaction score
11,189
First Language
English
Primarily Uses
RMMV
You might want to read through the several damage formula threads. They have people posting the formulae they use and explaining what gameplay effects they're going for.


 

thethomasink

Villager
Member
Joined
Jan 3, 2023
Messages
21
Reaction score
1
First Language
English
Primarily Uses
RMMV
This one is very useful to keep in the back pocket!
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,672
Reaction score
11,189
First Language
English
Primarily Uses
RMMV
I find them both useful - the second one I think has a bit more of people providing formulae and explaining how they behave. I actually got the formula I use in my game from there.
 

thethomasink

Villager
Member
Joined
Jan 3, 2023
Messages
21
Reaction score
1
First Language
English
Primarily Uses
RMMV
Well, alright then! I'll be sure to give them both a look-through. Thanks!
 

Latest Threads

Latest Posts

Latest Profile Posts

Time for the next chance for y'all to affect my advent calendar! Where should Day 7's sprite come from: land, sea, or demon realm? :rwink:
Throné's final boss is weird. He is a guy holding a baby while fighting off attackers. I think his name was Santos. I might be thinking of someone else.
I think I've just about finished fighting the fight with the tileset I was most intimidated by for game jam. No pictures yet, the map isn't presentable, but I think the tileset will work! I'm very relieved XD
Twitch! At it again with more gamedev for a couple hours, followed by some Valheim with my friend. Feel free to drop by~
these 80+ gb updates on several years old games are the absolute worst. I just want to play for an hour or so before bed to unwind. Sorry, gotta spend that time downloading an update. Then my mods will be broken so I'll have to start over or wait for those to be updated to. Is a complete game within three years of the pay to be a beta tester period really to much to ask?

Forum statistics

Threads
136,782
Messages
1,269,875
Members
180,523
Latest member
Reimu
Top