RPG Formulas: "Infinitely" Scaling Damage

Been working on an idea for an RPG project for quite a long time now, but one thing I've constantly been hung up on is the damage formula. From my research, your typical damage formula comes in two basic forms:

A) Attack Power - Defense Power

and

B) Attack Power * (Defense Power / Max Defense Value)

... But, both come with their disadvantages.

With A, trying to damage high defense enemies just results in 0 damage. With B, by its very nature, there needs to be a maximum value defense can reach in order to conform to a percentage.

I don't want either of these ideally. With A, it's too simple, and it leads to just not being able to damage high defense targets. With B, you need a maximum value, and I don't want to have caps on any of my stats.

I was playing around with some ideas to scale damage with arbitrary values, but could only work out something decent for situations where attack is below defense. It completely broke when attack was higher then defense.

Ideally, I'd like a formula that has a baseline where when attack and defense are equal, potential damage is at 50%. When attack is less then defense, it should scale towards 0% the farther from equal they get, but never actually reach 0% (except when attack = 0, but that should never happen). The same goes for when attack is greater then defense, it should scale towards 100% but never actually reach it.

Is this kind of formula even possible? Or am I going to have to force some sort of arbitrary limit on my stats? Your input is greatly appreciated!
 

Mercerenies

Member
Yes, it is. There are several ways to do it, but let me demonstrate how to get to that answer.

You want damage to be half of the attack power if atk = def. You want damage to approach zero as defense increases. And obviously, you want damage to scale up as attack scales up. That gives us some things to work with.
Code:
(i) f(z, z) = z / 2
(ii) f(z, inf) = 0
(iii) f(inf, z) = inf
By (ii), my first thought is a rational function with defense in the denominator. By (iii), my first thought is to put attack in the numerator to increase it as the function increases. So f(x, y) = x / y. As for formula (i), you could get that by making the x be x^2 or xy. The main point here is that, to satisfy your requirements, you'll probably want a rational function, something of the form "attack divided by defense", with some possible exponents and coefficients thrown in for effect. You might play around with different multipliers and things. For example, a rational function fails if defense = 0. If you want to be able to have characters with defense = 0, you could use f(x, y) = x / (y + 1) to avert the problem.

E: I just noticed the last constraint. I didn't realize you wanted a maximal value in your function. In that case, the best you're going to get is a logistic curve, but the problem with that is that it's flat for most of the progression and only increases significantly in one place. I'd suggest removing the maximum damage constraint and going rational, but that's me.
 

SnoutUp

