November 7, 2012

Unpredictability and control in turn-based combat: an examination

Unpredictability makes art interesting. Twists of plot, unconventional characterizations, and surprising character development engage a reader’s imagination; unique instrumentation, sudden shifts in time signature, or an unexpected chord progression delight the ear.

So is it with games. Exploration, experimentation, discovery: all of these depend upon unpredictability, on gaps in the player’s familiarity with the game. Challenge exists only where the player cannot know exactly how a scenario is going to play out ahead of time. This is the sort of unpredictability we are going to talk about today: since it concerns game mechanics, let’s call it mechanical unpredictability.

Real-time games, as a general rule, have an easy time fostering mechanical unpredictability. Spatial navigation requires accuracy and timing; a real-time attack could miss or hit depending on a player’s physical input. The chance of making a mistake in the heat of the moment adds uncertainty, and thus tension.

Without this sort of real-time interaction, turn-based games must look elsewhere for their mechanical unpredictability. Many developers working on turn-based games mistakenly believe that unpredictability is necessarily bound up in randomness. Indeed, there is an assumption prevalent in the design community that any turn-based game without randomness will feel stale, predictable, devoid of tension.

This is a misapprehension, however. Randomness creates uncertainty, it is true, but so do other elements. This piece will examine a variety of tension-building elements, from the basic die roll to other methods that—quite undeservedly—receive less attention and respect. Each method has its benefits and its costs, though some entail a higher cost than others. We’ll begin with the most obvious, then discuss it in comparison to other methods that tend to get overlooked.

 

Randomized results

Randomized results are the very first thing any game developer thinks of when trying to add unpredictability to a turn-based combat system, so let’s talk about that technique first.

Randomized results are what happens when you interpose chance between a player’s chosen action and the results of that action. The results are determined by recourse to randomly chosen numbers: hence, “randomized results.”

If you have played RPGs for any length of time, you are already intimately familiar with randomized results. The ubiquitous “chance to hit” is a perfect example of a randomized result; so is variable attack damage. These implementations have proven incredibly popular with game developers ever since students first started cloning Dungeons and Dragons mechanics on a PLATO mainframe.

Aside from the fact that these mechanics have a long tradition, the simple fact is that randomizing results is the easiest possible way to add unpredictability to a turn-based combat system. “I ordered my character to attack, but I cannot know if the attack will actually land.” This takes very little effort to implement, but it still hides information from the player, and therefore builds tension fairly effectively.

However, the use of randomized results comes at a cost. As I’ve discussed in the past, excessive reliance on randomized results tends to produce two big problems:

  1. Excessively randomized results obscure the likely outcome of individual player actions, resulting in more opaque mechanics.
  2. Excessively randomized results take control away from the player, creating a watered-down sense of player responsibility for the outcome of battles. (“That was a bad die roll!” “The random number generator screwed me!” etc.)

In a well-designed real-time game, the player is willing to accept defeat over and over again if the controls are tight and responsive. The player knows that she and she alone is in control of her character. If she dies, it is because of some combination of three factors: (1) she wasn’t fast enough, (2) she wasn’t clever enough, or (3) she wasn’t accurate enough in responding to what was happening on the screen. It’s her fault, and she is likely to accept that fact, soldiering on with renewed determination. Game developers working on action games focus on the importance of tight controls for precisely this reason: because it means the difference between commitment and frustration, between the player taking responsibility for her failure or concluding that the game itself is flawed.

This same principle applies to turn-based games as well, though the “control” at issue is of a different sort. As with real-time games, turn-based games must respond predictably to chosen actions; without that connection, the player will not feel responsible for the outcome.

While predictability hinges on responsiveness in real-time games, in turn-based games, it is largely a matter of determinism. Many turn-based games (particularly those with combat systems built to imitate the D&D model) feature battles in which the player can engage in the same preparation and use the same tactics, but nonetheless get vastly different results based on invisible, randomized numbers outside of the player’s control. Thus, although randomized results create uncertainty, they can also sabotage the sense that a player is responsible for her failures, which is bad.

