New account registration is temporarily disabled.

CAN'T FIGURE OUT A PROPER BATTLE FORMULA. PLEASE HELP

Posts

Pages: 1
Hello all, first post and first game I've ever made. It's kind of like Zork mixed with D&D. You can level up stats, get spells, potions, bunch of other stuff but I can't seem to figure out a decent balanced scalable battle formula. The current formula for the player attacks are as follows.

Heavy attack (cuts the players speed in half): (weapon_base_attack + (weapon_max_attack * strength)) / enemy_defense

Light Attack (cuts damage in half): (weapon_base_attack + (weapon_max_attack *strength) / enemy_defense) / 2

Here is the enemy attack formula
(base_attack + (max_attack * strength) * level) / player_defense

I don't think any of this would end up actually working out very well. This is the first formula I've ever made so bare with me. I truly have no idea how to go about making formulas so I'm lost. This is the last piece of mechanics I need before being able to alpha test.
I made a heavy and light attack so the player has to use a bit of strategy and it's boring to hit for the same damage every time
Do you have any suggestion on how to make these formulas? I'm sorry if this is a stupid question but as I said I'm completely new and really don't understand how to make fair and balanced formulas.
Also, should I allow the player to have more than one stat point (to level a stat) every time they level up?
Any help would be beyond appreciated.
Mirak
Stand back. Artist at work. I paint with enthusiasm if not with talent.
9300
Damage formulas are pretty wack I mean, math right? That's the trade weapon of the nerds and the mentally unspoiled. For real I hope someone helps you out. I suck major schlong at it.
Look at some existing ones. I remember FE Three Houses had simple but well-working ones. I'd think divisions are crazy for defense values. Substractions are probably easier to work with

Sth lik Base Damage + Strength Value calculation (like 1/4 strength or sth, depends on numbers) - defense and THEN half that for the light attacks.
Also, what does halving speed mean in this context?

If you multiply or divide sth by stat values you will likely have a major problem as things will go bad real quick. It's easier to keep track of when you divide by set numbers and NOT by variables. Especially when you do not wanna math. It'll also keep your numbers smaller. Smaller = easier to try out brute force with, and keep track of.
Like the damage / 2 = light attack you made

I never made anything combat myself so sadly I cannot draw from direct experiences, but that's my first guess looking at other games' formulas (or just FE really, since I came to look up some things lately)

FE Fates Calculation according to Google:
Physical Attack = (Strength) + (Weapon Might) + (Weapon Rank Bonus)
Magical Attack = (Magic) + (Weapon Might) + (Weapon Rank Bonus)
Hit Rate = (Skill) x 3/2 + (Luck) x 1/2 + (Weapon Hit Bonus) + (Weapon Rank Bonus) + (Class Bonus)

Fancy enough, but no big multiplicators there. OFC: note the genre, and the small-ness of numbers and HP in the game.
If we do not know the numbers we are dealing with, we cannot base a formula using em.

What are your HP scales? Stat scales? Base stats? Stat boni per level? Equipment factors?

Just stating your calculation is sadly not really usable without all those parameters in place. You could probably SOMEHOW make your existing one work - it would just require having very small defense values, or having enemies have TOTALLY different stats and strength values, and so forth. It just sounds tricky.

I am really sleep so I am not very math-y. But one thing you may wanna do is have the level modifier for enemy attack be based on LEVEL DIFFERENCE, not base level. Again, you get really high numbers really fast. A lvl 10 creature shouldn't have 10 times the attack when their weapons AND strength are growing already. Because while one multiplier would be cancelled by a growing defense, you have TWO multipliers. Strength and Level which both scale vs. only one scaling defense. This is made worse because this is NOT the case in player attacks. If it was on both sides, you could just give high defense stats.
Make enemies and players follow the same formulas, then you can simply give enemies lower/higher (if boss) base values and you will be fine.
Or well, you won't have to adjust to two different systems at once.

Anyhow. The thing about math is, you can make a lot of silly stuff work if you adjust base values to get desirable results.
So, what ARE your base values? How is it not working out? What's the result playing out like in your game? Changing the formula is one way to solve it. Changing the values to work with your formula the other.

Thanks for replying so quickly!!
Mirak - You've got the same thought pattern as I do lol I'm terrible at math. Thank ya

