Author Topic: RPG battle system balancing  (Read 411 times)

Online Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2364
  • *MUNCH*
    • View Profile
RPG battle system balancing
« on: March 19, 2017, 12:44:26 pm »
So I had an insight the other day while struggling to balance the damage output in Spectacles.  For a while I'd been trying to balance things by changing multipliers, but no matter what I did, making one battle fair negatively impacted battles at other points in the story.  Then I realized: In a modern JRPG battle engine, input variables are normally multiplied in some fashion, not added.  Thus, the most important thing for balance is the number of variables in the formula, not the specific factors used.

It turned out that I had a fundamental imbalance due to a mismatch in the number of variables between the Max HP and damage formulas.  Max HP is a linear progression:
Code: (javascript) [Select]
// note: statAverage is weighted, heavily favoring VIT
25 * tier * statAverage

All storyline bosses save for the final boss are defined as Tier 3, so that over the course of the game boss HP rises linearly, directly proportional to the stat average.  Damage on the other hand is calculated as:
Code: (javascript) [Select]
2.5 * pow * weapon * str / def

str / def, being on the same scale, cancel either other out on average.  So for this purpose we can treat the damage formula as having two variables: move power and weapon power.  Therefore, over the course of the game the damage increase is quadratic.  Depending on the factors used, that either means you do far too much damage to late-game enemies, or else not nearly enough to early ones.  In order to balance, HP also needs to be quadratic.  Without introducing a new variable in the HP formula, this can be accomplished by squaring the stat average.

Just thought I'd share this experience as it was kind of a big eureka moment for me after a long balancing struggle.  I think as amateur game developers we tend to take things like RPG battle formulas for granted, but there's actually a lot more nuance to it than it seems at first glance.
miniSphere 4.7.1 - Cell compiler - SSj debugger
Forum Thread | GitHub Repo

Offline mezzoEmrys

  • Adventurer++
  • Verified
  • Low Poster
  • *
  • Posts: 77
    • View Profile
Re: RPG battle system balancing
« Reply #1 on: March 19, 2017, 01:34:29 pm »
I personally like examining the forumlas for the weapons in Final Fantasy 12, like this formula for the greatsword:


A lot of the weapons in FF12 scale like this, with a straight (damage * random) - defense, then a multiplier from stats

Online Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2364
  • *MUNCH*
    • View Profile
Re: RPG battle system balancing
« Reply #2 on: March 19, 2017, 01:56:41 pm »
Wow, that's a lot simpler than the FFX formulas.  FFX actually uses a cubic factor on STR, but only a square factor on MAG for some reason.  And the Defense calculation in that game is damn near indecipherable.  I won't complain too much though, because the squaring and cubing means that small stat differences really matter.. Which does help cut down on the need for long grinding sessions.
miniSphere 4.7.1 - Cell compiler - SSj debugger
Forum Thread | GitHub Repo

Online Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2364
  • *MUNCH*
    • View Profile
Re: RPG battle system balancing
« Reply #3 on: March 21, 2017, 02:52:47 am »
As a followup to the OP, one of my big pitfalls, even after discovering the linear/quadratic mismatch, was to try to finagle the caps for different things to try to work around it.  I'm telling you now: That doesn't work.  At all.  While multiplying two variables--say, skill power and user level--that both range 1-100 and grow at about the same rate is obviously quadratic, what wasn't so obvious, to me at least, is that it's still quadratic even if you change one of the variables to go from 1-20 instead.  Assuming the rate of growth remains proportional over the course of the game, the curve doesn't change at all because any value is functionally identical to a percentage of the maximum--and then you're on the same scale again.
miniSphere 4.7.1 - Cell compiler - SSj debugger
Forum Thread | GitHub Repo