• Create Account

## How To Make Combat Formulas Work Better ?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

9 replies to this topic

### #1Code Fox  GDNet+

3039
Like
1Likes
Like

Posted 14 July 2014 - 11:59 AM

I have been running combat simulations on and off for the last couple days, and I have been having issues making every thing "work" together to create a smooth running system.

Here is what I have, maybe someone can figure out a better system than what I have.

( this is real time combat )

Combat Level - derived from several of the base skills ( haven't figured out a good way to calculate this yet )

HP - health ... regenerates based on combat level

MP - magic ... regenerates based on combat level

RP - religion ... regenerates based on combat level

Strength - how hard something can hit

Accuracy - percent added to damage

Agility - percentage chance of dodging some or all of an attack

Defense - amount of damage that can be absorbed

Armor - percentage of damage that can be absorbed

Luck - positive or negative random effect

* A difference of 3 or more combat levels between the combatants will change percentage of damage dealt and damage taken

* The level of MP & RP is the attack and defence level.

Hit Given =  (Strength * (Accuracy bonus + luck) ) * combat level difference penalty or bonus percentage

Hit Taken = (Hit Given - ( (Defense * armor bonus) * (agility bonus + luck) ) ) * combat level difference penalty or bonus percentage

Edited by Shippou, 14 July 2014 - 12:01 PM.

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

### #2kseh  Members

3601
Like
3Likes
Like

Posted 14 July 2014 - 02:46 PM

What formulas have you tried and in what way did they not "work"?

In what ways do you expect player affects the stats that you have available?

Most importantly, how do you want a typical example of combat play out? What can a player expect to happen more often than not?

Given the experience that you know you want the player to have throughout the course of the game, can you find a way to make the numbers represent that experience and continue to represent that experience as the game progresses?

Edited by kseh, 14 July 2014 - 02:47 PM.

### #3frob  Moderators

41243
Like
7Likes
Like

Posted 14 July 2014 - 03:40 PM

POPULAR

Balancing the systems is difficult.

Most games work on probability curves, not just the high and low points. Take some times with games that expose their mechanics, such as table top games like D&D. They tune their dice rolls to adjust probability curves. 4d6 has a very different curve than 2d12 or 2d10+1d4.

Trying to figure out a good system to increase the player stats over time yet still maintain balance is a very hard job. Good game designers spend many years of their lives studying the subject just like you spend your time studying programming. During game development while you are spending your thousands of hours writing code they spend a similar amount of time tuning the design.

A solid, balanced, fun system isn't something they just make up on the spot. It usually requires many months of effort.

It is also a defining feature of most games. Exactly how the systems interact is game specific. You'll need to tune it so it visually and conceptually matches your world. Thinking in terms of dungeon crawlers, a simple short knife can be a poor weapon in the hands of a berserker, but a thief should be able to amass a huge kill streak with the same weapon.

My recommendation is a large collection of data tables that can be reloaded at runtime, and many hundred hours of tinkering.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.

### #4slicer4ever  GDNet+

6354
Like
3Likes
Like

Posted 15 July 2014 - 06:04 AM

Looking at your hit recieve/given formulas, i'd be suprised if you can do any signifigant damage wothout having massive high strength or accuracy.

First of all, you have 4 terms to absorb damage, and only 3 terms to apply damage, which makes it far easier to absorb damage then to deal it out.

Secondly why does accuracy factor into amount of damage dealt?

Increasing any of these terms causes the same level of increase across the board, i'd recommend adding weighted terms to each attribute so that certain attributes will have a larger/smaller affect on damage then others. Then tuning these weights can make it easier to find a sweet spot where things seem adequatly balanced.

Edited by slicer4ever, 15 July 2014 - 06:08 AM.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

### #5GoCatGo  Members

1653
Like
0Likes
Like

Posted 15 July 2014 - 06:24 AM

Combat Level - derived from several of the base skills ( haven't figured out a good way to calculate this yet )

Since so many important numbers regenerate based on this one attribute, I'd say that finding a solid calculation is of the utmost importance.  None of the combat/dodge/absorb tests matter much if you are just regenerating health like the Wolverine on RedBull.

Indie games are what indie movies were in the early 90s -- half-baked, poorly executed wastes of time that will quickly fall out of fashion.  Now go make Minecraft with wizards and watch the dozen or so remakes of Reservior Dogs.

### #6Navezof  Members

1737
Like
2Likes
Like

Posted 15 July 2014 - 09:55 AM

My recommendation is a large collection of data tables that can be reloaded at runtime, and many hundred hours of tinkering.

Excel (or open office) can be a very powerful tool here. And with some macro you can make your own basic "testing machine" that give you tables and graphics.

As a general advice, maybe try to figure out the general direction you cant to go, determine the maximum and minimum and adjust from here. For exemple you want that an average level 5 can kill a level 1 in three attack, so adjust the stats until you get this result in your simulations.

You also want two character level 5 with the same equipment and exact opposite stats (offensive, defensive) to be evenly matched. (except if you want otherwise)

About what you are exposing here, I think that the combat level can be redundant. As he is determined by your other stats, if you are already stronger than you opponent why using the combat level as a bonus?

I would also use two phases for the fight (and as said slice4ever, you have 4 defensive stats, and only 3 offensive, is this intended?)

Phase 1 : does the attack connect?

If Accuracy > Agility then the attacker touch the defender
if Strength > Defense then the attacker touch the defender

Phase 2 : how many damage are dealt?

With Damage being another stat, weapon damage, or else

Damage dealt = Damage - Armor

Or something like that.

Edit : typo

Edited by Navezof, 15 July 2014 - 09:55 AM.

### #7BedderDanu  Members

292
Like
0Likes
Like

Posted 16 July 2014 - 02:51 AM

My go to thought on something like this is that I want Robust mathematical formula, so that as long as the interacting parts have approximately similar numbers, everything kind of works out.

Using what you have here, I'd probably go something like this:

Damage = Strength

Reduction = Armor / (Armor + 100 - Defense) [ -10 < Defense << 100, 0 < Armor < 400]

Dodge = (1 + Accuracy) * (1 - Avoid) [ 0 < Avoid < Accuracy < 1]

Hit Taken = Damage * Reduction * Dodge

Something like this can take huge variance in inputs, and the results will still make sense. This allows you to experiment with your base values to find what fits best

Edited by BedderDanu, 16 July 2014 - 04:57 AM.

### #8V3ntr1s  Members

587
Like
0Likes
Like

Posted 16 July 2014 - 07:32 AM

Excel is really powerful for stuff like these.

Here are some formulas:

Player HP =(100*vitality)+(50*strength)

Boss HP =300*hero lvl

Player P Attack Power =5*(strength+accuracy+dexterity)

...

simulate fight and show you how many attacks you need to kill boss

physical_dmg =Boss_HP/(Player_P_Attack_Power + weapon_dmg - Boss_P_Defense)

...

I made this for my small text based RPG for learning purpose, i didn't have areas for monster levels but at the same time i wanted game to be challenging so i came up with linking hero level to rise monster difficulty.

It's far from balanced game but it's still balance

Hope it helps...

edit: tried to put table from excel but i can't sry...

Edited by V3ntr1s, 16 July 2014 - 07:41 AM.

### #9Osidlus  Members

1076
Like
0Likes
Like

Posted 16 July 2014 - 04:21 PM

do I understand your thought process correctly?

Hit Given =  (Strength * (Accuracy bonus + luck) ) * combat level difference penalty or bonus percentage

V                                                                   V

average dmg landed                             corrector based of fighting skill maturity

Hit Taken = (Hit Given - ( (Defense * armor bonus)     *    (agility bonus + luck) ) ) * combat level difference penalty or bonus percentage

V

average absorbing layer

over body from the armour

So what I am missing is basis for the average dmg landed it should be like 60% to hit (agility+luck)10 for example. It seems you inherently feel it thus the corrector. I would make the corrector based on comparison the basis with monsters (agility+luck) and start increasing that basis for the average dmg landed with Combat level. Armour bonus should be 0 - 1 where 1 means that the armour covers whole body.

What I dont like on your system is that you have two qualities - ability to hit and amout of dmg dealt and you are melting it into one quality average dmg landed. This makes characters generic...

Edited by Osidlus, 16 July 2014 - 04:31 PM.

### #10Ashaman73  Members

13649
Like
1Likes
Like

Posted 18 July 2014 - 01:38 AM

I have been running combat simulations on and off for the last couple days, and I have been having issues making every thing "work" together to create a smooth running system.

Here is what I have, maybe someone can figure out a better system than what I have.

( this is real time combat )

Combat Level - derived from several of the base skills ( haven't figured out a good way to calculate this yet )

HP - health ... regenerates based on combat level

MP - magic ... regenerates based on combat level

RP - religion ... regenerates based on combat level

Strength - how hard something can hit

Accuracy - percent added to damage

Agility - percentage chance of dodging some or all of an attack

Defense - amount of damage that can be absorbed

Armor - percentage of damage that can be absorbed

Luck - positive or negative random effect

* A difference of 3 or more combat levels between the combatants will change percentage of damage dealt and damage taken

* The level of MP & RP is the attack and defence level.

Hit Given =  (Strength * (Accuracy bonus + luck) ) * combat level difference penalty or bonus percentage

Hit Taken = (Hit Given - ( (Defense * armor bonus) * (agility bonus + luck) ) ) * combat level difference penalty or bonus percentage

Take a step back and discard as much as possible until you have no more things left, which you can take away without collapsing the combat system.

Example:

Hp - keep it

Mana,Relegion,Strength - just let's call it power for now (=how hard did an attack hit,regardless of its nature).

Accuracy- ditch it, just an modifier of damage, damage is derived from power

agility,defense,armor - just let's call it defense for now (=how good are you to avoid damage)

luck - random seed modifier, ditch it

Leaving for just combat related stuff:

Hp, Dmg, Def

While power is something special, either it is a resource like hp for casting spells etc. or it modifies the dmg output.

Now start building a simple system relying on these attributes, something like this:

hp' = max(0,hp - dmg/(1+def))

Now you need to think about a basic balancing. Start to set a fix value for one value, like hp is always 100. Then think about what avg dmg/def values would make sense to have a combat situation, like if you have X dmg and half of it as def, the defender should survive 5 hits.

The next step is to consider the effect of your combat level on the formula. Don't make it to complex. A linear effect would be a good start,something like this

hp'=max(0,hp*cl_d-dmg*cl_a/(1+def))/cl_d

with cl = combat_level factor, for attacker (cl_a) and defender (cl_d), if cl_a=cl_d, then you get

hp'=max(0,hp*cl_a-dmg*cl_a/(1+def))/cl_a=max(0,hp-dmg/(1+def))

Bevor we differentiate between different, more detailed attributes, add some modifiers, just ignore the combat level because it is linear:

hp'  = max(0, hp*f_hp - dmg * f_dmg / (1+def * f_def))/f_hp

This way you have the option to handle different combat situation more gracefully:

1. example:  a spell, which protects you vs 50% of any incoming dmg =>f_hp=2

2. example:  a spell, which ignores any defense value => f_def = 0

Now you can begin to differentiate between different influences on the basic attributes, that is, you derive the basic combat stats like hp,dmg,def on-the-fly, example:

dmg

= strength * factor * weapon_base_dmg, if basic melee attack

= magic * factor * spell_base_dmg, if basic spell attack

= relgion * factor * praying_base_dmg ...

Edited by Ashaman73, 18 July 2014 - 01:44 AM.

Ashaman

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.