Level 6: Situational Balance

Readings/Playings

None this week (other than this blog post).

Answers to Last Week’s Question

If you want to check your answer from last week:

Analyzing Card Shuffles

For a 3-card deck, there are six distinct shuffling results, all equally likely. If the cards are A, B, and C, then these are: ABC, ACB, BAC, BCA, CAB, CBA. Thus, for a truly random shuffler, we would expect six outcomes (or a multiple of six), with each of these results being equally likely.

Analyzing Algorithm #1:

First you choose one of three cards in the bottom slot (A, B, or C). Then you choose one of the two remaining cards to go in the middle (if you already chose A for the bottom, then you would choose between B and C). Finally, the remaining card is put on top (no choice involved). These are separate, (pseudo)random, independent trials, so to count them we multiply: 3x2x1 = 6. If you actually go through the steps to enumerate all six possibilities, you’ll find they correspond to the six outcomes above. This algorithm is correct, and in fact is one of the two “standard” ways to shuffle a deck of cards. (The other algorithm is to generate a pseudorandom number for each card, then put the cards in order of their numbers. This second method is the easiest way to randomly order a list in Excel, using RAND(), RANK() and VLOOKUP().)

Analyzing Algorithm #2:

First of all, if a single shuffle is truly random, then repeating it 50 times is not going to make it any more random, so this is just a waste of computing resources. And if the shuffle isn’t random, then repeating may or may not make it any better than before, and you’d do better to fix the underlying algorithm rather than covering it up.

What about the inner loop? First we choose one of the three cards to go on bottom, then one of the three to go in the middle, and then one of the three to go on top. As before these are separate independent trials, so we multiply 3x3x3 = 27.

Immediately we know there must be a problem, since 6 does not divide evenly into 27. Therefore, without having to go any further at all, we know that some shuffles must be more likely than others. So it would be perfectly valid to stop here and declare this algorithm “buggy.” If you’re sufficiently determined, you could actually trace through this algorithm all 27 times to figure out all outcomes, and show which shuffles are more or less likely and by how much. A competitive player, upon learning the algorithm, might actually run such a simulation for a larger deck in order to gain a slight competitive advantage.

This Week

This is a special week. We spent two weeks near the start of the course talking about balancing transitive games, and then two more weeks talking about probability. This week we’re going to tie the two together, and put a nice big bow on it.

This week is about situational balancing. What is situational balancing? What I mean is that sometimes, we have things that are transitive, sort of, but their value changes over time or depends on the situation.

One example is area-effect damage. You would expect something that does 500 damage to multiple enemies at once is more valuable than something that does 500 damage just to a single target, other things being equal. But how much more valuable is it? Well, it depends. If you’re only fighting a single enemy, one-on-one, it isn’t any more valuable. If you’re fighting fifty enemies all clustered together in a swarming mass, it’s 50x more valuable. Maybe at some points in your game you have swarms of 50 enemies, and other times you’re only fighting a single lone boss. How do you balance something like that?

Or, consider an effect that depends on what your opponent does. For example, there’s a card in Magic: the Gathering called Karma, that does 1 damage to your opponent each turn for each of their Swamps in play. Against a player who has 24 Swamps in their deck, this single card can probably kill them very dead, very fast, all on its own. Against a player with no Swamps at all, the card is totally worthless. (Well, it’s worthless unless you have other cards in your deck that can turn their lands into Swamps, in which case the value of Karma is dependent on your ability to combine it with other card effects that you may or may not draw.) In either case, the card’s ability to do damage changes from turn to turn and game to game.

Or, think of healing effects in most games, which are completely worthless if you’re fully healed already, but which can make the difference between winning and losing if you’re fighting something that’s almost dead, and you’re almost dead, and you need to squeeze one more action out of the deal to kill it before it kills you.

In each of these cases, finding the right cost on your cost curve depends on the situation within the game, which is why I call it situational balancing. So it might be balanced, or underpowered or overpowered, all depending on the context. How do we balance something that has to have a fixed cost, even though it has a benefit that changes? The short answer is, we use probability to figure out the expected value of the thing, which is why I’ve spent two weeks building up to all of this. The long answer is… it’s complicated, which is why I’m devoting an entire tenth of this course to the subject.

Playtesting: The Ultimate Solution?

There are actually a lot of different methods of situational balancing. Unfortunately, since the answer to “how valuable is it?” is always “it depends!” the best way to approach this is thorough playtesting to figure out where various situations land on your cost curve. But as before, we don’t always have unlimited playtest budgets in the Real World, and even if we do have unlimited budgets we still have to start somewhere, so we at least need to make our best guess, and there are a few ways to do that. So “playtest, playtest, playtest” is good advice, and a simple answer, but not a complete answer.

A Simple Example: d20

Let’s start with a very simple situation. This is actually something I was asked once on a job interview (and yes, I got the job), so I know it must be useful for something.

What follows is a very, very oversimplified version of the d20 combat system, which was used in D&D 3.0 and up. Here’s how it works: each character has two stats, their Base Attack Bonus (or “BAB,” which defaults to 0) and their Armor Class (or “AC,” which defaults to 10). Each round, each character gets to make one attack against one opponent. To attack, they roll 1d20, add their BAB, and compare the total to the target’s AC. If the attacker’s total is greater or equal, they hit and do damage; otherwise, they miss and nothing further happens. So, by default with no bonuses, you should be hitting about 55% of the time.

Here’s the question: are BAB and AC balanced? That is, if I gave you an extra +1 to your attack, is that equivalent to +1 AC? Or is one of those more powerful than the other? If I were interviewing you for a job right now, what would you say? Think about it for a moment before reading on.

What’s the central resource?

Here’s my solution (yours may vary). First, I realized that I didn’t know how much damage you did, or how many hit points you had (that is, how many times could you survive being hit, and how many times would you have to hit something else to kill it). But assuming these are equal (or equivalent), it doesn’t actually matter. Whether you have to hit an enemy once or 5 times or 10 times to kill it, as long as you are equally vulnerable, you’re going to hit the enemy a certain percentage of the time. And they’re going to hit you a certain percentage of the time. What it comes down to is this: you want your hit percentage to be higher than theirs. Hit percentage is the central resource that everything has to be balanced against.