image-1648

A simplistic example illustrates the point:

Suppose that Bob is playing an RPG where he controls a party of five characters facing off against a troll. None of his characters have any guaranteed-hit attacks available. Suppose that Bob needs three of his five characters to hit the troll to kill it; also suppose that the troll will almost certainly kill one of Bob’s characters if the troll is not killed on this turn. Bob commands the party to attack.

In a deterministic system, when Bob commands all five characters to attack the enemy, they will all hit. His choices were entirely responsible for his victory over the enemy, and so he is 100% responsible for his ensuing victory.

But let’s say that we have a system with randomized results; let’s say that each character has an 80% chance to strike the troll. In this scenario, four or more characters might miss their attacks despite the fact that probability strongly favors a better result. While unlikely, let us suppose that four or five characters miss. The troll survives the turn, and one of Bob’s characters is slain.

Did Bob command his characters to miss? Of course not; the game chose to nullify his chosen actions on the basis of invisible, randomly selected numbers. Nor can we say that Bob made a poor tactical decision; he made his choice based on what was by far the most likely numerical result (namely, that at least three of his characters would strike the enemy). In all likelihood, Bob can reload his previous saved game, replay this scenario, make the exact same decision, and nonetheless get a completely different outcome. Bob is not responsible for the fact that the enemy survived here, and will be quite justified in assigning at least partial credit for this failure to factors outside his control.

This is one of the perverse realities of probability: although the probability of missing five 80% chance-to-hit attacks in a row is far less than 1%, each individual “die roll” is independent of the others. So in reality, there is actually an entirely probable 1-in-5 chance of missing each individual attack, no matter whether the ones before it hit or missed.

Randomized attack damage, featured by Dungeons and Dragons and many of its closer imitators, just amplifies the problem.

Let’s take our Bob example again. Suppose that each character deals 1d6 damage; if all five characters hit, the total damage will be the sum of five six-sided die rolls. As a general rule when rolling multiple dice, the most likely result is always just a little bit higher than half the maximum possible roll. For example: when rolling two 6-sided dice, the most likely sum is not 6 (half of 12, the maximum possible roll)—the most likely sum is actually 7. Likewise, when rolling five 6-sided dice, the most likely sums are 17 and 18, not 15.

Now, let’s say that the troll has 17 health points left. Let’s also say that the five characters’ attack rolls add up to 16. What were the chances of rolling beneath both of the most likely sums? The answer: just over 39%.

So far, not too bad. But let’s get a little crazy. Let’s say that the troll has only 11 health left. We’d have to have fantastically bad luck to roll 10 or lower on 5d6, wouldn’t we? It seems that we would: the probability of getting a sum of 10 or lower across five rolls is only 1.620%! Couldn’t happen, right?

Of course it can. Remember, every die roll is independent of the others. Every roll carries an even chance of rolling any number on the die, and a greater than 33% chance of rolling a 2 or lower. The 1.620% figure only accounts for the numbers you haven’t rolled yet. So once you roll three 1s and a 3, you still have a dead even chance of rolling 3 or lower on your last roll and getting a sum total of 9. Ultimately, it does not matter that the entire sequence of events at first seemed wildly unlikely.

And though it may be fairly uncommon for your players to get totally screwed in this fashion, this is actually not an especially good argument in favor of randomized results. The fact that it seems so improbable just means that when it does happen, it will feel like the game equivalent of getting struck by lightning out of a clear sky: arbitrary and painful.

The simple fact is that adding yet another layer of randomness in between a player’s tactical choices and the outcome of those choices further distances the player’s input from what happens on the screen. The player thus becomes even more likely to grow frustrated when the game fails to respond predictably to her choices. Although randomized results add unpredictability, they do so while (1) decreasing player control and (2) incurring a corresponding increase in player antipathy. This phenomenon is especially problematic in high-stakes situations, where randomized results can cause the player to face serious consequences (e.g. permadeath) even if he makes the most optimal move.