Member
I'd like to hear what others thing about this question too, because my own formula is a very basic, although it's close to what you need. I calculate ratio between defense and damage and allow up to 80% of DMG to be absorbed. If DMG is higher than DEF, the absorption percentage will be multiplied by that ratio. This simple thing works for me, because my DEF and DMG values are pretty close to each other and I mostly use this for enemy-to-player damage (enemies doesn't have defense at the moment, but probably will), so more can be cheated.
 
E: I just noticed the last constraint. I didn't realize you wanted a maximal value in your function. In that case, the best you're going to get is a logistic curve, but the problem with that is that it's flat for most of the progression and only increases significantly in one place. I'd suggest removing the maximum damage constraint and going rational, but that's me.
It may just be all the advanced math talk going over my head, but I actually DON'T want to cap any values, beyond the actual limits imposed by the data types of course. Honestly, while I have a good grasp of basic math, advanced math is a little beyond my skill set, so I honestly didn't follow most of what you said.

I'd like to hear what others thing about this question too, because my own formula is a very basic, although it's close to what you need. I calculate ratio between defense and damage and allow up to 80% of DMG to be absorbed. If DMG is higher than DEF, the absorption percentage will be multiplied by that ratio. This simple thing works for me, because my DEF and DMG values are pretty close to each other and I mostly use this for enemy-to-player damage (enemies doesn't have defense at the moment, but probably will), so more can be cheated.
Because of the defense issue being such a pain, I've been thinking of coming up with some other way of implementing damage reduction aside from straight up subtracting it. Haven't really sat down and thought about it yet though. Plus it would still ideally have to fit in a non-cap environment.
 

Mercerenies

Member
It may just be all the advanced math talk going over my head, but I actually DON'T want to cap any values, beyond the actual limits imposed by the data types of course. Honestly, while I have a good grasp of basic math, advanced math is a little beyond my skill set, so I honestly didn't follow most of what you said.
Let me clarify what I mean. There will be no capping of the attack or defense points. When I refer to capping, I mean that you speak like you want to cap the damage dealt at 100% of attack power, or moreover you never want someone to be able to inflict more power than their attack power permits. And in that case, you do have a cap; it's just that your cap is a variable.
 
I see what you mean now. with that in mind, and rereading what you wrote initially, I did actually have something along the lines you mentioned worked out, but it started to seem like with a large gap between attack and defense, which could conceivably happen, the high attack unit would end up doing more damage then it could with a defense ignoring attack. I did try just putting a cap on attack at 100%, but it felt like at that point defense was just being completely ignored, where I would rather it have some impact regardless of how much higher the other value was. I may end up having to come up with an alternative implementation of defense to fully satisfy the idea I have in my head.
 

Mercerenies

Member
And that's the problem, unfortunately. You said you don't have much advanced math under your belt, but you certainly seem to have a good intuitive grasp of functions. If you let your function grow unbounded, you run into the problem of a high attack eventually ignoring defense. If you block your attack power at 100%, attack increases will be ignored at a certain point. If you force your function to converge so that attack is limited at 100% asymptotically (that is, it approaches but never reaches 100%, which is what you're asking for, I believe), then you run into a new problem, and I'm going to shamelessly copy this diagram from Wikipedia to demonstrate my point.

This is the shape you'll end up with given the constraints you've requested. It's called a logistic curve; I mentioned it in my earlier post. The problem with this type of formula is that it's boring outside of a specific area. It may be an ideal function to use when the value is in between the bounds (in the middle of the picture above), but anything lower or higher than that is mostly just a flat, boring line, which amounts to leveling up not really making any difference.

So your choices are
(i) Rational function (ATK / DEF) - ATK will grow without bound, eventually making DEF negligible.
(ii) Rational function with max (min(ATK / DEF, 100%)) - Eventually, you'll hit 100% and future increases to ATK will be meaningless
(iii) Logistic curve (This formula is longer) - Level increases are only significant for a small range of ATK and DEF values.
You can pick your poison, but I can't think of a way of simultaneously avoiding all of these problems unless you use one of the archetypal RPG damage formulas mentioned in your OP, but as you pointed out those have their own issues as well. Ultimately, any formula is going to have its issues.
 

YanBG

Member
To damage the player i use enemy's attack/defense, the NPCs have no defence. Only issue is if at the start the defence is below 1 and the damage will be more than the usual attack amount. Not great but very simple.
 

Veyerals

Member
Here's a formula I came up with that you can try. I made it to solve a similar issue that you are having.

DAMAGE = ATK * (ATK / (ATK+DEF) )
Where ATK is the attacker's Attack power and DEF is the Defense power of the one getting hit.

At 0 DEF the target receives full damage from ATK
If ATK and DEF are equal then the target receives 50% of ATK
DEF needs to be several times higher than ATK to make the damage negligibly small which makes sense to me.
If ATK gets much higher than DEF, then the formula approaches the standard DAMAGE = ATK - DEF

Hope this helps!
 
@Mercerenies, it's looking like I'm going to have to sit down and come up with a different way to handle defense if I want to achieve what I have in mind. Having a bit more time to think about it, I don't really NEED to have attack and defense themselves scale infinitely, as its the level stat that will ultimately determine the majority of how much damage will be done. I'm not likely to have units with absurdly high values anyway.

@YanBG, I've tested that formula previously, and I didn't like how damage scaled when its greater then defense, as it allows the unit to do more damage then it could with "defense ignoring" attacks, in theory.

@Veyerals, I might try out the formula you gave to see how it scales. As I said earlier in the post, I'm not planning on having any absurdly high numbers, so it might just do the trick.

I haven't tried it out to see how it works, but the other idea I had was to have defense reduce damage to higher attack values in chunks. So for example, if 'attack / defense' was something like '2.5', attack would overcome defense completely for the '2' times it's greater then it, but 'defense' would still be applied to the remaining '.5', as if the '2' weren't there. Quick example with real numbers:

attack = 250
defense = 100
ratio = 2.5
mod attack = (250 * (2 / 2.5)) + (50 * 0.5) = 225

Edit: Nope. Looked like a good idea at first, but then I ran damage numbers for defenseless attacks, and they equal out every time attack / defense is an integer value.

Edit #2: @Veyerals, looks like from initial testing, the formula you gave is going to work well. I'll obviously have to run some more tests on it, but the initial run of atk 0 to 300 vs def 100 looks really promising.
 
Last edited:

Yal

🐧 *penguin noises*
GMC Elder
This is a very real problem even big commercial studios have issues with... late-game Disgaea (say, once you hit Lv.2000 or above), which uses an atk/def formula, basically boils down to min-maxing your Attack or Intelligence stat because defense stat points are useless at that point; your only choice is to be strong enough to oneshot enemies before they oneshot you. Late-game Fire Emblem Awakening, which uses an atk-def formula, also boils down to a lot of oneshotting, mainly because there is a HP cap both players and enemies have to respect, but attack power can go well beyond that with buffs, end-game weapons, and critical hits tripling attack power BEFORE defense is applied (as well as skills ignoring defense altogether). I'd say FEA is more balanced since there are caps for everything, even if it feels like you end up wasting a lot of experience points/levels that way once everyone starts hitting them.

My advice for any RPG would be to have at least two damage types, typically physical and magical, so that you can't just invest in one stat to beat everything - physical tanks are weak to magic and vice versa, and strong attackers can only deal either type of damage as well. It doesn't instantly solve all balance issues, but it at least opens up for a bit of strategy.

If you want infinite growth AND balance, I'd probably recommend something on the atk-def variety as the best middle ground. Exponential growth will put more importance on numbers - as opposed to strategy and 'soft stats' - since the same level difference has different impacts at different 'base' levels, and it just makes it harder to keep track of what everything does. Atk-def is a bit crude, but it's easy to understand both for you as a designer and for the players.
 

RangerX

Member
Best experience system I've played a game with is Suikoden series.
I can't tell the exact formula but the logic was simple. Mobs were having a "base Exp" they give. Now their levels and your levels were compared and that base number was adjusted accordingly.
The higher the level you are compared to the enemy, the less Exp it gives you. The lower level you are compared to the enemy, the more you get Exp.

I loved this because this system was removing alot of tedious grinding and was actually making sense. When you killed a monster easily and 100 times, what do you learn? And when you beat a enemi stronger than you, there reward is also proportional.
 
@Yal, I am definitely going to have more then one damage type. On top of that, I'm also going to have different formulas for different types of attacks. My main focus was on handling defensive capabilities in the ways I've mentioned in previous posts. In addition, I'm going to have plenty of defense ignoring options available to both PCs and enemies, which actually completely invalidates 'attack / defense'. I'm definitely starting to lean toward a more 'attack - defense' approach, but in a way that neither stat can completely invalidate the other. I just have to figure out how :p

@RangerX, that's sort of along the line I was thinking of for awarding exp as well. One of my goals for this project is to have the 'level' stat be an important part of the formulas so that even a lowly goblin enemy can still be a relevant threat by simply giving it a higher level.

So, after some further testing of the formula @Veyerals mentioned, while it looks good as a basic formula, it falls apart when applied to the full damage calculation I am using as a base. It heavily favors defense when attack is low, and practically makes defense useless when attack is high. Try as I might, I couldn't come up with a combination of variables to make it work. I'm think of maybe switching to a "number of hits" style repetitive formula instead of a single all-or-nothing formula, where each "hit" has a chance of dealing full damage (unmodded attack value) or partial/no damage (attack - defense). Since the level stat is going to play a big part in the damage calculation, I'm not expecting my attack/defense values to be astronomically high (though I don't want to put a cap on them if I don't have too), so it should balance out, being simple, but also preventing situations where high defense enemies practically become invincible.

Long story short: Damage formulas are a lot more difficult then they may first appear.
 
M

Me Myself and I

Guest
Long story short: Damage formulas are a lot more difficult then they may first appear.
Another thing to consider is how fast will the leveling occur? If it's too slow, players may give up before reaching the peaks, in which case you don't really have a problem at all. If it's too fast then you have the "maxing" issue that @Yal referenced.

You might want to start with an existing model and then try tweaking it. Maybe something in an existing game that you thought scaled well.

I was lazy -- I just used a modified version of D20/Dungeons and Dragons. Far from perfect but definitely balanced.
 
Last edited by a moderator:
I do like dice based formulas! I've come up with some good ones in the past. I'm not entirely sure yet how fast leveling will occur. I haven't yet decided on the overall scope of the project. I am planning on letting the player decide things like encounter rates (if they end up being random), difficulty, experience modifiers, etc... Personally, I hate grinding most of the time when playing RPGs, so I want to try and remove mandatory grinding in favor of allowing the player to scale the difficulty up or down at any time, like a handicap or something.

I've done some testing on the newest idea I've had. It's probably not going to be the final version, as at the moment, the number of hits is just equal to the attacker's level, and I don't really want it to work like that. Roughly, it goes as follows:

1: For each hit...
2: Add "attack + defense"
3: Generate a random number between 0 and the above number
4: If the number is less then or equal to attack, then the attacker does 'attack + skill power' damage, which is added to a pool
5: If the number is greater then attack, then the damage done is instead '(attack + skill power) - defense', which can go as low as 0
6: Final damage is all rounds added together.

... I experimented with scaling the values of both scenarios based on what number is randomly generated. I liked that a lot better then the flat formula above, as damage is way too predictable as is.

This ends up working quite well, as a high defense still reduces a lot of damage, but they are not invincible and damage can still regularly be done, albeit rather low. A final step would be to generate the number of hits some other way, and work the level stat into the formula somewhere else. I might just end up using some kind of dice based formula, since this is a lot closer to that then my original idea.

Really Late Edit: This test was severely flawed. I ended up plugging the wrong variable into the formula and it made a huge difference to the balance. This one also fell apart under stress.
 
Last edited:

Yal

🐧 *penguin noises*
GMC Elder
This ends up working quite well, as a high defense still reduces a lot of damage, but they are not invincible and damage can still regularly be done, albeit rather low. A final step would be to generate the number of hits some other way, and work the level stat into the formula somewhere else. I might just end up using some kind of dice based formula, since this is a lot closer to that then my original idea.
IMO having the level stat worked into any formula just accentuates numbers-over-strategy gameplay... Shin Megami Tensei: Strange Journey has the level difference work into accuracy/evasion calculations (on top of actual power differences) and it is completely devastating when it comes to enemies with one-hit-kill attacks and such. I got stuck in one of the boss battles because of its health regeneration gimmick made it completely impossible to beat it with the "chip-damage it for ages" strategy and being forced to grind to have a chance of beating it was what ultimately made me quit the game. (From what I can tell, Shin Megami Tensei IV on the 3DS solves these issues by making all attacks either "normal" or "low accuracy" regardless of levels, but the balancing tweaks and usage of the Press Turn system from Persona means that battles very easily becomes one-turn curb-stomp-fests... can't have everything, I guess :p)

Anyway, my point is that including the level stat easily leads to uncontrollable exponential growth since both your 'stat stats' and your level increase when you level up... I'd include a "combo" stat instead that governs your number of hits (maybe every 4 points gives you an extra attack roll or something, with the excess points giving you a 25% chance for an extra roll each or something? I'm personally a fan of many incremental changes over few huge changes, and few huge battles over many small ones).
 
Well, my original plan with including the unit's level into the formula was to make base stats fairly static, maybe allowing for the occasional stat boost here and there for the player, so a level up wouldn't actually cause the 'double boost' problem you mentioned. Final Fantasy 6s damage formulas have the level stat in the formula, and you can only boost stats by having espers equipped at level up. I honestly didn't even realize this for years, as it still feels like the characters are getting stronger.

Unfortunately, I'm still having trouble working everything together. The promise that my last idea showed as a basic formula fell apart again when trying to expand the formula to a full one again. Really, the main things I want to avoid is the 'high defense = invincible' problem, as well as avoiding using a max value to determine a percentage based damage reduction. I'm also actually starting to lean toward the idea of gearing stats to smaller numbers that have a bigger impact with each increase.
 

Yal

🐧 *penguin noises*
GMC Elder
With the right number of strategical options, there's no invincibility. When your systems allow for an overpowered strategy, it might be easier to add in an intentional counter against it than to scrap the system and make a new one.

Like, as an example, there's a bonus boss in Epic Battle Fantasy 4 with these stats:
upload_2016-9-26_10-26-5.png

AKA, it absorbs all elemental damage, is immune to all ailments, and is immune to all debuffs. Its only attack always hits and instantly kills its target. And it's still possible to beat the boss. The key strategy here is to use non-elemental attacks to damage the boss (and there are a couple of those) and stack Auto-Revive or Morale (survive one attack with 1HP) buffs on the party to avoid losing turns by dying and reviving. The game is completely built around using the elemental system to your advantage for massive damage (and to mitigate enemy damage), so using non-elemental attacks is a completely outside-the-box strategy.
 
Having many ways around the defense issue was also in my plans. I was at least planning on having defense piercing attacks, and I'd likely not implement immunities to the degree of the boss you mentioned, so there's likely going to always be a way around defense in one way or another. I'd just rather avoid having to deal with the scenario all together, but it's really looking like its not going to be possible, so I'm just going to have to bite the bullet and compromise somewhere and stop worrying about it.
 

Yal

🐧 *penguin noises*
GMC Elder
I think you need to make a conscious decision between balance and variety, by the way. There are several big RPG series that has a lot of different gameplay styles, moves, classes and stuff but lack in balance in some aspect or another... Pokémon being the prime example, where out of 720-something monsters, roughly half are "prestige classes" (fully evolved AKA at max potential)... and out of those, some 30 have significant advantages that make them solid team members, but well over two third actually have competitive use. The metagame here is very complicated due to how many tactical possibilities there is (several of the overused mons are only crippled by having a single dominant strategy that makes them predictable; for instance Talonflame is all about glass cannoning and has exactly two moves worth using) and heavily revolves around outguessing your opponent in a sea of possible actions rather than pick the most optimal strategy out of a handful (like in, say, chess). Chess on the other hand is perfectly balanced both playerwise and unitwise, but lacks variety - most books about chess teaches you about a bunch of century-old strategies that have been found superior that you're supposed to mimic step by step.

I've forgotten where I was going with this, so I guess the conclusion is that you want to be somewhere between Pokémon and Chess, it's just a matter of where along the sliding scale you'll put your goal.
 
So after much deliberation, I've decided to just go with the 'attack - defense' route (plus a few other small things) in order to actually get things off the ground. Once I have things more in place where I can start testing things in real time, I'll see if I even need to tweak things more. I've decided to mostly favor attack power over defense, as I don't want things to become a grindfest, but since PCs have equipment, defense will also favor them, as most enemies will just have a base defense amount.
 
M

Mylon

Guest
The system I'm designing my game around is using random attack/defense rolls. So every time an attack is made, I do "random(attack) vs random(defense)" . So 1 <= roll < 1.2 is a glancing blow for half damage, 1.2 <= roll < 2.0 is normal damage, 2.0 <= roll < 10 is double damage, 10 <= roll is triple damage. HP scales roughly on a quadratic scale while player damage scales on some weird arcane formula with a billion factors (traits, talents, buffs, bonuses, phases of the moon, combos, environment, etc) and enemy damage scales roughly on a quadratic scale.

This lets your values scale to infinity without the numbers getting out of hand. Any unit will be able to land a hit (even a critical hit) on any other unit. More attack is always useful. More defense is always useful. This produces a logistic like curve, but the critical hits improves the range at which different values are meaningful.
 
Last edited by a moderator:
G

gryffn

Guest
Hey I know i'm replying to an old thread and this may sound like a stupid idea, btw I'm pretty new to game development, but i've making a game with a similar idea to the no level cap but have you tried to change to different damage formulas based on the type of emey you're encountering to which one which works best, not sure how how complicated that would be, or how it would work or how well. but it's just an idea. just ignore this if it's completely irrelevant or wouldn't work
 
It wouldn't really be that complicated. I was planning on having different formulas for different types of damage anyway. The original point of this thread though was not worrying about finalized formulas, but rather a basic 'attack vs defense' philosophy that fit the requirements I had in mind. I actually haven't thought about this in quite a while, but today I was thinking about something along the lines of:

Code:
damage = power * (attack / defense)
... Maybe with some modifiers of some sort to balance things out so that the gains for defense aren't so astronomical to start and meaningless the higher it gets, and also working 'level' into the equation, like:

Code:
damage = power * ((attack + level) / (1 + (defense / 100)))
... This of course would still favor early defense gains vs late defense gains, but just off the top of my head, it seems like it would balance decently. I'd have to do some tests of course.

Edit: Yay for tests! Whipped up a quick Excel doc to test the second formula (except I changed the '/ 100' part to '* 0.05'), and it really seems to work quite well from the random numbers I plugged into it. Ideally I'd like to have some actual data to run with it, but since this is literally just me coming up with ideas, I have nothing to work with.
 
Last edited:

Yal

🐧 *penguin noises*
GMC Elder
Woo, nice to see this thread again. Forgot the GMC2 existed back in 2016, that feels like the distant past by now. Not even sure I was a Dark Souls and EDF fan back then. Time sure flies.


*ahem*


A common way to balance out early gains (where levels USUALLY have the most effect, unless the game is Disgaea or some other game where you're expected to grind for thousand of levels) is to add a static factor to both nominator and denominator:
Code:
damage = basepower * (attack + static_atk) / (defense + static_def)
This also means you can compute the smallest and largest possible damage pretty easily, which will be pretty handy for balance computations (edge and corner cases are the only cases you need to worry about 95% of the time). Another useful thing you should bring into those calculations is how long you WANT a fight to last, or in other words, how much damage should be the average death's worth. Dark Souls 2, to bring up one of my favorite games, starts you off with 800 HP and has a maximum of around 2200, so you start at almost half the maximum - while you will run into tougher enemies later in the game, they're not growing much more difficult STATWISE throughout the game, and as a result upgrading your HP feels more meaningful because you feel that it's a choice, not a necessity.
Enemies can take out huge chunks of your healthbar from the get-go, but early on you generally fight zombies that not only charge their attacks with very obvious tells, they also keep flailing around for half a week even if they miss so you get ample time to land a few hits from a safe spot. That's another lesson that hails from the D&D days - conserving HP through not getting hit is more natural than outhealing damage or mitigating damage through armor. Very few contemporary JRPGs seem to do this, probably because you wouldn't have a reason to tug along the white mage girl (who's often a princess and/or amnesiac) if you didn't take damage all the time.
 
T

Thunder Lion

Guest
My ideas are like this:

Player Attack = X , this is the player's attack based off their level progression
Player Weapon = A, this is the damage var of the weapon being used it will modify the player's attack damage on a target
Enemy Defense = C, this is the enemies defense based on their level
Enemy Armor = B, this is any added armor or defense buff used to modify the enemies defense
Enemy Max HP = R, the enemies max health

([(X+A)-(C+B)]/R)=N or ([(X+A)-(C+B)]/R)*E=N (E represents a constant of power)

then add this after the equation:

if y<0 {y=0} //this makes it so that the damage is at the lowest 0 DP you can change this using other variables or another equation but its a start.
 
Last edited by a moderator:

Yal

🐧 *penguin noises*
GMC Elder
then add this after the equation:

if y<0 {y=0}
Don't do exactly that, y is a special variable in Game Maker, so this will change the position of the object. It's better to use a more descriptive variable name instead, e.g. "damage". :p
 
T

Thunder Lion

Guest
Don't do exactly that, y is a special variable in Game Maker, so this will change the position of the object. It's better to use a more descriptive variable name instead, e.g. "damage". :p
Its my master coding skills lol! But yes unless you want the characters to snap to the top left corner of a room lol :D
 
X

Xelnath

Guest
Hey! It seems like this thread is still alive, even after years of development.

If you're still developing games, I would highly recommend looking into a deep understanding of 'Effective Health' calculations.

Here's a simple system that scales infinitely (in theory), while keeping display number low:

Example
Let's say you have 1000 health.
Arrows hit for 50 damage.

You would need to be hit by 20 arrows before you die.
(1000 hp / 50 hp = 20)
Simple, right?

In this state your 'Effective Health' matches your 'Real Health' (which I will call Display Health for the purposes of clarity).

Now lets say you have armor that gives you 50% damage reduction.

Example 2
Arrows hit for 25 damage.
You would need to be hit by 40 arrows to die.

(1000 hp / 25 hp = 40 hits)

However, then a few weeks or months later, they'll add an ability that reduces damage taken by 50% (Shield Wall!) Now they'll be stuck with a problem:

When you are wearing *BOTH* - do you have 100% reduction (50% + 50%) - or do you have 75% reduction (50% + 50% of 50% damage).

Normally, they opt for multiplicative scaling - and this is where developers stop. They are like 'cool, my armor works, let's move on with life'.

Let's Be Better!

Let's really dig into what each of those things did - and we'll reveal the underlying pattern below the game system - and I'll illustrate a simple math model you can tweak at will (similar to what an earlier poster illustrated) - which will allow for scaling without defensive points ceasing to be valuable.

What is Effective Health

Let's start with the base case
1000 hp = 1000 eHP

Now let's factor in armor - but instead of thinking in terms of reducing damage - we think in terms of INCREASING health.

50% survivability increasing armor + 1000 hp:
1000 hp / (50/100) = 2000 eHP
1000 hp * 2 = 2000 eHP

This is a more useful way of thinking about the natural relationship between a piece of gear... or spell... and the incoming damage from the monster.

At this point you may be thinking "cool - but at that point, why don't I just have my armor increase my Display HP by 1000 instead?"

And if you're working on a simple game with only one damage type (Legend of Zelda, Classic Sidescrollers, etc) - you are 100% right.

However, we are in the RPG space - and in the RPG space, we love multiple damage types, weaknesses, etc.

Example 4:

Now let's have Fireballs (Magic) and Arrows (Physical) - both dealing 25 dmg:
Hint: (dmg is just negative eHP - remember that!)

Your armor increases your eHP against physical arrows, but not magical fireballs:

1000 hp * A = 2000 physical eHP
1000 hp * B = 1000 magical eHP

As you can easily see, 40 arrows kill you - or 20 fireballs - or any mixture in between. It's easy, simple math.

... but how do you calculate these special coefficients?

Proposal
Try this basic scaling method:

HP * ( ( 100 + X ) / 100 ) = eHP

I call this the Simple Resistance method. How does it work?

Well, let's plug in some number:

X = 100
HP * ( ( 100 + 100 ) / 100 ) = 2 eHP
HP * ( 200 / 100 ) = 2 eHP

X = 200
HP * ( ( 100 + 200 ) / 100 ) = 3 eHP
HP * ( 300 / 100 ) = 3 eHP

How does this work? Basically every 100 Resistance adds 1 full base HP bar.

Now instead of saying your armor had 50% damage reduction, you say it has 100 Physical resist and 0 Magical resist.

You can scale up both your resist numbers *and* your damage numbers and they will always play nice. (Till you run into precision errors on the CPU of course).

Let's say you want to double the damage:
1000 hp / 100 damage = 10 arrows to death

This damage number doesn't grow any faster or slower based upon your defense value.

The input damage and the resistance result are *independent*.

By comparison ( DMG - Reduction ) explodes quickly:

1 dmg - 1 reduction = 0 (100% reduction)
2 dmg - 1 reduction = 1 ( 50% reduction)
3 dmg - 1 reduction = 2 ( 33% reduction)
4 dmg - 1 reduction = 3 ( 25% reduction)
5 dmg - 1 reduction = 4 ( 20% reduction)

Double the damage and the reduction relationship changes:

2 dmg - 1 reduction = 1 (50% reduction)
4 dmg - 1 reduction = 3 ( 25% reduction)
6 dmg - 1 reduction = 5 ( 1/6th% reduction)
8 dmg - 1 reduction = 7 ( 12.5% reduction)
10 dmg - 1 reduction = 9 ( 10% reduction)

Every addtional point of reduction gets BETTER and BETTER - this is unbalanced long-term. Either damage reduction is OP (reduction close to incoming damage) or near worthless (small amount of reduction vs high attack)

DON'T USE THIS.

Hope this treatise on damage reduction helped.
-Alex Brazie
 
X

Xelnath

Guest
Part 2:

Once you have effective health, you are on the road to the most important next step (gameplay implications) which is:

Hits to kill and Thresholds.

E.g. At 1000 eHP - 20 arrows will kill me at 50 damage - but it will still take 50 arrows to kill me until you break the next threshold (52.64 damage roughly). These are the numbers that actually matter to your players in a single player game.
 
Glad to see people still look at this thread! I haven't worked on developing an RPG in a long time, mostly due to other projects taking priority, but this issue is always in the back of my mind.

After considering the matter of effective health, I feel like from an implementation standpoint, it basically boils down to the last formula I posted back in the day, which is good, because that was the one that showed the most promise in the end.

My latest idea toys with the idea of defence degradation. The basic idea is that defense will still reduce overall damage based on for example, the formula I have in a previous post, but also, it degrades by a certain amount with every successful attack, slowly reducing it to either 0 or a minimum value. For PCs, this value would reset after every battle (dont really want to implement an equipment degradation/repair system at the moment). It's just an idea right now. I haven't nearly had the opportunity to test it out in a game setting.
 

Yal

🐧 *penguin noises*
GMC Elder
My latest idea toys with the idea of defence degradation. The basic idea is that defense will still reduce overall damage based on for example, the formula I have in a previous post, but also, it degrades by a certain amount with every successful attack, slowly reducing it to either 0 or a minimum value. For PCs, this value would reset after every battle (dont really want to implement an equipment degradation/repair system at the moment). It's just an idea right now. I haven't nearly had the opportunity to test it out in a game setting.
I've toyed around with a similar idea, actually! My idea is: basically, do FPS armor. You've got a separate HP bar for armor, as long as you have armor, the armor takes as many percent of the damage as its absorption stat says. (Good armor might even absorb 100% of the damage, and if it has over 100% absorbtion it might even heal you or something, or the excess damage gets completely nullified, or whatever). Once the armor hits zero, ALL damage you take from that point onward goes straight to your HP.

This has a bunch of interesting effects...
  • Damage-over-time effects like poison becomes a lot more viable when fighting high-defense opponents, because you can damage their HP directly without having to chew through their armor first.
  • Tension builds up as your armor starts running low, because you suddenly will get a LOT more vulnerable. This also helps breaking stalemates where both teams can outheal all the damage they take.
  • ArmorPoints could be another thing to toy around with as a balancing factor for armor, you could have glass armor with 100% absorption but low AP cap, and durable light armor that has low absorbption but a ton of AP so it won't be easy to destroy.
  • Heavy armor reducing movement speed / dodge ability as a mechanic could be interesting to make fights change when someone's armor gets broken, e.g. an enemy might get a lot more agile and aggressive when their armor breaks to balance out the fact they get more vulnerable.
 
  • Like
Reactions: Rob
@Yal, a lot of those ideas have also crossed my mind, especially the whole "glass armor" idea, defense ignoring attacks (like poison!), the 'healing vs healing' issues... I didn't really think of your last point though. My original thoughts were just simply that after so many hits, you basically have no defense left. I like the idea of the armor basically being de-equipped when its durability runs out, but there's the issue of multiple pieces of equipment, which one gets damaged first, so I'd probably just stick with the more simple version.
 

Rob

Member
When it comes down to things like this I just google how the pros did it and that's always a good source of ideas e.g:

Dragon Quest 1 Battle Formulas

I always default to something basic like roll(100) vs (DEF/ATT * 100) but that's a lot of RNG. I actually had a similar question so I'm glad this topic came up already.
 

Yal

🐧 *penguin noises*
GMC Elder
@Yal, a lot of those ideas have also crossed my mind, especially the whole "glass armor" idea, defense ignoring attacks (like poison!), the 'healing vs healing' issues... I didn't really think of your last point though. My original thoughts were just simply that after so many hits, you basically have no defense left. I like the idea of the armor basically being de-equipped when its durability runs out, but there's the issue of multiple pieces of equipment, which one gets damaged first, so I'd probably just stick with the more simple version.
I'm imagining everything being de-equipped at once, essentially armor is load-shared using magic so the damage gets spread out evenly no matter where attacks hit, and when the durability runs out it all explodes off you and leaves you standing in your underwear. (Essentially like Ghosts & Goblins). Depending on the tone of your game, this might actually be a thing you could add in (I think Fire Emblem: The One With Corrin That Got Sorta Bad Reviews And Had That Questionable Waifu Petting Minigame did that to illustrate defense debuffs, and it's trying really hard to be a super serious war simulator where anyone can die... but it's japanese and the japanese culture seems to be more tolerant about juxtaposing serious and silly stuff than we are in the west, considering stuff like Yakuza and Hatoful Boyfriend)
 
In retrospect, dealing with multiple pieces of armor degrading at different rates isn't that big of an issue. A system as simple as each piece losing 1 AP each time the character is damaged wouldn't be difficult, plus it would make adding defensive magic as simple as adding a "new" piece of armor to the characters list. My only issue with that is if you have 5 pieces of armor equipped, you're taking 5 AP of damage every hit vs 1 piece and 1 AP. Not sure offhand if the added overall defence of having 5 pieces would offset the additional damage done to the equipment. That said, a priority system wouldn't be difficult to add... Or just randomizing what piece is damaged... Or even a weighted random.

@Rob (also my name in real life), most of my formulas are likely going to be lifted from other games. At the very least, they will be inspired by other games.
 

Yal

🐧 *penguin noises*
GMC Elder
My only issue with that is if you have 5 pieces of armor equipped, you're taking 5 AP of damage every hit vs 1 piece and 1 AP.
You could distribute the AP damage evenly over the armor. One idea is to go through all armor from highest to lowest priority, dealing 1 AP damage, removing 1 AP, continue from the top if you scroll off the bottom, and repeat until AP runs out. This way, you always take the same amount of AP damage total, but uneven amounts prioritize higher-priority armor (e.g. buffs, chestpieces). Higher-level armor buffs or more-soaking armor could add more than one such "layer" of armor, making more AP damage get soaked up before it damages your normal armor.
 
I think I'm definitely going to have to throw together a quick prototype for this kind of defense system. I keep coming up with different ideas revolving around this kind of setup, but there's so many ways to handle this, I'm curious to see how it all works.
 
So I've finally sat down and looked at this a bit more. In trying to see how the numbers worked, I've come to the realization that there's no good way to compare the "fairness" of having only a single piece of armor equipped, taking 1 AP of durability damage per hit, and having a potentially lower overall defensive value, versus, for example, having 5 pieces of armor equipped, EACH taking an AP of durability damage per hit (for a total of 5 AP), but having more defensive power overall. I then thought of just having a single AP pool that each armor piece adds too, but then not only is the attacker dealing with more defensive power, but its compounded by having to chip away at more durability points. After more thought, I'm thinking a random weighted, prioritized system is in order, and only a single "layer" of durability is damaged with each hit, and the defensive power of each piece of armor is individually scaled by their current durability, until it is at zero. For priority, I was thinking, as a generic example, of the following priority, from highest to lowers:

Magic Barrier
Shield/Guard (Presumably, one would use it to block attacks before tanking hits anywhere else)
Armor
Headgear
Armwear, Legware, Footware (different pieces of equipment, but at the same priority level)
Other (Anything else basically, like armor increasing accessories, maybe clothes?)

I figure, for each piece of armor equipped, it has an X% change of being damaged, and if not, the priority is lowered and the chance is rerolled again. If it hits the bottom of the priority list without damage being dealt, it will roll back over to the top of the list and continue on. Of course, there would have to be a check for having no armor equipped at all, else the loop will continue indefinitely. Not sure off hand how I would want to handle the arm/leg/footware situation being on an even playing field. I'd probably just evenly randomize it at that point (Maybe in order of arm, leg, then foot).
 
I'm not saying that this is the best option for every single RPG, but you could follow the model of Dungeons and Dragons and many video-game RPGs:

Don't even use defense.


Or rather, very seldom does defense come into play. Better armor generally increases Armor Class, which effectively works like an evasion stat would in more modern RPGs. It simulates a little more accurately how realistic combat would work. A dagger that pierces flesh is going to do the same amount of damage whether you're wearing dragonskin armor or nothing at all, it's just going to be much harder to reach that flesh with the armor on.
 
Top