If both me and the enemy have a 5% chance of hitting each other, on average we’ll both hit each other very infrequently. If we both have a 95% chance of hitting each other, we’ll hit each other just about every turn. But either way, we’ll exchange blows about as often as not, so there’s no real advantage to one or the other.

Using the central resource to derive balance

So, are AC and BAB balanced? +1 BAB gives me +5% to my chance to hit, and +1 AC gives me -5% to my opponent’s chance to hit, so if I’m fighting against a single opponent on my own, one on one, the two are indeed equivalent. Either way, our relative hit percentages are changed by exactly the same amount. (One exception is if either hit percentage goes above 100% or below 0%, at which point extra plusses do nothing for you. This is probably why the default is +0 BAB, 10 AC, so that it would take a lot of bonuses and be exceedingly unlikely to ever reach that point. Let’s ignore this extreme for the time being.)

What if I’m not fighting one on one? What if my character is alone, and there are four enemies surrounding me? Now I only get to attack once for every four times the opponents attack, so +1 AC is much more powerful here, because I’m making a roll that involves my AC four times as often as I make a roll involving my BAB.

Or what if it’s the other way around, and I’m in a party of four adventurers ganging up on a lone giant? Here, assuming the giant can only attack one of us at a time, +1 BAB is more powerful because each of us is attacking every round, but only one of us is actually getting attacked.

In practice, in most D&D games, GMs are fond of putting their adventuring party in situations where they’re outnumbered; it feels more epic that way. (This is from my experience, at least.) This means that in everyday use, AC is more powerful than BAB; the two stats are not equivalent on the cost curve, even though the game behaves like they should be.

Now, as I said, this is an oversimplification; it does not reflect on the actual balance of D&D at all. But we can see something interesting even from this very simple system: the value of attacking is higher if you outnumber the opponent, and the value of defending is higher if you’re outnumbered. And if we attached numerical cost and benefit values to hit percentage, we could even calculate how much more powerful these values are, as a function of how much you outnumber or are outnumbered.

Implications for Game Design

If you’re designing a game where you know what the player will encounter ahead of time – say, an FPS or RPG with hand-designed levels – then you can use your knowledge of the upcoming challenges to balance your stats. In our simplified d20 system, for example, if you know that the player is mostly fighting combats where they’re outnumbered, you can change AC on your cost curve to be more valuable and thus more costly.

Another thing you can do, if you wanted AC and BAB to be equivalent and balanced with each other, is to change the mix of encounters in your game so that the player is outnumbered about half the time, and they outnumber the enemy about half the time. Aside from making your stats more balanced, this also adds some replay value to your game: going through the game with high BAB is going to give a very different experience than going through the game with a high AC; in each case, some encounters are going to be a lot harder than others, giving the player a different perspective and different level of challenge in each encounter.

The Cost of Switching

What if D&D worked in such a way that you could freely convert AC to BAB at the start of a combat, and vice versa? Now all of a sudden they are more or less equivalent to each other, and suddenly a +1 bonus to either one is much more powerful and versatile relative to any other bonuses in the rest of the game.

Okay, maybe you can’t actually do that in D&D, but there are plenty of games where you can swap out one situational thing for another. First-Person Shooters are a common example, where you might be carrying several weapons at a time: maybe a rocket launcher against big slow targets or clusters of enemies, a sniper rifle to use at a distance against single targets, and a knife for close-quarters combat. Each of these weapons is situationally useful some of the time, but as long as you can switch from one to another with minimal delay, it’s the sum of weapon capabilities that matters rather than individual weapon limitations.

That said, suppose we made the cost of switching weapons higher, maybe a 10-second delay to put one weapon in your pack and take out another (which when you think about it, seems a lot more realistic – I mean, seriously, if you’re carrying ten heavy firearms around with you and can switch without delay, where exactly are you carrying them all?). Now all of a sudden the limitations of individual weapons play a much greater role, and a single general-purpose weapon may end up becoming more powerful than a smorgasbord of situational weapons. But if instead you have instant real-time weapon change, a pile of weapons where each is the perfect tool for a single situation is much better than a single jack-of-all-trades, master-of-none weapon.

What’s the lesson here? We can mess with the situational balance of a game simply by modifying the cost of switching between different tools, weapons, stat distributions, or overall strategies.

That’s fine as a general theory, but how do the actual numbers work? Let’s see…

Example: Inability to Switch

Let’s take one extreme case, where you can’t switch strategies at all. An example might be an RPG where you’re only allowed to carry one weapon and equip one armor at a time, and whenever you acquire a new one it automatically gets rid of the old. Here, the calculation is pretty straightforward, because this is your only option, so we have to look at it across all situations. It’s a lot like an expected value calculation.

So, you ask: in what situations does this object have a greater or lesser value, and by how much? How often do you encounter those situations? Multiply and add it all together.

Here’s a simple, contrived example to illustrate the math: suppose you have a sword that does double damage against Dragons. Suppose 10% of the meaningful combats in your game are against Dragons. Let’s assume that in this game, damage has a linear relationship to your cost curve, so doubling the damage of something makes it exactly twice as good.

So, 90% of the time the sword is normal, 10% of the time it’s twice as good. 90%*1.0 + 10%*2.0 = 110% of the cost. So in this case, “double damage against dragons” is a +10% modifier to the base cost.

Here’s another example: you have a sword that is 1.5x as powerful as the other swords in its class, but it only does half damage against Trolls. And let’s further assume that half damage is actually a huge liability; it takes away your primary way to do damage, so you have to rely on other sources that are less efficient, and it greatly increases the chance you’re going to get yourself very killed if you run into a troll at a bad time. So in this case, let’s say that “half damage” actually makes the sword a net negative. But let’s also say that trolls are pretty rare, maybe only 5% of the encounters in the game are against trolls.

So if a typical sword at this level has a benefit of 100 (according to your existing cost curve), a 1.5x powerful sword would have a benefit of 150, and maybe a sword that doesn’t work actually has a cost of 250, because it’s just that deadly to get caught with your sword down, so to speak. The math says: 95%*150 + 5%*(-250) = 130. So this sword has a benefit of 130, or 30% more than a typical sword.

