Formulas, Math, and theories for RPG combat/leveling systems?

Started by
5 comments, last by BedderDanu 9 years, 7 months ago

I was giving some thought to making a simple RPG; ideally an old-school JRPG for all intents and purposes.

Developing the math behind the combat systems and the level systems is going to be a bit tricky, and I'm wondering if there are any good sources, guides, tutorials, or other materials that give some good guidance as to how a solid RPG system can be created.

It's easy to identify the basics. Strength to increase attack, defense to reduce damage, agility, experience, blah blah blah.

But when the rubber hits the road, it's hard to find numbers that work very well across a wide range. What kind of equation should one use to calculate the actual damage, just between the strength and defense variables? I recall playing with an RPG for the playstation, and I found that if I gave the enemies defense values like what the player has, the player did absolutely pitiful amounts of damage. Thus I was prompted to keep the defense values low. But doing that negates the effectiveness of spells and status-afflictions that reduce/enhance someone's defense, because now the defense is already low to begin with.

And altogether, it was just too easy to set someone's stats to make combat impossible if your players are at the wrong levels. If you are too weak for some monsters, you can't do any damage to them at all. I'm not saying it would be a hard and arduous fight that requires a lot of planning, I'm saying you can't even touch those monsters. Then after getting one new piece of equipment or gaining just one level, suddenly they are possible.

I don't even know what equations they were using, but it was hard to keep those numbers in the butter-zone, and there being a butter zone was a problem as well.

So I'm wondering what sort of formulas I can follow to make combat reasonable -even if extremely difficult- when combatants are outside of that butter-zone.

Or at least a good understanding of where that butter-zone is so I can reasonably project good numbers instead of spending all my development doing trial-and-error.

And going along with that is the leveling system. How much experience should it take to get to a new level, and how do I make sure that the player fights monsters at an appropriate level, instead of finding it better to keep fighting weaker monsters from an older area? How much does a player's stats increase with each level to make their leveling be useful, but not also cause huge rifts in stats that make (for example) a mage become comparatively weaker each level, because the attack power is too low?
And along with the leveling is setting up weapons and armor so that getting new equipment is helpful, but not a complete game-changer.

There's a lot of things that go into this to make these systems work. I'm pretty sure someone somewhere has a good set of patterns to follow or general advice or something. But I couldn't find it on a google search. (Maybe I'm using the wrong keywords; I don't know.) I figure there are a lot of different ways to approach this, and the exact numbers you'd want are going to depend heavily on things like how many battles you want you player to fight to gain a level, how great of a difference do you want one level to make, how long do you want a battle to last, how capable will the player be against an low-level enemy, and of course, how will the unique system you create for your game effect these variables. So I don't expect there to be one single system to follow, but it would be very useful to get an idea of how to approach these things.

Read my webcomic: http://maytiacomic.com/
Follow my progress at: https://eightballgaming.com/

Advertisement
Back in the past, when I was playing World of Warcraft way to much, and started philosophing too much about the meaninglessness of it all inside the game, I was thinking about how most aspects of the game in many way seemed to be statistically engineered to take a certain amount of time. Time was the ruling/domintaing/deciding factor, in everything, it seemed.
Thinking about this further has just made me even more convinced, time indeed seems to be the leading, or common factor, whether it is intentional, or by design.
What I mean is...
It takes a certain amount of time to reach a certain level, It takes a certain amount of time to beat down a certain enemy (being a certain level from you), it is even imposed a artificial delay in crafting things, travelling takes time, certain quests is endless walking back and forth, there are probably a lot more things I have forgotten about, but there are a lot of time sinks. Time seems on _average_ to be the factor in everything you do in such a game, and I am convinced that it is by design, but I might of course be wrong, and even if it was not done by design, it would be like this either way, because no matter how you design something, there will be an average time for everything.
So based on time, how can you balance such a game?
Say you just pick damage for a level 1 hero to be around 3-6 damage. That is (3+4+5+6)/4 = 4.5 damage per hit on average. Say you have a slow weapon, that you can hit with every 1.5 second. That makes 4.5 / 1.5 = 3 damage per second.
Say you want an encounter with a monster to last 10 seconds on average. That would be 3 damage * 10 seconds = 30 monster health points. (Edit: you probably need to add one more hit to the monster, if you want to define the encounter as started on the first hit.)
You see where I am going with this. Time is in everything. Of course my example is over-simplified, but you can add in shields, protection, magic, anything, and still measure it up against time, and it will all be the same, but expressed in a very complicated way.
How boring is that now? You could just make a game where you were hitting some object for 10 seconds, and randomly on occasion let you die instead of the monster, and you would have the same kind of mechanics, of course ignoring the fact that you can use tact and cleverness to get an advantage.
Of course, that is a joke. It is the complexities of the indirections that makes the game fun, although it is possible to see it this way.
Edit:
The same thinking would go for experience. If you want to level up in one hour for the first level, you could start by giving 1 experience for the early monsters. Say it takes about 10 seconds to find a new monster to kill in a certain area. That makes 20 seconds per 1 experience. One hour is 60 * 60 = 3600 second. Divide by 20 and you have got 180 experience to level up. Although this seems a bit much for a first level-up, you just need to tweak the time you want to get a new figure.