Kylaila - I'll check that out. What's sth?
Speed is used to determine which one may strike first, if you use a heavy attack then your speed is cut in half and then is checked to see if it is greater or lesser than the enemy speed, if it's lesser then the enemy strikes first. It's so you have to choose either a fast light attack or a slow heavy attack and risk getting hit first.
Yeah I noticed that basing it on variables didn't work out very well... So should I use armor instead of defense stats? That would give set numbers instead of the variable of the players defense.
Even if you have no direct experience I truly appreciate your help and not belittling me like they would on Stack Overflow/ Stack Exchange. Those people seem to just be dicks.


author=Kylaila
Look at some existing ones. I remember FE Three Houses had simple but well-working ones. I'd think divisions are crazy for defense values. Substractions are probably easier to work with

Sth lik Base Damage + Strength Value calculation (like 1/4 strength or sth, depends on numbers) - defense and THEN half that for the light attacks.
Also, what does halving speed mean in this context?

If you multiply or divide sth by stat values you will likely have a major problem as things will go bad real quick. It's easier to keep track of when you divide by set numbers and NOT by variables. Especially when you do not wanna math. It'll also keep your numbers smaller. Smaller = easier to try out brute force with, and keep track of.
Like the damage / 2 = light attack you made

I never made anything combat myself so sadly I cannot draw from direct experiences, but that's my first guess looking at other games' formulas (or just FE really, since I came to look up some things lately)

FE Fates Calculation according to Google:
Physical Attack = (Strength) + (Weapon Might) + (Weapon Rank Bonus)
Magical Attack = (Magic) + (Weapon Might) + (Weapon Rank Bonus)
Hit Rate = (Skill) x 3/2 + (Luck) x 1/2 + (Weapon Hit Bonus) + (Weapon Rank Bonus) + (Class Bonus)

Fancy enough, but no big multiplicators there. OFC: note the genre, and the small-ness of numbers and HP in the game.
If we do not know the numbers we are dealing with, we cannot base a formula using em.

What are your HP scales? Stat scales? Base stats? Stat boni per level? Equipment factors?

Just stating your calculation is sadly not really usable without all those parameters in place. You could probably SOMEHOW make your existing one work - it would just require having very small defense values, or having enemies have TOTALLY different stats and strength values, and so forth. It just sounds tricky.

I am really sleep so I am not very math-y. But one thing you may wanna do is have the level modifier for enemy attack be based on LEVEL DIFFERENCE, not base level. Again, you get really high numbers really fast. A lvl 10 creature shouldn't have 10 times the attack when their weapons AND strength are growing already. Because while one multiplier would be cancelled by a growing defense, you have TWO multipliers. Strength and Level which both scale vs. only one scaling defense. This is made worse because this is NOT the case in player attacks. If it was on both sides, you could just give high defense stats.
Make enemies and players follow the same formulas, then you can simply give enemies lower/higher (if boss) base values and you will be fine.
Or well, you won't have to adjust to two different systems at once.

Anyhow. The thing about math is, you can make a lot of silly stuff work if you adjust base values to get desirable results.
So, what ARE your base values? How is it not working out? What's the result playing out like in your game? Changing the formula is one way to solve it. Changing the values to work with your formula the other.

Well, I've got four different character types for the user to choose from...
Base stats below

Thief
Health: 10
Strength: 5
Defense: 7
Speed: 2

Mage
Health: 12
Strength: 4
Defense: 7
Speed: 1

Dragon Tamer...he's a tank
Health: 10
Strength: 10
Defense: 9
Speed: 4

Archer
Health: 15
Strength: 4
Defense: 8
Speed: 6

I honestly have no idea on the scales, I was just going to let the user put points in whatever stats they wanted and don't know how many points to give per level up I have no idea what the multiplier per level should be *sigh* being a newb is no bueno
The level difference is a really good point, thank you

So you know, I was going to only expose the player to either lower level or equal level enemies ( if player is level 10 they only encounter enemies with level 10 or lower )

You made really good points, thank you very much.
I may try out those formulae you posted so thank you again
** The outcome of a level 2 enemy hitting a player with a player defense of 7 is 3.0714285714285716 **
sth = something, pardon my sleepy-posting. I learned English later in my life, a lot of books used it as a common abbreviation, but obviously not everyone uses those.

Gotcha! That makes sense with speed. Turn-based scenario where strike or turn order is based on it. I like that. Makes fast attacks a good last-hitter too if you can anticipate it dealing enough damage.

