Sign in to follow this  
blueful

Battle System (The Maths)

Recommended Posts

Hi, I suspect you may get this kind of question a lot, and I've had a look through some of the previous threads on this subject that I could find, but obviously it's not that easy to always use other systems because most games are different, so I will outline mine in the hope that someone may be able to help, as I'm struggling with this (maths isn't exactly my strong point). So, these are some stats involved: Skill Strength [Those two are only going to affect what weapons you can equip, not affect the hit damage] Weapon Power Weapon Accuracy Combat Level Defence (The total of the defence scores of each item you have equipped) Hitpoints Then for the monster: Monster Power Monster Accuracy Monster Defence Monster Combat Level Monster Hitpoints Now, to give you an idea of the sort of stats that people are going to have: At the start of the game you would have the following stats: 1 Combat Level 4 Hitpoints And the weapon scores would probably be: 1 Weapon Power 2 Weapon Accuracy Then, for example at CL 15 it might be something like: 15 CL 12 Hitpoints 13 Weapon Power 13 Weapon Accuracy The monsters/enemies would have similar stats to the player at those Combat Levels, eg a enemy might have: CL 15 15 Hitpoints 14 Power 12 Defence Now, the system I have in place at the moment is using those Skill and Strength attributes i mentioned earlier to make a big difference to the hit, but they can get quite big quite fast so people are able to 1-hit kill things very easily and never have the need to use any food to replenish HitPoints, so I want to change it so it only uses Combat Level and weapon stats. I have tried a few basic things such as: MaxHit = ceil((CL / 4) + (WepPow / 6)) Things like that, but it's not right at all really, it never balances out. Eg: There's only 2 difference in MaxHit between CL 1 and CL 15, or then i change it and there's only 2 difference in MaxHit between a weapon with 5 power and one with 20 power, etc... So what I am looking for is a system/algorithm that takes those things into account and creates a balanced damage score (Also taking into account MonsterDefence and YourAccuracy as well). If anyone has any ideas/examples/etc... that would be of help to me, I would greatly appreciate it. Thank you.

Share this post


Link to post
Share on other sites
Unfortunately there is no magic solution for this: what is 'balanced' is entirely up to you. A solution that works for a D+D style game of soaking up lots of damage is completely inappropriate for a gritty and realistic one-shot-kills game.

You need a grasp of probability for this task - no way around that. You have to look at the sort of stat values you want in your game, and the sort of probabilities you want to see. For example, decide how often you want a level 1 person to be able to hit another level 1 person, on average. That in turn is meaningless without having decided on the typical outcome of a successful hit, which itself depends on how you're handling damage and how much can be taken. These are arbitrary choices you make to fit your game design.

Basically then the process should be to assume average values across the board, and run through a few tests (programmatically or mentally) to prove that it plays the way you expect. Start with as few stats as you possibly can to get the system going. Then try varying 1 parameter and check that the system changes in the way you'd expect. Repeat for all parameters, only adding new ones when the others are balanced.

Share this post


Link to post
Share on other sites
One option is instead of making up formulas, use a table. For example a table of weapon accuracy vs target level which stores the hit chance. You can then customize that table to suit your needs. As long as the range of values isn't too big then a 2D table is easily manageable. You could also try a 1D table indexed off the difference between the two values.

Another thing to consider is storing all the values as floating point rather than integers. That way you don't get the big jumps in effectiveness going from doing 1 damage to 2 damage, you can do 1.5 damage or whatever in between that to smooth the transition.

To solve the specific problem of damage output being too high then the obvious options are reduce damage done, or increase hit points. Since you've tried the reducing damage option I'd go with bumping up hit points.

Share this post


Link to post
Share on other sites
Quote:
Original post by blueful
Hi,

I suspect you may get this kind of question a lot


We do. The reason is that it requires Thinking(TM), and one size does not fit all (or even most).

Quote:

1 Combat Level
4 Hitpoints

And the weapon scores would probably be:

1 Weapon Power
2 Weapon Accuracy


Then, for example at CL 15 it might be something like:

15 CL
12 Hitpoints
13 Weapon Power
13 Weapon Accuracy


The monsters/enemies would have similar stats to the player at those Combat Levels, eg a enemy might have:

CL 15
15 Hitpoints
14 Power
12 Defence


You might find it easier to get workable numbers if you let "hitpoints" be significantly larger than the other three numbers in general.

Quote:
Now, the system I have in place at the moment is using those Skill and Strength attributes i mentioned earlier to make a big difference to the hit, but they can get quite big quite fast


Why not use Skill and Strength to make a small difference to the hit, then? :)

Quote:
Things like that, but it's not right at all really, it never balances out. Eg: There's only 2 difference in MaxHit between CL 1 and CL 15, or then i change it and there's only 2 difference in MaxHit between a weapon with 5 power and one with 20 power, etc...


Some systems get a lot of mileage out of simply subtracting a corresponding defender's state from the attacker's stat to get a net advantage that is used for the calculations.

Quote:
If anyone has any ideas/examples/etc... that would be of help to me, I would greatly appreciate it.


[Google] has a zillion examples. Just put in the name of a game you like, and add something like "damage calculations" or "game mechanics". Tactics and RPG games are especially good for this (imagine that).

Share this post


Link to post
Share on other sites
Okay thanks, i'll have a look and see if i can find any using the "Damage Calculations" search term.

I'm pretty sure i've made up my mind on my system now though. In case anyone is interested, I decided to go along the lines of:


pow = Pow scores of all items equipped
acc = Accuracy scores of all items equipped
cl = combat level

maxHit = ((cl + pow) / 3) * 0.92
acc = ((acc + cl) / 3) * 0.87

chance = rand(0, acc)

if chance == 0
miss
end if;

if acc > (enemyDef * 2)
hit = rand((maxHit * 0.75), maxHit)


else if(acc > enemyDef)
hit = rand((maxHit * 0.5), (maxHit * 0.75))

else if((acc * 2) > enemyDef)
hit = rand((maxHit * 0.25), (maxHit * 0.5))

else
hit = rand(0, (maxHit * 0.25))

ceil(hit)

And then the same for the enemy's hit, using it's pow and accuracy, and your def, etc...

Share this post


Link to post
Share on other sites
How do you want the system to turn out?

"A level 5 warrior fighting a level 5 monster should, on average, last 10 rounds. The warrior should win 80% of the fights."

"A level 5 warrior with high strength should last, on average, 8 rounds but still win 80% of the time."

"A level 10 warrior fighting a level 10 monster should last, on average, 15 rounds."

"A level 10 warrior fighting a level 5 monster should last 5 rounds, and win 95% of the time."

Those can give you some good starting points for what your calculations should look like.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this