Again, you can see that there are actually a lot of ways you can change this, a lot of design “knobs” you can turn to mess with the balance here. You can obviously change the cost and benefit of an object, maybe adjusting the damage in those special situations to make it better or worse when you have those rare cases where it matters, or adjusting the base abilities to cover every other situation, just as you normally would with transitive mechanics. But with situational balance, you can also change the frequency of situations, say by increasing the number of trolls or dragons the player encounters – either in the entire game, or just in the area surrounding the place where they’d get that special sword. (After all, if the player is only expected to use this sword that loses to trolls in one region in the game that has no trolls, even if the rest of the game is covered in trolls, it’s not really much of a drawback, is it?)

Another Example: No-Cost Switching

Now let’s take the other extreme, where you can carry as many situational objects as you want and use or switch between them freely. In this case, the limitations don’t matter nearly as much as the strengths of each object, because there is no opportunity cost to gaining a new capability. In this case, we look at the benefits of all of the player’s objects collected so far, and figure out what this new object will add that can’t be done better by something else. Multiply the extra benefit by the percentage of time that the benefit is used, and there is your additional benefit from the new object. So it is a similar calculation, except in most cases we ignore the bad parts, because you can just switch away from those.

In practice, it’s usually not that simple. In a lot of games, the player may be able to use suboptimal strategies if they haven’t acquired exactly the right thing for this one situation (in fact, it’s probably better for most games to be designed that way). Also, the player may pick up new objects in a different order on each playthrough. End result: you don’t actually know how often something will be used, because it might be used more or less often depending on what other tools the player has already acquired, and also how likely they are to use this new toy in situations where it’s not perfect (they haven’t got the perfect toy for that situation yet) but it’s at least better than their other toys.

Let’s take an example. Maybe you have a variety of swords, each of which does major extra damage against a specific type of monster, a slight bump in damage against a second type of monster, and is completely ineffective against a third type of monster. Suppose there are ten of these swords, and ten monster types in your game, and the monster types are all about as powerful and encountered about as frequently. It doesn’t take a mathematician to guess that these swords should all cost the same.

However, we run into a problem. Playing through this game, we would quickly realize that they do not actually give equal value to the player at any given point in time.

For example, say I’ve purchased a sword that does double damage against Dragons and 1.5x damage against Trolls. Now there’s a sword out there that does double damage against Trolls, but that sword is no longer quite as useful to me as it used to be; I’m now going from a 1.5x multiplier to 2x, not 1x to 2x, so there’s less of a gain there. If I fully optimize, I can probably buy about half the swords in the game and have at least some kind of improved multiplier against most or all monsters, and from that point, extra swords have diminishing returns.

How do you balance a system like that? There are a few methods for this that I could think of, and probably a few more I couldn’t. It all depends on what’s right for your game.

  • Give a discount: One way is to actually change costs on the fly. Work it into your narrative that the more swords you buy from this merchant, the more he discounts additional swords because you’re such a good customer (you could even give the player a “customer loyalty card” in the game and have the merchant put stamps on it; some players love that kind of thing).
  • Let the player decide: Or, you could balance everything assuming the player has nothing, which means that yes, there will be a law of diminishing returns here, and it’s up to the player to decide how many is enough; consider that part of the strategy of the game.
  • Let the increasing money curve do the “discount” work for you: Maybe if the player is getting progressively more money over time, keeping the costs constant will itself be a “diminishing” cost to compensate, since each sword takes the player less time to earn enough to buy it. Tricky!
  • Discount swords found later in the game: Or, you can spread out the locations in the game where the player gets these swords, so that you know they’ll probably buy certain ones earlier in the game and other ones later. You can then cost them differently because you know that when the player finds certain swords, they’ll already have access to other ones, and you can reduce the costs of the newer ones accordingly.

Obviously, for games where you can switch between objects but there’s some cost to switching (a time cost, a money cost, or whatever), you’ll use a method that lies somewhere between the “can’t change at all” and “can change freely and instantly” extreme scenarios.

The Cost of Versatility

Now we’ve touched on this concept of versatility from a player perspective, if they are buying multiple items in the game that make their character more versatile and able to handle more situations. What about when the objects themselves are versatile? This happens a lot in real-time and turn-based strategy games, for example, where individual units may have several functions. So, maybe archers are really strong against fliers and really weak against footmen (a common RTS design pattern), but maybe you want to make a new unit type who are strong against both fliers and footmen, but not as strong as archers. So maybe an archer can take down a flier and take next to no damage, but this new unit would go down to about half HP in combat with a flier (it would win, but at a cost). This new unit isn’t as good against fliers, but it is good for other things, so they’re more versatile.

Taking another example, in a first-person shooter, knives and swords are usually the best weapons when you’re standing next to an opponent, while sniper rifles are great from a distance, but a machine gun is moderately useful at most ranges (but not quite as good as anything else). So you’ll never get caught with a totally ineffective weapon if you’ve got a machine gun, but you’ll also never have the perfect weapon for the job if you’re operating at far or close range a lot.

How much are these kinds of versatility worth?

Here’s the key: versatility has value in direct proportion to uncertainty. If you know ahead of time you’re playing on a small map with tight corridors and lots of twists and turns, knives are going to be a lot more useful than sniper rifles. On a map with large, open space, it’s the other way around. If you have a single map with some tight spaces and some open areas, a versatile weapon that can serve both roles (even if only mediocre) is much more valuable.

Suppose instead you have a random map, so there’s a 50/50 chance of getting either a map optimized for close quarters or a map optimized for distance attacks. Now what’s the best strategy? Taking the versatile weapon that’s mildly useful in each case but not as good as the best weapon means you’ll win against people who guessed poorly and lose against people who guessed well. There is no best strategy here; it’s a random guess. This kind of choice is actually not very interesting: the players must choose blindly ahead of time, and then most of the game comes down to who guessed right. Unless they’re given a mechanism for changing weapons during play in order to adjust to the map, or they can take multiple weapons with them, or something – ah, so we come back to the fact that versatility comes in two flavors:

  • The ability of an individual game object to be useful in multiple situations
  • The ability of the player to swap out one game object for another.

The more easily a player can exchange game objects, the less valuable versatility in a single object becomes.

Shadow Costs

Now, before we move on with some in-depth examples, I want to write a little bit about different kinds of costs that a game object can have. Strictly speaking, I should have talked about this when we were originally talking about cost curves, but in practice these seem to come up more often in situational balancing than other areas, so I’m bringing it up now.