And oh please, no belittling needed. You are doing all your work in trying to fix your thing and that's actual growth and work. You are just smart enough to ask for help when hitting a roadblock. That's lovely to see, if nothing else.
Just keep in mind for a formulate like that, since YOU have control in creating the variables it uses, that's one other way to fix results once you found a good-looking formula.

I think that might help. Let your stats affect the end thing, not directly BE the end thing.
What I'm worried about is that if damage is divided by armor (rather than armor values being substracted) you may have a limited range of high damage numbers. Say, you have 10 base damage (in total), with 1 defense you'd get those 10. With 2 armor 5, and with 3 - 3. and with 4 armor, 2 sth. You could get lots of 1-3, but you will have either 10 or 5 damage at the top of the scale. You might wanna see if you can get Total Attack - Total Defense to work. You can even do defense x 2 or sth if it ends up too high.

Having a separate armor value will give you better control over when those changes kick in though, and allow different values - again, a lot of definition stuff. Does WEARING armor add to defense, or is it a different thing? Or does Armor have its own class, but a certain number of natural stats (say constitution) adds to it? (like armor points + 1/4 constitution) or sth.
Hence I am sorry I can't really make something that'd work without knowing the other parameters. (that, and I actually should be heading out. I am sure peeps who math AND have experience with games can help ya out with more tangible advice too)


Edit: Glad it already helps. You already have neat sizeable player stats numbers, too, including health.
DO NOTE: that formula is not mine. It's from FE, and you will likely need to. Substractions/additions in formulas certainly are worth a shot, though.
Thank you again Kylaila, I really appreciate that!!
It will help for sure, the armor is it's own class but I was just going to add the defense level of the armor to the defense level of the player, mainly to lessen the amount of code/mechanics.

Having the stats effect the end result is a really good idea and I'll likely use that. I'm thinking I might have to make armor it's own 'thing' and just add it to the formula. as in, the attack damage would effect the armor before the health and if the attack is greater than the armor 'points' the remaining damage takes away health and it also takes away a durability point so the armor can break.

Don't be sorry, please, the more you ask the more specific the answer can be and I'm BEYOND grateful.