On top of all of this, excessive use of randomized results also renders a game’s mechanics more opaque. Think back to the discussion about the probabilities of various die rolls that we just had above. Did you find all of that clear and elegant, or did you find it sort of confusing and unintuitive? More to the point: how many of your players do you suppose will understand what’s happening there?

The more you rely upon randomized results, the more your players will have to engage in analysis like this to understand your game’s mechanics. I don’t think it will be too controversial for me to say that it is not exactly desirable for us to force higher order math on players who wish to understand how to make good decisions in our games. There must be a better way to generate unpredictability.

Tactical complexity and second party uncertainty

Luckily, unpredictability is not just a spark that flickers into existence for the moment between issuing a command and watching the game’s onscreen interpretation of it. Unpredictability can also exist on a much broader level. Developers can employ a combination of clever AI and tactical depth to keep turn-based combat unpredictable and wrought with tension.

Chess and Go are a fine example for us to look at. As we know, Chess and Go do not have an ounce of randomness in them. Every last move is 100% deterministic in its effects. It is never unclear what happens if your knight moves onto a pawn’s space: the knight takes the pawn. Period. End of story. Likewise, you’ll never sit there biting your nails, wondering what happens when you surround a group of enemy pieces in Go. The pieces are either taken or not taken based on a simple, unchanging rule. The results of the move are entirely predictable.

And yet, matches of Chess and Go can positively drip tension, the end results of any given match wildly uncertain. How is that possible? The answer lies not in what happens after the player selects a move, but rather in what happens beforehand. In Chess and Go, the player faces a black box full of dangerous and unpredictable moves. This is possible only because each of these games sports two characteristics: (1) a thinking opponent and (2) a large possibility space.

As you no doubt divined, the clever opponent is the primary source of unpredictability here. A clever opponent will go out of its way to seize on weaknesses in a player’s plan. The player never knows for certain which move such an opponent will opt for, and therefore has to tread carefully to avoid having her own moves exploited. In order to succeed, the player has to try to guess the opponent’s likely response to each move from among multiple viable options: in short, to outwit him. This is a huge source of unpredictability—and thus, tension.

image-1649

However, a sufficiently large possibility space is essential to make this work well. I’ll quote Ian Bogost here for a definition of “possibility space”:

In a video game, the possibility space refers to the myriad configurations the player might construct to see the ways the processes inscribed in the system work.

This is somewhat similar to what programmers refer to as the state space, meaning the number of possible states the game can exist in from a game’s start until completion.

A cunning opponent can be hamstrung by an overly simplistic combat system. Consider Tic-Tac-Toe, a deterministic game with (as games go) a tiny possibility space. Every turn past the first presents only a single optimal move. The only option for a clever opponent is to fight the player to a draw. (As Randall Munroe of XKCD puts it: “The only winning move is to play, perfectly, waiting for your opponent to make a mistake.”) Because the optimal counter to every move is predictable, there is no tension in fighting a clever opponent in a game of Tic-Tac-Toe.

Chess and Go, by contrast, have massive possibility spaces. On any given turn, there are numerous viable moves; if there exists a single optimal move, it is obscured by the massive number of choices on offer and the unique state of the playing field. This renders the game unpredictable.

I choose to call this phenomenon second party uncertainty, since it concerns uncertainty about what the second party—the opponent—will do. Second party uncertainty differs fundamentally from the uncertainty imposed by randomized results, in that its tension arises not from whether the game will choose to nullify your commands, but from whether those commands are themselves good enough. To analogize to real-time games for a moment: second party uncertainty is the equivalent of playing a hotly contested match of Super Street Fighter IV and feeling out your opponent for weaknesses while trying desperately not to slip up. Randomized results are the equivalent of knowing that the game is going to occasionally not register your button presses. Both offer tension and unpredictability, but one is of a clearly superior variety.