Broadly speaking, we can split the cost of an object into two categories: the resource cost, and Everything Else. If you remember when doing cost curves, I generally said that any kind of drawback or limitation is also a cost, so that’s what I’m talking about here. Economists call these shadow costs, that is, they are a cost that’s hidden behind the dollar cost. If you buy a cheap clock radio for $10, there is an additional cost in time (and transportation) to go out and buy the thing, and if it doesn’t go off one morning when you really need it to because the UI is poorly designed and you set it for PM instead of AM then missing an appointment because of the poor design costs you additional time and money. If it then breaks in a few months because of its cheap components and you have to go replace or return it then that is an extra time cost, and so on… so it looks like it costs $10 but the actual cost is more because it has these shadow costs that a better-quality clock radio might not have.

In games, there are two kinds of shadow costs that seem to come up a lot in situational balance: sunk costs and opportunity costs. Let me explain each.

Sunk Costs

By sunk costs, I’m talking about some kind of setup cost that has to be paid first, before you gain access to the thing you want to buy in the first place. One place you commonly see these is in tech trees in RTSs, MMOs and RPGs. For example, in an RTS, in order to build certain kinds of units, you first typically need to build a structure that supports them. The structure may not do anything practical or useful for you, other than allowing you to build a special kind of unit. As an example, each Dragoon unit in StarCraft costs 125 minerals and 50 gas (that is its listed cost), but you had to build a Cybernetics Core to build Dragoons and that cost 200 minerals, and that cost is in addition to each Dragoon. Oh, and by the way, you can’t build a Cybernetics Core without also building a Gateway for 150 minerals, so that’s part of the cost as well. So if you build all these structures, use them for nothing else, and then create a single Dragoon, that one guy costs you a total of 475 minerals and 50 gas, which is a pretty huge cost compared to the listed cost of the unit itself!

Of course, if you build ten Dragoons, then the cost of each is reduced to 160 minerals and 50 gas each, a lot closer to the listed cost, because you only have to pay the build cost for those buildings once (well, under most cases anyway). And if you get additional benefits from those buildings, like them letting you build other kinds of units or structures or upgrades that you take advantage of, then effectively part of the cost of those buildings goes to other things so you can consider it to not even be part of the Dragoon’s cost.

But still, you can see that if you have to pay some kind of cost just for the privilege of paying an additional cost, you need to be careful to factor that into your analysis. When the cost may be “amortized” (spread out) over multiple purchases, the original sunk cost has to be balanced based on its expected value: how many Dragoons do you expect to build in typical play? When costing Dragoons, you need to factor in the up-front costs as well.

You can also look at this the other way, if you’re costing the prerequisite (such as those structures you had to build in order to buy Dragoon units): not just “what does this do for me now” but also “what kinds of options does this enable in the future”? You tend to see this a lot in tech trees. For example, in some RPGs or MMOs with tech trees, you might see some special abilities you can purchase on level-up that aren’t particularly useful on their own, maybe they’re even completely worthless… but they’re prerequisites for some really powerful abilities you can get later. This can lead to interesting kinds of short-term/long-term decisions, where you could take a powerful ability now, or a less powerful ability now to get a really powerful ability later.

You can see sunk costs in other kinds of games, too. I’ve seen some RPGs where the player has a choice between paying for consumable or reusable items. The consumables are much cheaper of course, but you only get to use them once. So for example, you can either buy a Potion for 50 Gold, or a Potion Making Machine for 500 Gold, and in that case you’d buy the machine if you expect to create more than ten Potions. Or you pay for a one-way ticket on a ferry for 10 Gold, or buy a lifetime pass for 50 Gold, and you have to ask yourself whether you expect to ride the ferry more than five times. Or you consider purchasing a Shop Discount Card which gives 10% off all future purchases, but it costs you 1000 Gold to purchase the discount in the first place, so you have to consider whether you’ll spend enough at that shop to make the discount card pay for itself (come to think of it, the choice to buy one of those discount cards at the real-world GameStop down the street requires a similar calculation). These kinds of choices aren’t always that interesting, because you’re basically asking the player to estimate how many times they’ll use something… but without telling them how much longer the game is or how many times they can expect to use the reusable thing, so it’s a kind of blind decision. Still, as designers, we know the answer, and we can do our own expected-value calculation and balance accordingly. If we do it right, our players will trust that the cost is relative to the value by the time they have to make the buy-or-not decision in our games.

Opportunity Costs

The second type of hidden cost, which I’m calling an opportunity cost here, is the cost of giving up something else, reducing your versatility. An example, also from games with tech trees, might be if you reach a point where you have to choose one branch of the tech tree, and if you take a certain feat or learn a certain tech or whatever, it prevents you from learning something else. If you learn Fire magic, you’re immediately locked out of all the Ice spells, and vice versa. This happens in questing systems, too: if you don’t blow up Megaton, you don’t get the Tenpenny Tower quest. These can even happen in tabletop games: one CCG I worked on had mostly neutral cards, but a few that were “good guy” cards and a few that were “bad guy” cards, and if you played any “good guy” cards it prevented you from playing “bad guy” cards for the rest of the game (and vice versa), so any given deck basically had to only use good or bad but not both. Basically, any situation where taking an action in the game prevents you from taking certain other actions later on, is an opportunity cost.

In this case, your action has a special kind of shadow cost: in addition to the cost of taking the action right now, you also pay a cost later in decreased versatility (not just resources). It adds a constraint to the player. How much is that constraint worth as a cost? Well, that’s up to you to figure out for your particular game situation. But remember that it’s not zero, and be sure to factor this into your cost curve analysis.

Versatility Example

How do the numbers for versatility actually work in practice? That depends on the nature of the versatility and the cost and difficulty of switching.

Here’s a contrived example: you’re going into a PvP arena, and you know that your next opponent either has an Ice attack or a Fire attack, but never both and never neither – always one or the other. You can buy a Protection From Ice enchantment which gives you protection from Ice attacks, or a Protection From Fire enchantment which gives you protection from Fire attacks (or both, if you want to be sure, although that’s kind of expensive). Let’s say both enchantments cost 10 Gold each.

Now, suppose we offer a new item, Protection From Elements, which gives you both enchantments as a package deal. How much should it cost? (“It depends!”) Okay, what does it depend on?

