# Feedback on a damage formula

#### thethomasink

##### Villager
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
It's...a formula?

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
It's...a formula?
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
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
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
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
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
This one is very useful to keep in the back pocket!

#### ATT_Turan

##### Forewarner of the Black Wind
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
Well, alright then! I'll be sure to give them both a look-through. Thanks!

### Latest Profile Posts

Hamburger!? Yeeah.
I love it when the approval queue is 80% spammers. Makes it so fast to power through!
I found some inspiration and have started work on a Point and Click style exploration game in a dead mall. I am hopefully going to push MZ in some unexpected directions. I always love seeing the engine do things that folks might not expect. Its good to have found some direction. Thanks for the support a few weeks back when the writers blog was hitting heavy.
Don't you want your heroes or monsters to lose some of their MAXHP or MAXMP? Don't you?
Really, why wouldn't you?
Yeah, it's gonna get worse after every hit they take, but so what?
Aren't they courageous fighters? Or stupidly brute mobsters?