The uses of randomized results

Having just argued so strongly against the use of randomized results, you may surprised to hear that I am now going to discuss reasons to use randomized results.

Much of my design philosophy over the past six years has been a reaction against the widespread overreliance on randomized results I saw in RPGs and turn-based strategy games. My goal was simple: put control back in the hands of the player. A good strategy will work; a bad strategy will not. Period. No more wasting time reloading the game because your characters missed too many attacks in a row.

To that end, I did away with randomized results beginning with Telepath RPG Chapter 2. From that game onward, the Telepath combat system was almost entirely deterministic: attacks always hit, and they almost always did the same damage. Targets with elemental resistance took less damage and backstabbed targets took more, but the damage always changed according to a fixed percentage, entirely predictable to the experienced player.

Recently, I’ve been looking for ways to deepen the system, and that has led me to question whether pure determinism is really the best way to go.

Arguably, the biggest problem with the choice to rely exclusively on tactical uncertainty to promote unpredictability is that the AI must be truly clever and varied, or else the player is eventually going to figure out how it thinks. Once that happens, the player will be able to beat the AI consistently and without difficulty. When the only uncertainty in a battle consists of the choices the AI will make, definitionally, there can be no uncertainty left once the AI becomes predictable.

I first encountered this argument after releasing Telepath Psy Arena 2. It’s a clever argument, but really this is an argument for better AI, not an argument for randomized results. Making attacks randomly hit or miss, or making them randomly deal 1-6 damage instead of just 6 damage, is the proverbial finger in the dyke. It is a cheap solution that does little to fix a glaring structural weakness in the game; a game of craps attempting to stand in for a clever and unpredictable opponent.

A second potential issue is personality-based. For some, failure in a game bruises their sense of themselves as competent people. In their minds, they didn’t just lose because they tried a strategy that didn’t work; they lost because they are intrinsically not smart enough, not good enough. The ego is much too tightly wrapped up in the results of particular challenges, producing a personalization of loss that can be emotionally crushing. The mediation of the dice provides an “out,” a way of walking away from a loss without feeling totally responsible. In short, it’s the flip side of my argument above: determinism promotes a feeling of player responsibility, but perhaps some players don’t want to feel wholly responsible.

Personally, I’m not convinced that this is a good reason to add in heavy randomization. If you aren’t responsible for your loss because the dice intervened in the outcome, then what does that say about the moment when you actually win? Is that victory as meaningful? Insofar as such a thing can be stated objectively, I feel comfortable in saying that beating someone in chess is objectively a greater accomplishment than beating them in Mario Party—or in Risk, for that matter. The more luck victory requires, the less you can say to have achieved victory solely through your own wits.

There are more arguments to look at. David White, lead developer of Battle for Wesnoth, wrote a lengthy post back in 2008 justifying the game’s heavy use of randomized results. (Interestingly, the developers apparently received so many complaints about the randomized results in their game that they felt obliged to stick a link to this post in their game’s official FAQ!)

White’s defense is spirited but flawed. For one thing, White assumes that losing units due to unlucky die rolls is somehow superior to losing units due to poor planning and unit placement. However, if determinism combined with a competent AI makes the loss of units inevitable, then randomized results combined with competent AI makes the loss of units arbitrary. It is the job of the designer to tune the difficulty of battles—randomization of results cannot do the job for him.

Worse, White outright dismisses the interesting tactical situations that a deterministic system can offer. Determinism does not necessarily mean little tactical complexity, and it certainly doesn’t mean that the player won’t have to work out a good strategy. Nor, conversely, do random results equate to tactical complexity: if your game is simplistic, adding randomized results is not going to improve the situation. Tic-Tac-Toe is not going to suddenly become a tactically rich experience if we throw die rolls into the mix.

But then again…maybe there’s something there. What about a game that is already tactically rich but entirely deterministic? Could a game like that be deepened if we placed a wreath of randomized results upon its brow?