If you’ve been paying attention, you know the answer: it depends on how much you know about your next opponent up front, and it depends on the cost of switching from one to the other if you change your mind later.

If you know ahead of time that they will be, say, a Fire attack, then the package should cost the same as Protection from Fire: 10 Gold. The “versatility” here offers no added value, because you already know the optimal choice.

If you have no way of knowing your next opponent’s attack type until it’s too late to do anything about it, and you can’t switch protections once you enter the arena, then Protection From Elements should cost 20 Gold, the same as buying both. Here, versatility offers you exactly the same added value as just buying both things individually. There’s no in-game difference between buying them separately or together.

Ah, but what if you have the option to buy one before the combat, and then if the combat starts and you realize you guessed wrong, you can immediately call a time-out and buy the other one? In this case, you would normally spend 10 Gold right away, and there’s a 50% chance you’ll guess right and only have to spend 10 Gold, and a 50% chance you’ll guess wrong and have to spend an additional 10 Gold (or 20 Gold total) to buy the other one. The expected value here is (50%*10) + (50%*20) = 15 Gold, so that is what the combined package should cost in this case.

What if the game is partly predictable? Say you may have some idea of whether your opponent will use Fire or Ice attacks, but you’re not completely sure. Then the optimal cost for the package will be somewhere between the extremes, depending on exactly how sure you are.

Okay, so that last one sounds kind of strange as a design. What might be a situation in a real game where you have some idea but not a complete idea of what your opponent is bringing against you? As one example, in an RTS, I might see some parts of the army my opponent is fielding against me, so that gives me a partial (but not complete) sense of what I’m up against, and I can choose what units to build accordingly. Here, a unit that is versatile offers some value (my opponent might have some tricks up their sleeve that I don’t know about yet) but not complete value (I do know SOME of what the opponent has, so there’s also value in building troops that are strong against their existing army).

Case Studies in Situational Balance

So, with all of that said, let’s look at some common case studies.

Single-target versus area-effect (AoE)

For things that do damage to multiple targets instead of just one at a time, other things being equal, how much of a benefit is that splash damage?

The answer is generally, take the expected number of things you’ll hit, and multiply. So, if enemies come in clusters from 1 to 3 in the game, evenly distributed, then on average you’ll hit 2 enemies per attack, doing twice the damage you would normally, so splash damage is twice the benefit.

A word of warning: “other things being equal” is really tricky here, because generally other things aren’t equal in this case. For example, in most games, enemies don’t lose offensive capability until they’re completely defeated, so just doing partial damage isn’t as important as doing lethal damage. In this case, spreading out the damage slowly and evenly can be less efficient than using single-target high-power shots to selectively take out one enemy at a time, since the latter reduces the offensive power of the enemy force with each shot, while the area-effect attack doesn’t do that for awhile. Also, if the enemies you’re shooting at have varying amounts of HP, an area-effect attack might kill some of them off but not all, reducing a cluster of enemies to a few corpses and a smaller group (or lone enemy), which then reduces the total damage output of your subsequent AoE attacks – that is, AoE actually makes itself weaker over time as it starts working! So this is something you have to be careful of as well: looking at typical encounters, how often enemies will be clustered together, and also how long they’ll stay that way throughout the encounter.

Attacks that are strong (or weak) against a specific enemy type

We did an example of this before, with dragons and trolls. Multiply the extra benefit (or liability) as if it were always in effect during all encounters, by the expected percentage of the time it actually will matter (that is, how often do you encounter the relevant type of enemy).

The trick here, as we saw in that earlier example, is you have to be very careful of what the extra benefit or liability is really worth, because something like “double damage” or “half damage” is rarely double or half the actual value.

Metagame objects that you can choose to use or ignore

Sometimes you have an object that’s sometimes useful and sometimes not, but it’s at the player’s discretion whether to use it – so if the situation doesn’t call for it, they simply don’t spend the resources.

Examples are situational weapons in an FPS that can be carried as an “alternate” weapon, specialized units in an RTS that can be build when needed and ignored otherwise, or situational cards in a CCG that can be “sideboarded” against relevant opponents. Note that in these cases, they are objects that depend on things outside of player control: what random map you’re playing on, what units your opponent is building, what cards are in your opponent’s deck.

In these cases, it’s tempting to cost them according to the likelihood that they will be useful. For example, if I have a card that does 10 damage against a player who is playing Red in Magic, and I know that most decks are 2 or 3 colors so maybe 40-50% of the time I’ll play against Red in open play, then we would cost this the same as a card that did 4 or 5 damage against everyone. If the player must choose to use it or not before play begins, with no knowledge of whether the opponent is playing Red or not, this would be a good method.

But in some of these cases, you do know what your opponent is doing. In a Magic tournament, after playing the first game to best-of-3, you are allowed to swap some cards into your deck from a “Sideboard”. You could put this 10-damage-to-Red card aside, not play with it your first game, and then bring it out on subsequent games only if your opponent is playing Red. Played this way, you are virtually assured that the card will work 100% of the time; the only cost to you is a discretionary card slot in your sideboard, which is a metagame cost. As we learned a few weeks ago, trying to cost something in the game based on the metagame is really tricky. So the best we can say is that it should cost a little less to compensate for the metagame cost, but it probably shouldn’t be half off like it would be if the player always had to use it… unless we want to really encourage its use as a sideboard card by intentionally undercosting it.

Likewise with a specialized RTS unit, assuming it costs you nothing to earn the capability of building it. If it’s useless most of the time, you lose nothing by simply not exercising your option to build it. But when it is useful, you will build it, and you’ll know that it is useful in that case. So again, it should be costed with the assumption that whatever situation it’s built for, actually happens 100% of the time. (If you must pay extra for the versatility of being able to build the situational unit in the first place, that cost is what you’d want to adjust based on a realistic percentage of the time that such a situation is encountered in real play.)

With an alternate weapon in an FPS, a lot depends on exactly how the game is structured. If the weapons are all free (no “resource cost”) but you can only select one main and one alternate, then you need to make sure the alternates are balanced against each other, i.e. that each one is useful in equally likely situations, or at least that if you multiply the situational benefit by the expected probability of receiving that benefit, that should be the same across all weapons (so you might have a weapon that’s the most powerful in the game but only in a really rare situation, versus a weapon that’s mediocre but can be used just about anywhere, and you can call those balanced if the numbers come out right).

