Video icon 64
Build your coding skills with practical video courses from Tuts+. Start your free trial today.
Advertisement

Balancing Turn-Based RPGs: Enemies

by
This post is part of a series called Balancing Turn-Based RPGs.
Balancing Turn-Based RPGs: Party Members

So far, we've determined base and derived stats for the hero of our mock game, Final Trigger. We then gave our spiky-haired protagonist a female companion, Jane, and fine-tuned her stats so that they would be in balance with his. This time around, in what will amount to the third and final part of our series on RPG balance, we will pit our newly-balanced hero Chroud against the fearsome, loathsome, death-defying... Killer Attack Rabbit.

Yes, our furry menace might appear innocuous at first, but few have managed to escape his perilous clutches. Along the way, we will provide our new villain with stats, special powers and artificial intelligence. Then, the battle royal will begin. Once we retrieve some initial data, we will tune the fight to meet the expectations we set prior to the battle. Finally, we'll examine what happens when we add Jane back into the fray, and how her presence will inevitably disrupt our delicate balance.


A Quick Recap

As you may recall, we determined Chroud's derived stats by performing calculations on his base stats. These stats then proved useful for evaluating Chroud's combat efficiency. We ultimately decided on the following:

Our spiky-haired protagonist's stats.

Our spiky-haired protagonist's stats.

By dividing Chroud's Attack Power by his ATB Speed, we concluded that he would dish out approximately 42 damage per second (DPS). Let's go one step further. In most turn-based RPGs, party members possessed a chance to critically hit their foes. Critical hits would typically strike enemies for between 1.5 and two times the amount of damage as a normal strike.

Factoring in Chroud's Attack Power and assuming a Critical Hit Rate of 10% and a Critical Multiplier of 1.5, we can re-evaluate his DPS:

  • Chroud's DPS: \(((500 \times .9) + (750\times .1) )/ 12 = (450 + 75) / 12 \approx 44\)

Thus, by adding a random chance to critically strike his foes, Chroud's DPS has increased by approximately two. This should make things a bit more interesting down the line. Note that Chroud's Average Damage Per Turn (DPT) is now 525, instead of 500.


The Face of the Enemy

Determining enemy stats is in many ways easier than figuring out a party member's. Their stats aren't affected by gear, they typically don't have access to consumables, and their levels remain static. Thus, they don't gain experience.

Tip: In some modern WRPGs, enemy levels scale to match yours, but in our example we'll assume that they don't.

Since gear isn't a factor, we can skip converting base stats to derived. In fact, we can forgo base stats altogether. That's good news, especially since almost all RPGs feature far more enemies than they do playable characters - games like Chrono Cross are a rare exception.

Instead, we'll merely plug combat-relevant enemy stats in manually. In addition to being faster, the added benefit of this approach is that it will allow for more creative freedom. But before you begin arbitrarily plugging in numbers, it is important to ask yourself a few questions about the enemy in question:

  • What category of enemy are you facing: trash mob, dungeon mob, mini-boss or boss? Check out the first part of this series for more on enemy types.
  • What type of enemy are you facing? If the enemy is a physical attacker, his stats should reflect his strength. Other enemies might favor magical attacks or defense. Some might be highly evasive or use status effects. By determining an enemy's type, you will have a much easier time deducing its stats.
  • Healing: Does the enemy have any way of regenerating life? If so, then its offensive stats shouldn't be as imposing as an equivalent enemy that cannot heal.
  • Phases: Does the enemy transform into a stronger version of itself halfway through the fight? If it does, you'll have to create two (or more) sets of stats for the enemy.
  • Special abilities and reactive AI: We'll get more into this later, but most enemies (even some trash mobs) should have a few tricks up their sleeve. Without AI, battles become routine and stale.
  • Do you want the enemies in your game to follow traditional 16-bit standards, or to reflect more modern traditions?

The last point requires a bit of clarification. You see, in old-school RPGs, players typically had a relatively puny amount of hit points compared to enemies. However, because party members hit harder, outnumbered the enemy, and had access to healing resources, the enemy's high hit point totals were justified. Most modern RPGs, at least those from the West, operate a little differently. In the name of realism, enemies usually feature hit points that are on par with your own. They might not hit as hard, or be as smart, but they can certainly wear you down because your character is generally weaker than he or she would be in a Japanese RPG.


The Killer Attack Rabbit

Using the guidelines listed above, you will be able to quickly deduce some roundabout stats. Remember, since we're only working with combat relevant stats, it'll be up to you to figure out numbers that make sense. Just don't worry about creating balanced enemies on the first shot - it probably won't happen. Thankfully, using the system we're about to outline, you'll be able to tweak enemy numbers with ease.