To some extent, I think the answer is actually “yes.” Consider this: in a purely deterministic game, the player’s contingency plans will hinge solely upon possible enemy responses. There is never a moment where the player has to plan for the risk that his or her own strategy will fail. The possibility space actually shrinks, in other words, because there are fewer possible results when a player implements her plan of action.

That sort of consideration comes about only through randomized results. Therefore, although randomized results are most certainly not a panacea for an otherwise dull turn-based combat system, they can expand the possibility space somewhat by offering up another dimension of tactical considerations for the player to mull over.

The design challenge therefore becomes finding a good balance, one that (1) forces the player to form extra contingency plans while (2) not sabotaging her sense of control. This means implementing randomized results in a very controlled and deliberate way atop an otherwise deterministic base.

It is no trivial matter to tinker with a successful, well-balanced deterministic combat system in this way. I have been thinking for months now about how to do so successfully in my latest title, Telepath Tactics. For the sake of providing an example, I will now talk about the areas in which I have added randomized results to the Telepath combat system, and discuss my rationales for doing so.

     Use #1: Negative status effects

The most conspicuous of my concessions to randomized results lies in the use of negative status effects. Negative status effects are a common feature in turn-based combat systems. They lend depth to RPG combat by creating secondary objectives (e.g. cure poison as soon as possible to minimize damage) or by changing the resources at the player’s disposal (e.g. muted characters cannot use magic until cured).

Despite their utility, negative status effects have been almost entirely absent from Telepath titles up until now. “Craig,” you ask, “why would you create a strategy RPG that excludes such a useful and obvious tool for increasing tactical depth?” The reason, quite simply, is that previous Telepath games employed a combat system that was almost 100% deterministic. Most negative status effects, in turn, are simply too powerful to use in such a deterministic environment!

Consider an attack that imparts “Frozen” status, for instance. If this status effect hit 100% of the time, Cryokineticists and Frost Spriggats would become game-breakingly powerful. Imagine going up against an opponent with an army composed entirely of characters that freeze your units solid for 2-3 turns on their first attack; there would be almost no way to successfully engage them. This same problem applies to Sleep, Stun, or any sort of common RPG status effect which prevents a character from acting.

Even a milder status effect, like “blind,” would become overpowered in a deterministic system. Not only it would take effect 100% of the time, it would necessarily cause the hit rate on physical attacks to drop all the way to 0%! Blind would essentially become an automatic Render Physical Attacker Completely Useless card.

The solution I chose was to make negative status effects take hold only some of the time. This limited application of randomized results turns negative status effects from a way of automatically crippling the enemy into a gambit you can try–and for which you had best have a contingency plan in case of failure!

     Use #2: Dodge chance

The second concession I made to randomized results concerns the ability of characters to dodge attacks. I did this as a way to help balance the units, enforce specialization, and raise the stakes when dealing with a few, particular classes. The Assassin, for example, is specialized in getting behind enemy lines and taking down weaker characters. Without a chance to dodge, the Assassin would be dispatched quickly almost every single time; giving the Assassin a significant dodge chance makes dealing with one much more of a tactical challenge.

I also give units an automatic, very high dodge chance when an attacker is blinded; this represents a compromise scenario with the Blind status effect, a negative status that would otherwise be overpowered, as we discussed above.

This is significantly different from most RPG combat systems. Most combat systems with a chance to hit impose a substantial probability of missing attacks against all enemies. Further, even those which do not force characters to frequently miss attacks will oftentimes set a maximum attack accuracy somewhere around 95% to account for the chance of a “critical miss.” (In practice, all this accuracy limit does is institute a chance of missing so low that it calls to mind our lightning strike scenario: the player will have no reason to expect it, and he will be profoundly unhappy when it occurs.)