Metagame “combos”

Now, we just talked about situations where the player has no control. But what if they do have control… that is, if something isn’t particularly useful on its own, but it forms a powerful combo with something else? An example would be dual-wielding in an FPS, “support” character classes in an MMO or multiplayer FPS, situational cards that you build your deck around in a CCG, support towers in a Tower Defense game that only improve the towers next to them, and so on. These are situational in a different way: they reward the player for playing the metagame in a certain way.

To understand how to balance these, we first have to return to the concept of opportunity costs from earlier. In this case, we have a metagame opportunity cost: you have to take some other action in the game completely apart from the thing we’re trying to balance, in order to make that thing useful. There are a few ways we could go about balancing things like this, depending on the situation.

One is to take the combo in aggregate and balance that, then try to divide that up among the individual components based on how useful they are outside of the combo. For example, Magic had two cards, Lich and Mirror Universe:

  • Lich reduced you to zero life points, but added additional rules that effectively turned your cards into your life – this card on its own was incredibly risky, because if it ever left play you would still have zero life, and thus lose the game immediately! Even without that risk, it was of questionable value, because it basically just helped you out if you were losing, and cards that are the most useful when you’re losing mean that you’re playing to lose, which isn’t generally a winning strategy.
  • Mirror Universe was a card that would swap life totals with your opponent – not as risky as Lich since you’re in control of when to use it, but still only useful when you’re losing and not particularly easy to use effectively.
  • But combined… the two cards, if uncountered, immediately win you the game by reducing your life to zero and then swapping totals with your opponent: an instant win!

How do you cost this? Now, this is a pretty extreme example, where two cards are individually all but useless, don’t really work that well in any other context, but combined with each other are all-powerful. The best answer for a situation like this might be to err on the side of making their combined cost equal to a similarly powerful game-winning effect, perhaps marked down slightly because it requires a two-card combination (which is harder to draw than just playing a single card). How do you split the cost between them – should one be cheap and the other expensive, or should they both be about the same? Weight them according to their relative usefulness. Lich does provide some other benefits (like drawing cards as an effect when you gain life) but with a pretty nasty drawback. Mirror Universe has no drawback, and a kind of psychological benefit that your opponent might hold off attacking you because they don’t want to almost kill you, then have you use it and plink them to death. These are hard to balance against one another directly, but looking at what actually happened in the game, their costs are comparable.

How about a slightly less extreme example? A support character class in an MMO can offer lots of healing and attribute bonuses that help the rest of their team. On their own they do have some non-zero value (they can always attack an enemy directly if they have to, if they can heal and buff themselves they might even be reasonably good at it, and in any case they’re still a warm body that can distract enemies by giving them something else to shoot at). But their true value shows up in a group, where they can take the best members of a group and make them better. How do you balance something like this?

Let’s take a simple example. Suppose your support character has a special ability that increases a single ally’s attack value by 10%, and that they can only have one of these active at a time, and this is part of their tech tree; you want to find the expected benefit of that ability so you can come up with an appropriate cost. To figure out what that’s worth, we might assume a group of adventurers of similar level, and find the character class in that group with the highest attack value, and find our expected attack value for that character class. In a group, this “attack buff” support ability would be worth about 10% of that value. Obviously it would be less useful if questing solo, or with a group that doesn’t have any good attackers, so you’d have to figure the percentage of time that you can expect this kind of support character to be traveling with a group where this attack boost is useful, and factor that into your numbers. In this case, the opportunity cost for including an attacker in your party is pretty low (most groups will have at least one of those anyway), so this support ability is almost always going to be operating at its highest level of effectiveness, and you can balance it accordingly.

What do the Lich/Mirror Universe example and the support class example have in common? When dealing with situational effects that players have control over, a rule of thumb is to figure out the opportunity costs for them setting up that situation, and factoring that in as a “cost” to counteract the added situational benefit. Beyond that, the cost should be computed under best case situations, not some kind of “average” case: if the players are in control of whether they use each part of the combo, we can assume they’re going to use it under optimal conditions.

Multi-class characters

As long as we’re on the subject of character classes, how about “multi-class” characters that are found in many tabletop RPGs? The common pattern is that you gain versatility, in that you have access to the unique specialties of several character types… but in exchange for that, you tend to be lower level and less powerful in all of those types than if you were dedicated to a single class. How much less powerful do you have to be so that multi-classing feels like a viable choice (not too weak), but not one that’s so overpowered that there’s no reason to single-class?

This is a versatility problem. The player typically doesn’t know what kinds of situations their character will be in ahead of time, so they’re trying to prepare for a little of everything. After all, if they knew exactly what to expect, they would pick and choose the most effective single character class and ignore the other! However, they do probably have some basic idea of what they’re going to encounter, or at least what capabilities their party is going to need that are not yet accounted for, so a Level 5 Fighter/Thief is probably not as good as a Level 10 Fighter or Level 10 Thief. Since the player must choose ahead of time what they want and they typically can’t change their class in the middle of a quest, they are more constrained, so you’ll probably do well with a starting guess of making a single class 1.5x as powerful as multi-class and then adjusting downward from there as needed. That is, a Level 10 single-class is usually about as powerful as a Level 7 or 8 dual-class.

Either-or choices from a single game object

Sometimes you have a single object that can do one thing or another, player’s choice, but not both (the object is typically either used up or irreversibly converted as part of the choice). Maybe you have a card in a CCG that can bring a creature into play or make an existing one bigger. Or you have a lump of metal in an RPG that can be fashioned into a great suit of armor or a powerful weapon. Or you’re given a choice to upgrade one of your weapons in an FPS. In these kinds of cases, assuming the player knows the value of the things they’ll get (but they can only choose one), the actual benefit is probably going to be more than either option individually, but less than all choices combined, depending on the situation. What does it depend on? This is a versatility problem, so it depends on the raw benefit of each choice, the cost/difficulty of changing their strategy in mid-game, and the foreknowledge of the player regarding the challenges that are coming up later.

The Difference Between PvE and PvP

Designing PvE games (“Player versus Environment,” where it’s one or more players cooperating against the computer, the system, the AI or whatever) is different than PvP games (“Player versus Player,” where players are in direct conflict with each other) when it comes to situational balance.