Back to the Killer Attack Rabbit. Our ferocious rodent will be a staunch physical fighter and extremely quick, but lacking in the areas of defense and magic. He'll be a dungeon mob, and have more hit points than our Hero but deal less damage. He won't regenerate life, but we'll explore a few cool special abilities that will make him quite the furry nuisance.

Here are the initial numbers we'll use:

Don't judge him by his cute appearance.
Don't judge him by his cute appearance.

Now, we're ready to conduct our first test case.


Test Case #1

In this corner, with hair weighing in at 22 pounds, we have our valiant hero Chroud. And in the other corner, hailing from parts unknown, weighing in at a menacing 4.5 pounds, we present to you the undefeated, undisputed... Killer Attack Rabbit.

Before we begin our hotly anticipated battle, we should probably figure out a few things. The first, and most obvious, is the Killer Attack Rabbit's DPS:

  • Killer Attack Rabbit DPS: \(((200 \times .85) + (300 \times .15)) / 10 = 21.5 \text{ DPS}\)

Thus, if the Attack Rabbit only used his base attack, he would be dish out 21.5 damage per second. But our villain is a bit more sophisticated. To mix things up, we'll give him three additional attacks. The first will be called "Bite," the second "Bunny Hop," and the third "Too Cute." In order to determine how these new attacks affect his DPS, we must first define them.

Simple Enemy AI

Enemies in early turn-based RPGs usually only had one or two attacks. By the late 16-bit era, this number was increased to three or four, and in some cases even more. However, the average enemy was rarely sophisticated. Special attacks were used seemingly at random, status effects were commonly cast on players already affected, and attacks were rarely targeted towards players with low hit points. The only enemies that appeared remotely intelligent were bosses.

Our villain, who is in our game considered a middle-of-the-road enemy, will be at least as intelligent as a late 16-bit boss, but not nearly as powerful.

His first attack, "Bite" will is defined as follows:

Bite - Deals 150% damage to a single attacker. 25% chance to cast each round. Cannot be cast two rounds in a row.

The last caveat is important. If you give enemies a chance to use special abilities over and over again, there will be times when they'll simply overwhelm you. This would cause the battle to fall decisively out of balance. To counter this, we prevent the Killer Attack Rabbit from using "Bite" two rounds in a row. The player's role will be to recognize this pattern, and to adapt accordingly.

The second attack, "Bunny Hop," functions as so:

Bunny Hop - Deals 225% damage to a single attacker. Casts immediately after falling below 25% HP. Can only be cast once per battle.

"Bunny Hop" is an example of Conditional AI, and is a great way to easily simulate intelligence. When the Killer Attack Rabbit is on the brink of death, he musters up all of his strength and attacks you with a devastating special ability. In order to prepare for this, party members are well-advised to keep their hit points topped up.

Finally, he has an attack called "Too Cute:"

Too Cute - Stuns one party member for one round. Casts one turn after "Bunny Hop."

Although this attack won't increase the Attack Rabbit's DPS, it will prolong the fight. And the longer the fight, the better chance for the enemy to win. We have our enemy use this ability immediately after "Bunny Hop" because it just makes sense. Seeing as the "Bunny Hop" didn't finish you off, the Rabbit would be inclined to use a defensive ability to prevent you from healing.

Thus, we can make the following conclusions:

  • 25% of the time (minus up to two attacks) the Killer Attack Rabbit's DPS will be \(21.5 \times 1.5 = 32.25\).
  • 75% of the time (minus up to two attacks) the Killer Attack Rabbit's DPS will be \(21.5\).
  • Up to one time per battle, his DPS will be \(21.5 \times 2.25 = 48.4\).
  • Up to one time per battle, his DPS will be \(0\).

We say "up to one time per battle" because there is no guarantee that the Killer Attack Rabbit will use "Bunny Hop" or "Too Cute." Let's say you take his HP down from 30% all the way to 0% in one shot. In this scenario, he'll never have the opportunity to use it. However, you'd probably need to hit him with an opportune critical strike to avoid it completely.

DPS and Effective DPS