I think it less about math, and more about keeping the balance between boring and frustrating.

http://uxmag.com/articles/the-good-tough-problem

The challenge will be to maintain this rise in difficulty so beginners don't get frustrated and hard-core gamers don't get bored. There may not be any equations that you can come up with to make this work.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

I've always been a fan of multiplicative percentages and logistic functions. Basically, you work backwards from your "Butter Zone" to the values that you need.

Basically, you find some way of determining a flat damage (strength, weapon power, etc.) and then you use logistic functions to scale your other defenses to between 0 and 1.

Once you have this, you can turn this into multiplication/addition of percentages to find the actual damage dealt.

so, lets say that, using DnD terms, you have +10 damage to strength and a 2d6 variable damage sword. So your potential outlay of damage is 12-24. You roll "20" damage.

In this system, you are using a sword, which gets bonus damage based on dex. You have 307 dex, which gets plugged into your logistic function of "1/(1+EXP(-DEX/255))" and comes out to 76%. In addition, you are considered "Practiced" with a sword, which is a straight 10% bonus. Your total potential damage is 20 * (1 + 76% + 10%) = 37 Damage.

However, your enemy is wearing chainmail (12 AC), which means he has a percentage reduction of 37%. (12 / (12 + 20) = .375) In addition, chainmail is resistant against slashing weapons, so that's worth a flat 5% reduction. Making the total reduction against your attack 40% (1 - (1 - 37%) * (1 - 5%) = .402).

This means that the net damage is now 37 * (40%) = 15 Damage.

what's nice about this is that you can manipulate the constants to make almost any range of values fit within the "Butter Zone", and can easily stack multiple effects together without having the numbers run away from you.

BedderDanu touched up on this, but it didn't dawn on me until last night.

As I had mentioned in my first post, I was worried about creating a system where people with attack values too low could not do any effective damage against an enemy.

I've seen this in a number of RPGs, actually. For many levels a character can't do more than two points of damage. Then they make a sharp increase, suddenly able to do small but noticeable amounts of damage, and then able to inflict the expected amount of damage.

I never liked this, because it doesn't make fighting a powerful foe challenging, but completely impossible.

But this problem is worked around by simply having the defense modify the attack value by a percentage

I want to phrase this more explicitly.

You perform all the desired calculations for damage, and then at the last step the defense shaves off a percentage of that value. For example, if the maximum possible defense was 100 (or rather, 99, but you calculate it as 100) then a defense of 15 would reduce all attacks by 15%. If the maximum possible defense was 256 (technically 255) then a defense of 128 would reduce all attacks by 50%.

That way, even if you attacked a high-level monster you would still deal some damage. Furthermore, the defense of the monsters themselves is relatively arbitrary. A level-one monster could have a defense of 50% or 10% and would still be just as accessible to a first-level player.

Read my webcomic: http://maytiacomic.com/
Follow my progress at: https://eightballgaming.com/

IMHO If you want low level players/monsters to have a chance against higher level ones, then you should rely less on stats and add more depth and strategy to your combat system. This is in fact the only way a weaker individual can beat a stronger one in real life too. If you have to fight with a boxer, you try to stay at the distance. If you are fighting with someone with a gun, you hide and try to disarm or use surprise or..

Also remember, I'm talking about using functions that scale any range of values between 0 and 1 (0% and 100%)

When used like this, there is no "maximum defense" in a strict sense.

If defense is AC/(AC + 100), then 50 AC gives 33%, 500 gives 83%, 5000 gives 98%, and 50000 gives 99.8%.

However, if I change that value of 100 to 750, the same scale becomes

50->6%, 500->40%, 5000->86%, 50000->98%

So the first value supports ranges up to a few thousand, while the second supports up to tens of thousands. Roughly.

This also plays into the strategy department. I'm playing around with an "easy" way to implement elemental resistances.

Reduction = AC/(AC + 100 - RES)

RES = Resistance/(Resistance + 10)

So the more Resistance you have, the more effective your armor is against that element. In the above, 10 Resistance means you have twice the armor value vs those attacks.

You can also hit the stats involved with the calculations with penalties, or skip a multiplication step, or whatever and the system is pretty robust to those changes.

For example:

300 damage vs AC of 150 gives 120 damage

200 damage vs AC of 150 with a 50% armor penalty gives 114 damage.

300 damage vs AC of 500 gives 50 damage

200 damage vs AC of 500 with a 50% armor penalty gives 57 damage.

So this means it's easy to build in things that skip or ignore defenses.

You still need to control your numbers, but these types of formula make it easy to control the range of values that your system can handle, and what changes to those numbers actually mean.

EDIT:

Remember combining percentages. That's important.

So you have an armor equation of AC/(AC + 100), and some sort of resistance equation of RES/(RES + 10).

You have a character with 75 armor, and 15 fire resistance. You are hit with some sort of fire attack, dealing 500 damage.

Your armor blocks 75/(75+100) = 42%, and you resist 15/(15+10) = 60%. Your total resistance becomes 1-(1-42%)*(1-60%) = 76%

Therefore, you only take 116 damage.

This is how you get varying stat ranges to combine nicely into huge "Butter Zones"

This topic is closed to new replies.

Advertisement