PvE games are much easier. As the game’s designer, you’re designing the environment, you’re designing the levels, you’re designing the AI. You already know what is “typical” or “expected” in terms of player encounters. Even in games with procedurally-generated content where you don’t know exactly what the player will encounter, you know the algorithms that generate it (you designed them, after all) so you can figure out the expected probability that the content generator will spit out certain kinds of encounters, and within what range.

Because of this, you can do expected-value calculations for PvE games pretty easily to come up with at least a good initial guess for your costs and benefits when you’re dealing with the situational parts of your game.

PvP is a little trickier, because players can vary their strategies. “Expected value” doesn’t really have meaning when you don’t know what to expect from your opponent. In these cases, playtesting and metrics are the best methods we have for determining typical use, and that’s something we’ll discuss in more detail over the next couple of weeks.

If You’re Working on a Game Now…

Choose one object in your game that’s been giving you trouble, something that seems like it’s always either too good or too weak, and which has some kind of conditional or situational nature to it. (Since situational effects are some of the trickiest to balance, if something has been giving you trouble, it’s probably in that category anyway.)

First, do a thorough search for any shadow costs you may have. What opportunities or versatility do you have to give up in order to gain this object’s capabilities? What other things do you have to acquire first before you even have the option of acquiring this object? Ask yourself what those additional costs are worth, and whether they are factored in to the object’s resource cost.

Next, consider the versatility of the object itself. Is it something that’s useful in a wide variety of situations, or only rarely? How much control does the player have over their situation – that is, if the object is only useful in certain situations, can the player do anything to make those situations more likely, thus increasing the object’s expected value?

How easy is it for the player to change their mind (the versatility of the player versus versatility of the object, since a more versatile player reduces the value of object-based versatility) – if the player takes this object but then wants to replace it with something else, or use other objects or strategies when they need to, is that even possible… and if so, is it easy, or is there a noticeable cost to doing so? How much of a liability is it if the player is stuck in a situation where the object isn’t useful? Now, consider how the versatility of the game’s systems and the versatility of the individual objects should affect their benefits and costs.

See if looking at that object in a new way has helped to explain why it felt too weak or too powerful. Does this give you more insight into other objects as well, or the game’s systems overall?

Homework

For your “homework”, we’re going to look at Desktop Tower Defense 1.5, which was one of the games that popularized the genre of tower defense games. (I’ll suggest you don’t actually play it unless you absolutely have to, because it is obnoxiously addicting and you can lose a lot of otherwise productive time just playing around with the thing.)

DTD 1.5 is a great game for analysis of situational game balance, because nearly everything in the game is situational! You buy a tower and place it down on the map somewhere, and when enemies come into range the tower shoots at them. Buying or upgrading towers costs money, and you get money from killing the enemies with your towers. Since you have a limited amount of money at any time in the game, your goal is to maximize the total damage output of your towers per dollar spent, so from the player’s perspective this is an efficiency problem.

The situational nature of DTD

So, on the surface, all you have to do is figure out how much damage a single tower will do, divide by cost, and take the tower with the best damage-to-cost ratio. Simple, right?

Except that actually figuring out how much damage your towers do is completely situational! Each tower has a range; how long enemies stay within that range getting shot at depends entirely on where you’ve placed your towers. If you just place a tower in the middle of a bunch of open space, the enemies will walk right by it and not be in danger for long; if you build a huge maze that routes everyone back and forth in range of the tower in question, its total damage will be a lot higher.

Furthermore, most towers can only shoot one enemy at a time, so if a cluster of enemies walks by, its total damage per enemy is a lot smaller (one enemy gets shot, the others don’t). Other towers do area-effect or “splash” damage, which is great on clusters but pretty inefficient against individual enemies, particularly those that are spaced out because they move fast. One of the tower types doesn’t do much damage at all, but slows down enemies that it shoots, which keep them in range of other towers for longer, so the benefit depends on what else is out there shooting. Some towers only work against certain types of enemies, or don’t work against certain enemy types, so there are some waves where some of your towers are totally useless to you even if they have a higher-than-normal damage output at other times. And then there’s one tower that does absolutely nothing on its own, but boosts the damage output of all adjacent towers… so this has a variable cost-to-benefit ratio depending on what other towers you place around it. Even more interesting, placing towers in a giant block (to maximize the effectiveness of this boost tower) has a hidden cost itself, in that it’s slightly less efficient in terms of usage of space on the board, since there’s this big obstacle that the enemies get to walk around rather than just having them march through a longer maze. So, trying to balance a game like this is really tough, because everything depends on everything else!

Your mission, should you choose to accept it…

Since this is a surprisingly deep game to analyze, I’m going to constrain this to one very small part of the game. In particular, I want you to consider two towers: the Swarm tower (which only works against flying enemies but does a lot of damage to them) and the Boost tower (that’s the one that increases the damage of the towers around it). Now, the prime spot to put these is right in the center of the map, in this little 4×3 rectangular block. Let’s assume you’ve decided to dedicate that twelve-tower area to only Swarm and Boost towers, in order to totally destroy the flying enemies that come your way. Assuming that you’re trying to minimize cost and maximize damage, what’s the optimal placement of these towers?

To give you some numbers, a fully-upgraded Swarm tower does a base of 480 damage per hit, and costs $640 in the game. A fully-upgraded Boost tower costs $500 and does no damage, but improves all adjacent towers (either touching at a side or a corner) by +50%, so in practical terms a Boost tower does 240 damage for each adjacent Swarm tower. Note that two Boost towers adjacent to each other do absolutely nothing for each other – they increase each other’s damage of zero by +50%, which is still zero.

Assume all towers will be fully upgraded; the most expensive versions of each tower have the most efficient damage-to-cost ratios.

The most certain way to solve this, if you know any scripting or programming, is to write a brute-force program that runs through all 3^12 possibilities (no tower, Swarm tower or Boost tower in each of the twelve slots). For each slot, count a damage of 480 if a Swarm tower, 240*(number of adjacent Swarm towers) for a Boost tower, or 0 for an empty slot; for cost, count 640 per Swarm tower, 500 for each Boost tower, and 0 for an empty slot. Add up the total damage and cost for each scenario, and keep track of the best damage-to-cost ratio (that is, divide total damage by total cost, and try to get that as high as possible).