Based on your attack power, and after factoring in damage mitigation (we'll get to that in a second) it will take you roughly six rounds to finish off the Killer Attack Rabbit. Normally it would take five, but you'll likely be stunned for one round. Given this, we can assume the following attack ratios:

  • Three out of the Rabbit's six attacks will be normal attacks: \(21 \text{ DPS}\)
  • One will be "Bite": \(32.25 \text{ DPS}\)
  • One will be "Bunny Hop": \(48.4 \text{ DPS}\)
  • One will be "Too Cute": \(0 \text{ DPS}\)
  • Average DPS: \(((3 \times 21) + 32.25 + 48.4 + 0) / 6 = 23.9 \text{ DPS}\)

Factoring in Chroud's 10% physical damage mitigation and 12.5% dodge rate, the Rabbit's Effective DPS becomes:

  • Killer Attack Rabbit Effective DPS: \((23.9 \times .9) \times .875 = 18.8 \text{ DPS}\)
  • Killer Attack Rabbit Effective Damage Per Turn: \((18.8 \times 10) = 188\)

Alright, so after all that, we can conclude that the Killer Attack Rabbit will strike Chroud for, on average, 188 damage per turn.

Now, we'll do the same for Chroud. We've already determined that Chroud's DPS is 44. However, his Effective DPS is significantly lower because he'll sometimes either be stunned or forced to occasionally spend a round using a consumable item. For simplicity, we'll assume that Chroud will do no damage 20% of the time:

  • Chroud's Average DPS: \(44 \times 0.8 = 35.2 \text{ DPS}\)

Factoring in the Killer Attack Rabbit's 5% physical damage mitigation and 20% dodge rate, Chroud's Effective DPS becomes:

  • Chroud's Effective DPS: \((36.9 \times .95) \times .8 = 26.8 \text{ DPS}\)
  • Chroud's Effective Damage Per Turn: \((28 \times 12) \approx 322\)

Finally, we can calculate how many rounds it will take for Chroud to defeat the Killer Attack Rabbit and vice-versa. We will assume that, during the fight, Chroud will pop one potion, restoring 500 of his hit points, and raising his Effective Hit Point total to 1300.

  • Chroud's time to defeat Killer Attack Rabbit: \((2000 / 336) = 6.21\) rounds or \(74.5\) seconds.
  • Killer Attack Rabbit's time to defeat Chroud: \((1300 / 188) = 6.91\) rounds or \(69.1\) seconds.

Congratulations, it looks like we're close to achieving balance! Unfortunately, as we'll soon see, looks can be deceiving.


Simulations

We decided to plug both Chroud's and the Killer Attack Rabbit's statistics into our in-house computer simulation program and chart some results. Suffice to say, the results were not what we expected. All too often, our results looked like the following:

Simulation #1: The Killer Attack Rabbit Decimates Chroud
Simulation #1: The Killer Attack Rabbit decimates Chroud.

Not good. All told, the Killer Attack Rabbit won in well over 50% of our simulations, sometimes before Chroud was able to land a single hit. In our mock game Final Trigger, our initial goal was for dungeons mobs to win approximately 5% of the time. That's a huge disparity. So what's the problem?

The first issue is fairly obvious. The average time it takes Chroud to defeat the Killer Attack Rabbit is approximately the same amount of time it takes the Killer Attack Rabbit to defeat Chroud. Based on this statistic alone, Chroud will win 48.1% of the time and the Rabbit 51.9%.

But there's another factor we haven't yet considered: Damage Per Turn (DPT) volatility. In turn-based RPGs, we define DPT volatility as a measure of how much the maximum amount of damage that can be performed in one round varies from the norm. For example, if a party member's Damage Per Turn is 50, but he can perform a maximum of 400 damage in any given turn, his DPS would be considered extremely volatile and unpredictable.

We have already determined that the Killer Attack Rabbit's Effective DPT is 188. Now we have to figure out the single most damage he can do in any one round:

  • Killer Attack Rabbit Max Damage: \((220 \times 1.5) \times 2.25 \times .9 = 668.25 \text{ DPT}\).

When the Killer Attack Rabbit rolls a perfect attack score, critically hits and uses "Bunny Hop," he will pummel Chroud for 668.25 damage after mitigation. That's over 80% of Chroud's life in one shot! Our poor spiky-haired friend will hardly have an opportunity to use his potion, effectively reducing his Hit Point total by 500.

Now, will the Rabbit attack for this much damage on a regular basis? No. But he will hit us for almost half of Chroud's life far more often than we're comfortable with.

Because the Killer Attack Rabbit's DPS is so volatile, you'll want to tweak your numbers so that the average time Chroud needs to defeat him is approximately half of the time necessary for him to defeat Chroud. The easiest way to do this is to merely lower the Killer Attack Rabbit's DPS. Instead of 200, let's make it 120 and see what happens:

  • Killer Attack Rabbit Base DPS: \(((120 \times .85) + (180\times .15)) / 10 = 12.9 \text{ DPS}\).

Performing the same calculations listed above, we can easily determined that the Rabbit's new Effective DPS is 11.4, which equates to 114 DPM.

  • Killer Attack Rabbit's time to defeat Chroud: \((1300 / 114) = 11.40\) rounds or \(114\) seconds.
  • Killer Attack Rabbit Max Damage: \((132\times 1.5) \times 2.25 \times .9 = 401 \text{ Damage Per Turn}\).

Now, on average, Chroud will need 5.19 fewer rounds than his furry nemesis does to win. Even on the Killer Attack Rabbit's best day, he'll have to roll perfect to take half of Chroud's life in one shot. So while the Rabbit can still hit hard enough to cause some concern, Chroud will be able to defeat him most of the time. A second simulation confirms this:

Simulation #2: Balance achieved.
Simulation #2: Balance achieved.

In this simulation, Chroud takes a righteous beating, but is never in any real danger of dying. However, if the battle had lasted another round, the Killer Attack Rabbit would have used his "Too Cute" attack, which could have proved disastrous for our hero. We can therefore conclude from this simulation that the difficulty of the battle is tuned fairly well, and is in line with our initial expectations.

Why So Low?

Earlier we mentioned that, in our ideal scenario, the Killer Attack Rabbit should only defeat Chroud 5% of the time. You might be wondering why that number is so low. Keep in mind that if any enemy defeats Chroud, the game is over. Conversely, Chroud has to defeat every enemy in order to win. His job is much tougher, thus his chances of dying against non-Boss types should be rather low.


Factoring in Additional Party Members

It's a bit unrealistic to assume that Chroud will always be fighting on his own. You may recall from the second part of the series that we aligned Chroud with a scepter-wielding Mage with the unassuming name of Jane. Although Jane's DPS was slightly higher and more volatile than Chroud's, the two allies were relatively balanced.

One of the first assumptions developers make when factoring in a second party member is that the additional ally doubles the overall efficiency of the party. In reality, it's a lot more. Using the calculations listed above, we determine Jane's Effective DPS against the Killer Attack Rabbit to be 30.4. Add this to Chroud's and the party's Effective DPS becomes:

  • Party Effective DPS = 30.4 + 26.8 = 57.2 DPS

If we level the playing field by adding a second Killer Attack Rabbit to the mix, the enemy party's Effective DPS is:

  • Killer Attack Rabbit Effective DPS (against Chroud): \((23.9 \times .9) \times .875 = 18.8 \text{ DPS}\)
  • Killer Attack Rabbit Effective DPS (against Jane): \((23.9 \times .9625) \times .85 = 19.6 \text{ DPS}\)
  • Enemy Effective DPS: \(18.8 + 19.6 = 38.4 \text{ DPS}\)

Note that Jane cannot mitigate physical damage as well as Chroud, and thus takes more damage, on average, from the Killer Attack Rabbit.

Because the ratio of Enemy Effective DPS to Party Effective DPS is pretty much in line with the one-on-one ratio, it would stand to reason that the difficulty of the battle would be about the same. But we're forgetting about one thing: the player. Most players will be able to outwit any computer system, and should have a distinct advantage in statistically even fights. In this scenario, the player merely needs to focus its fire on one Rabbit before moving on to the next. The Attack Rabbits, on the other hand, will just attack party members at random.

Of course, you could program them to focus their fire on the weakest party member, or on the one that poses the greatest threat. If that's the case, there's little need to re-balance the Attack Rabbit. However, if they attack at random, you will need to increase their combat efficiency by a nominal percentage.

And really that's what balancing a turn-based RPG is all about: a lot of guesswork, a lot of tweaking and a lot of simulations.


Conclusion

In this series, we explored turn-based RPG balance from three different perspectives: game design, party level and enemy level. We explored a few simple methods to help you achieve rudimentary balance in your game. In this segment we learned how:

  • to calculate Enemy stats and DPS
  • to calculate Effective DPS
  • to determine DPT Volatility
  • to use simulations
  • additional party members affect the outcome of battle

Despite the length of this series, we've barely scratched the surface. Balancing a full-scale RPG can take development teams months, and greatly benefits from the use of some sort of modeling software. However, by now, you should at least understand what goes into the balancing process, and have a better idea of the factors you need to consider. The good news is that our system did not require the use of any advanced math or logic. All told, it was a fairly intuitive process that favored common sense over complicated algorithms. Hopefully, it will help make the seemingly daunting task of balancing your turn-based RPG a bit more palatable.

Advertisement