The implementation I use in Telepath Tactics is far more circumscribed. Rather than a typical “chance to miss” system, it is a “dodge chance system.” The difference lies in the game’s base-line assumptions. There is no such thing as missing in the game–by default, any character’s attack will always hit the target. It is deterministic by default. This use of randomized results is a deliberate exception, representing particularized tactical dilemmas to spice up the game at key moments rather than simply dumping randomized results into every combat interaction in the game.

Just as importantly, the game provides several ways of circumventing dodge entirely. Blinding the target or slowing the target will prevent it from dodging (although, of course, there is always a chance that these status effects will themselves not succeed). Mental attacks, in turn, can never be dodged under any circumstances.

Much as with status effects, the use of units with dodge is merely a gambit: a player must be prepared in case the gambit fails, and the opponent should plan ahead by availing him or herself of strategies to counteract it. In this way, it deepens the tactical experience without significantly undermining player control.

     Use #3: Line-of-sight, gun-based systems

That about covers it for Telepath Tactics. However, there is a pretty big elephant in the room here, folks. There are some combat systems that consistently need to rely on randomized results for–at a bare minimum–hit and miss calculations. I am thinking specifically of line-of-sight combat systems with highly lethal projectile weaponry. (Think Fallout, Jagged Alliance or X-Com.) A deterministic core would very quickly turn these systems into a mess because of the lethality of the attacks involved. Everything I said about negative status effects being overpowered in a deterministic system applies here as well. These games get a pass.

Randomization beyond results

Randomized results are not the only potential use of randomization in a game. Randomization can also be a valuable tool to build tension by creating unpredictable starting states for various scenarios. Card games provide a great example of this principle. Even if you know your opponent’s deck, you will never know what cards lie in his or her hand. The deck is shuffled: the hand is chosen at random. Consequently, the player faces some uncertainty about the options available to her opponent. This builds tension and makes a turn-based encounter more gripping.

In a spatial turn-based combat system, unpredictable enemy unit composition and positioning under a fog of war mimics much of the effect of a randomized hand of cards. The player must scout, or else take the risk inherent to issuing orders with incomplete information about what enemy characters the opponent has at its disposal. Other elements of the battlefield can be randomized as well: loot drops, spaces with healing or defense bonuses, and environmental hazards, to name a few.

Crucially, these each add unpredictability to the scenarios the player faces, and not to the results of individual player commands. The player is never compromised in his ability to control his characters; any random chance the player confronts in this way, the player has the opportunity to respond to and circumvent.

There is one other, major way that randomization can be used to foster unpredictability. You may recall me mentioning earlier the dangers of relying exclusively on clever AI to provide unpredictability in a game. No matter how clever an AI’s programming, if its decision-making process is consistent from game to game, sooner or later the player is going to figure out how it thinks and learn to outwit it over and over again. The opponent will become predictable, in other words, and the game’s tension will plummet.

This is a great place to employ randomization: add a random modifier to some of the AI’s heuristics that change its priorities from battle to battle, or even from turn to turn. Also good: add a random coefficient to the scores the AI assigns to attack targets: small enough that the AI won’t make ridiculous decisions, but big enough that its target priorities will be difficult to predict from attack to attack.

I could go on, but I’ll stop here. Though this might seem like a lot of stuff, I’m sure that I’m just scratching the surface. After all, randomized results occur at a very specific moment: randomization can occur literally anywhere else in the game. As long as (1) the randomized elements impact the player’s optimal strategy, and (2) the arrangement of those elements is not immediately revealed to the player, you have an implementation of randomization that is ripe for tension-building.

Conclusion

There is a whole world of tools for building unpredictability. I would like to see turn-based combat systems–particularly those in RPGs–start focusing on a greater variety of these, and stop using randomized results as a crutch. Randomized results have their role, but I’d like to see them used more deliberately. Like special sauce on a burger, randomized results can add spice; just make sure the player still gets to taste the meat.

Craig Stern is an indie developer currently working on the turn-based tactics game Telepath Tactics. He is the founder of IndieRPGs.com, and can often be found rambling in short, 140-character bursts on Twitter.