EDIT: *** Another Edit: I didn't notice you said x2 to defense if something ends up too high, great idea!! ***
So basically you're saying to do the formula with set numbers and have the variables affect the result of the formula? for example (**random numbers here** base_weapon_dmg = 2 Max_weapon_dmg = 6 Strength = 3 and enemy_defense = 2)
Heavy Attack: 2 + (6 *3) = 20 - 2 = 18
So final damage would be 18 but the level 1 enemies tend to have about 5 health (because you'll likely interact with lots of them before getting to a village or finding a healing potion) which would gaurentee a kill on the first hit which would take alot of fun out of it eh? I also can't figure it out without the strength variable but I think the formulae from FE would probably make it all work out... Just gotta try it
trippy-chords, welcome and what's up!

What engine are you using first off? Always include that in any help thread.

So, hopefully if and when this thread gets going it will be useful for this kind of stuff. In the mean time, here are my two cents. (Thank you for mentioning Zork by the way, I feel incrementally less old.)

Four stats and four classes are nice numbers for keeping it simple with a roguelike type game. I'm not sure they're enough to support a feature length JRPG but for now I'll work with what you gave me.

Your mage having more health than your tank is just FUCKING WEIRD. (Since you're new, let me clarify: not yelling at you, I just enjoy capslock and swearing.) So is your archer having more health than both of them. Still, I'm using your stats as-is for the below.

Here are some basic thoughts towards an (intentionally dumbed down) formula. Personally, I like simple formula that can be easily grasped at a glance and that means small numbers. The Final Fantasy series' formulas with their "let's multiply everything by 512 and divide everything by 256" bullshit irk me.

Note I'm not bothering with to-hit formulas, just damage formulas for now. And I'm skipping mage because you do not have a magic stat that I can see and you need one.

Formulas by Class & Combat Options:

Assume all defense formulas also include any bonuses from armor.

Thief:
* Light Attack: (Strength + Weapon POW + Level) x Speed - (Enemy Defense + EnLevel)
Base Damage @ 1st Level w/ POW 2 Weapon: 16 -(EnDef + EnLevel)
* Cautious Attack:: (Weapon Pow + Level) x Speed - (Enemy Defense + EnLevel) plus the Thief's defense is doubled until the start of his next turn.
Base Damage @ 1st Level w/ POW 2 Weapon: 6 - (EnDef + EnLevel)
* Mug: (Strength + Level) x Speed - (EnDef + EnLevel) plus the thief steals a random item from the enemy.
Base Damage @ 1st Level: 12 - (EnDef + EnLevel)

Dragon Tamer
* Light Attack: (Strength + Weapon POW + Level) - (Enemy Defense + EnLevel)
Base Damage @ 1st Level w/ POW 2 Weapon: 13 - (EnDef + EnLevel)
* Cautious Attack: (Weapon Pow + Level) - (Enemy Defense + EnLevel) plus the Tamer's defense is doubled until the start of his next turn.
Base Damage @ 1st Level w/ POW 2 Weapon: 3 - (EnDef + EnLevel)
Base damage @ 7th Level w/ POW 9 Weapon: 16 - (EnDef + EnLevel)
* Heavy Attack: (Strength + Weapon POW + Level) x 2 - (Enemy Defense + EnLevel). Dragon Tamer's Speed is halved until the start of his next turn.
Base Damage @ 1st Level 1/ POW 2 Weapon: 26 - (EnDef + EnLevel)
* Reckless Attack: (Strength + Weapon POW + Level) x 3 - (Enemy Defense + EnLevel). Dragon Tamer's Defense is halved until the start of his next turn.
Base Damage @ 1st Level w/ POW 2 Weapon: 39 - (EnDef + EnLevel)

Archer
* Quick Shot: (Strength + Speed + Weapon POW + Level) - (Enemy Defense + EnLevel)
Base Damage @ 1st Level w/ POW 4 Bow: 15 - (EnDef + EnLevel)
* Power Shot (Strength + Speed + Weapon POW + Level) x 2 - (Enemy Defense + EnLevel) Archer's Speed is halved until the start of his next turn.
Base Damage @ 1st Level w/ POW 4 Bow: 30 - EnDef + EnLevel
* Piercing Shot (this one's a little complicated):
(Strength + Weapon POW) - (Enemy Defense + Enemy Level) - (Attacker Speed + Attacker Level)
Archer's Defense is halved until the start of his next turn.
Base Damage @ 1st Level w/ POW 4 Bow: 8 - (EnDef + EnLevel) - (Speed + Level).
So a first level archer would be making his attack against whatever the enemy's defense normally is minus seven for a piercing shot.

Now obviously to introduce more damage variance/randomness you can make every instance of 16 a "d16" (i.e. rand 1..16) and so on if you want.

Lookit this carefully and let me know what you think. (The first thing you should probably notice is that only the thief uses a stat as a multiplication factor, and that factor is Speed. Probably, this translates to "Speed should cost 2 points for every 1 point other stats cost for thieves on a game balance level).

I hope any of that was helpful!

Which stringed instruments if any do you play?
author=StormCrow
trippy-chords, welcome and what's up!

What engine are you using first off? Always include that in any help thread.

So, hopefully if and when this thread gets going it will be useful for this kind of stuff. In the mean time, here are my two cents. (Thank you for mentioning Zork by the way, I feel incrementally less old.)

Four stats and four classes are nice numbers for keeping it simple with a roguelike type game. I'm not sure they're enough to support a feature length JRPG but for now I'll work with what you gave me.

Your mage having more health than your tank is just FUCKING WEIRD. (Since you're new, let me clarify: not yelling at you, I just enjoy capslock and swearing.) So is your archer having more health than both of them. Still, I'm using your stats as-is for the below.

Here are some basic thoughts towards an (intentionally dumbed down) formula. Personally, I like simple formula that can be easily grasped at a glance and that means small numbers. The Final Fantasy series' formulas with their "let's multiply everything by 512 and divide everything by 256" bullshit irk me.

Note I'm not bothering with to-hit formulas, just damage formulas for now. And I'm skipping mage because you do not have a magic stat that I can see and you need one.

Formulas by Class & Combat Options:

Assume all defense formulas also include any bonuses from armor.

Thief:
* Light Attack: (Strength + Weapon POW + Level) x Speed - (Enemy Defense + EnLevel)
Base Damage @ 1st Level w/ POW 2 Weapon: 16 -(EnDef + EnLevel)
* Cautious Attack:: (Weapon Pow + Level) x Speed - (Enemy Defense + EnLevel) plus the Thief's defense is doubled until the start of his next turn.
Base Damage @ 1st Level w/ POW 2 Weapon: 6 - (EnDef + EnLevel)
* Mug: (Strength + Level) x Speed - (EnDef + EnLevel) plus the thief steals a random item from the enemy.
Base Damage @ 1st Level: 12 - (EnDef + EnLevel)

Dragon Tamer
* Light Attack: (Strength + Weapon POW + Level) - (Enemy Defense + EnLevel)
Base Damage @ 1st Level w/ POW 2 Weapon: 13 - (EnDef + EnLevel)
* Cautious Attack: (Weapon Pow + Level) - (Enemy Defense + EnLevel) plus the Tamer's defense is doubled until the start of his next turn.
Base Damage @ 1st Level w/ POW 2 Weapon: 3 - (EnDef + EnLevel)
Base damage @ 7th Level w/ POW 9 Weapon: 16 - (EnDef + EnLevel)
* Heavy Attack: (Strength + Weapon POW + Level) x 2 - (Enemy Defense + EnLevel). Dragon Tamer's Speed is halved until the start of his next turn.
Base Damage @ 1st Level 1/ POW 2 Weapon: 26 - (EnDef + EnLevel)
* Reckless Attack: (Strength + Weapon POW + Level) x 3 - (Enemy Defense + EnLevel). Dragon Tamer's Defense is halved until the start of his next turn.
Base Damage @ 1st Level w/ POW 2 Weapon: 39 - (EnDef + EnLevel)

Archer
* Quick Shot: (Strength + Speed + Weapon POW + Level) - (Enemy Defense + EnLevel)
Base Damage @ 1st Level w/ POW 4 Bow: 15 - (EnDef + EnLevel)
* Power Shot (Strength + Speed + Weapon POW + Level) x 2 - (Enemy Defense + EnLevel) Archer's Speed is halved until the start of his next turn.
Base Damage @ 1st Level w/ POW 4 Bow: 30 - EnDef + EnLevel
* Piercing Shot (this one's a little complicated):
(Strength + Weapon POW) - (Enemy Defense + Enemy Level) - (Attacker Speed + Attacker Level)
Archer's Defense is halved until the start of his next turn.
Base Damage @ 1st Level w/ POW 4 Bow: 8 - (EnDef + EnLevel) - (Speed + Level).
So a first level archer would be making his attack against whatever the enemy's defense normally is minus seven for a piercing shot.

Now obviously to introduce more damage variance/randomness you can make every instance of 16 a "d16" (i.e. rand 1..16) and so on if you want.

Lookit this carefully and let me know what you think. (The first thing you should probably notice is that only the thief uses a stat as a multiplication factor, and that factor is Speed. Probably, this translates to "Speed should cost 2 points for every 1 point other stats cost for thieves on a game balance level).

I hope any of that was helpful!

Which stringed instruments if any do you play?
Thank you for your reply! I'm not using an engine, I'm coding everything in python and using the terminal/command line. I actually have more stats than that but I just left them out because I figured those were the only ones you needed for this type of thing (considering damage and strength) Also, they aren't the final stats, I just went through and added them in so I could test the effects they would have/the level up.
I can't even begin to grasp the formulas you provided as I'm so beyond tired but i'll review them when my mind isn't so hazy

I play guitar :D What made you want to ask that?

P.S Here are all of the stats, I'm just going to copy and paste from my class so, sorry for the code format of it.
(EXAMPLE BEING MAGE)
self.strength = 4
self.dexterity = 5
self.intelligence = 10
self.charisma = 3
self.stealth = 2
self.speed = 1
self.defense = 7
self.mana = 15
self.luck = 5
the values of the stats are really just place holders for now. I've been working on the functionality of everything
I play guitar :D What made you want to ask that?

Your username, and also I nominally play bass guitar (although my life has been too hectic to practice for months and months and I'm really not happy about that). I actually have a lot of natural talent on the bass, I think (it is the only musical instrument I've picked up in my life that I've felt like I had any inherent aptitude for, certainly not guitar although not for lack of trying, I was playing more on than off for at least a year and never even managed to get down the GODDAMNED F CHORD but I digress), it's just all being squandered because the day doesn't have enough hours in it for work/chores/pets/gamedev/writing already w/o factoring in the bass. Any free time I'd otherwise spend practicing bass I'm just too wiped out to do anything but play videogames.

Sorry, plz excuse the tangent, carry on discussion of formulas. (I always want the plural of formula to be formulae because it sounds cool, but it isn't.)
Pages: 1