If you don’t have the time or skills to write a brute-force program, an alternative is to create an Excel spreadsheet that calculates the damage and cost for a single scenario. Create a 4×3 block of cells that are either “B” (boost tower), “S” (swarm tower), or blank.

Below that block, create a second block of cells to compute the individual costs of each cell. The formula might be something like:

=IF(B2=”S”,640,IF(B2=”B”,500,0))

Lastly, create a third block of cells to compute the damage of each cell:

=IF(B2=”S”,480,IF(B2=”B”,IF(A1=”S”,240,0)+IF(A2=”S”,240,0)+IF(A3=”S”,240,0)+IF(B1=”S”,240,0)+IF(B3=”S”,240,0)+IF(C1=”S”,240,0)+IF(C2=”S”,240,0)+IF(C3=”S”,240,0),0))

Then take the sum of all the damage cells, and divide by the sum of all the cost cells. Display that in a cell of its own. From there, all you need to do is play around with the original cells, changing them by hand from S to B and back again to try to optimize that one final damage-to-cost value.

The final deliverable

Once you’ve determined what you think is the optimal damage-to-cost configuration of Swarm and Boost towers, figure out the actual cost and benefit from the Swarm towers only, and the cost and benefit contributed by the Boost towers. Assuming optimal play, and assuming only this one very limited situation, which one is more powerful – that is, on a dollars-for-damage basis, which of the two types of tower (Swarm or Boost) contributes more to your victory for each dollar spent?

That’s all you have to do, but if you want more, you can then take it to any level of analysis you want – as I said, this game is full of situational things to balance. Flying enemies only come every seventh round, so if you want to compute the actual damage efficiency of our Swarm/Boost complex, you’d have to divide by 7. Then, compare with other types of towers and figure out if some combination of ground towers (for the 6 out of 7 non-flying levels) and the anti-flying towers should give you better overall results than using towers that can attack both ground and air. And then, of course, you can test out your theories in the game itself, if you have the time. I look forward to seeing some of your names in the all-time high score list.

Advertisements

5 Responses to “Level 6: Situational Balance”

  1. anon234 Says:

    +10 AC makes you invulnerable, while +10 BAB only doubles your attack damage. For a really accurate analysis, one should concentrate on the multiplicative ratios rather than the additive differences; each point has a small ratio when most hits land, and a huge ratio when most miss. (Diminishing/increasing returns). In games like Warcraft they avoid the massive increasing returns on the edge of the scale by capping it (miss chance) or fitting in a formula that’s reverse-designed to simulate constant return (armor effect).

    It doesn’t matter whether you’re fighting 4 enemies or 1 enemy — +1 BAB increases your effectiveness by the same ratio in either situation, and +1 AC increases your effectiveness by the same ratio in either situation. The “factors in 4 times as often” doesn’t matter in comparison. For example, if it started as an even fight, each roll that involves your BAB is 4 times as important as each roll that involves your AC (because your hits are decreasing their total hp by a much larger percent than each of their single hits).

  2. Mitar Says:

    I am interested how should we price in game equipment which gives benefits depending on the skill and concentration of the player?

    For example:
    In “Bayonetta” there is an accessory which when equipped automatically dodges incoming enemy attacks at the last moment, if the player didn’t dodge them.

    Another example is in “Renosance of Fate”. During the player’s turn a player may aim at an enemy which consumes a gauge (once depleted the turn ends). While aiming, another gauge fills up, when it reaches max the player may attack or wait for it to fill up again and then attack more then once. But if the gauge that represents the time remaining in that turn runs out, the player doesn’t attack.
    There is an item in the game which you can equip that automatically attacks at the last moment, so that the players turn doesn’t go to waste.

    Should these items be very expensive, or very cheap (beacuse a skilled player doesn’t gain anything from these items and they use up the space the player could use for another item)?

    • ai864 Says:

      Mitar – great question! I don’t think there’s a single “right” answer for this, instead it depends on what game experience you want to create.

      If you intend for your game to target the “hardcore” market, and you’re making a game where the core mechanic is (say) run-and-gun shooting, then an auto-aim or auto-dodge feature that essentially did the player’s work for them to win the game without player assistance should be very expensive (if included at all). If instead you’re making a game that’s more about exploration than combat, and it’s supposed to be a bit less demanding, then cheap items that help the player out of combat sound reasonable.

      Another common pattern with games that exercise lots of different skills, is to make these things all relatively cheap, but limit the number the player can have active at a time. For example, in BioShock, there are items that help the player with shooting or melee combat, or that help with the hacking mini-game, and so on… so a player who’s not that great at hacking but really good at shooting can equip the things that help with hacking (and just rely on their natural shooting ability), or I suppose they can equip things that make their shooting even better, ignore the hacking, and play to their strengths. So this turns what would normally be a balance problem (how much do you pay for these?) into an interesting choice (which of these advantages do you want?).

      Yet another option is to make the item cheap but suboptimal. For example, suppose you have a weapon that requires the player to push a button to charge a meter, and if they release the button at just the right time there’s a big damage bonus, but releasing it at the wrong time makes a damage penalty. You could include an item (or even just a menu option) that the player can use or not at their discretion, which would remove the meter-charging mini-game; instead the player gets a small damage bonus, smaller than if they did the mini-game properly, but bigger than if they totally messed up.

  3. Hellfish Says:

    “Since the player must choose ahead of time what they want and they typically can’t change their class in the middle of a quest, they are more constrained, so you’ll probably do well with a starting guess of making a single class 1.5x as powerful as multi-class and then adjusting downward from there as needed.

    That is, a Level 10 single-class is usually about as powerful as a Level 7 or 8 dual-class.”

    Shouldn’t this be the other way around? A level 7 or 8 single class should be about as powerful as a level 10 dual class to make up for being useful in fewer situations?

    • ai864 Says:

      To clarify, “level” in this context is used as in D&D and most other role-playing games: higher level = more powerful.
      Single class means, basically, your skills are in a single domain. You can do one thing and do it well.
      Dual class means that you have skills from two domains, so your skill set is more broad and you’re able to handle a wider variety of situations than a single-class character. This is an advantage, so it is balanced by the disadvantage of being lower level than a single class would be at the same point in time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: