Tuesday, July 12, 2011

Dark Past (part 4): The Useful Post (?) or Randy Smith's "valence theory" of level design.

This is a series of posts that analyzes the immersive sim. It's a play on the excellent RPS feature, Dark Futures.

Many moons ago, I began by (part 1) emphasizing the robustness of systems in immersive sims before (part 2) moving closer to level design, then (part 3) criticized both ideas, and now the point of all this: (part 4) Randy Smith's "valence theory" of level design, as applied to the Thief games. (NOTE: he never called it that, but I am.)

We're done with the theoretical basis. Now this is the "Useful Post" of the Dark Past series, a primer on some level design theory for immersive sims with stealth mechanics. It's also particularly relevant, given the recent announcement of Dishonored.

Let's start with the premise established earlier, that a single player level is an unstable system that wants to be solved. That means positive feedback loops for the player to solve the level and continue winning, and negative feedback loops for the player to stabilize a near-failure state and stop the blood loss. The latter is in, like, every video game ever -- automagically recharging shields, an adrenaline-pumping near-death blood-screen mode, a screen-clearing super bomb, a winged blue shell or a flash bomb, etc. Note that none of those common tools are necessarily functions of level design. (Though Thief 3 and its abundance of gas arrows and flash bombs is definitely a level design problem.)

Back at GDC 2006, in his talk "Level Building for Stealth Gameplay," Randy Smith presented a methodology that embedded these different feedback loops within the very structures of our single player puzzle-levels.

In the average action game, you might have failure (i.e. 0 health), all player states in-between (1-99 health), and success (100 health). Most of the game time takes place within that in-between "limbo" portion of the spectrum.

The average stealth game has failure (you've been discovered), the limbo in-between (you're being hunted), and success (you're undetected). In contrast to the action game, most of the game time takes place in that "success" part when you're in a safe hiding spot, scouting out places. Smith highlights this narrow but non-zero threshold for failure as the primary Aesthetic of stealth games, the A in Mechanics-Dynamics-Aesthetics (MDA). Here are three consequences of that:

1) "Provide and communicate a zero failure path." Or at least trick the player into thinking there's part of a zero-failure path somewhere, so that they'll commit to some sort of plan.

2) "Use level design to stabilize failing players." We like tension, but we don't want to release tension / interrupt flow when we kill the player. Here, death is not transcendence, but a colossal interruption to the stealth aesthetic. This isn't VVVVVV, as handsome and witty as Mr. Cavanagh is.

3) "Insta-fail stealth is poor design" because you're basically zero-ing out that tasty "in-between" player state that action games love so much.

So in something like Thief, they sought to prolong this in-between "guards searching for you" phase for as long as possible. In Thief and Thief 2, guards could track you for long distances. They even cheated a little when searching for you, as if automagically gravitating toward your position, which made players complain. (Thief 3 is much easier in this regard, unfortunately.)

Imagine a guard searching for you, slowly closing-in on your small island of shadow. You have to creep away, quietly, staying out of sight. How far is far enough? When will the guard give up? How noisy are the floors? Is there a door or room I can duck into? These questions are much more urgent and interesting than "Why did I die?" (the question powerlessly asked upon complete failure)

To commit to a plan, a player needs to be convinced that the level will afford their plan. Otherwise they'll just stand there in the shadows, paralyzed with indecision.

In design, we use the concept of "affordance" to talk about how well an object does what it looks like it does. The most famous and ubiquitous example might be a door that you pulled when you had to push; the door seemed to "afford pulling" but it didn't, and then you felt like a chump.

In this way, Randy Smith's "valence theory" (NOTE: again, he never called it that, but I am) posits that different parts of a room or level can afford stealth mechanics: level elements can have a POSITIVE [+] valence (shadowy, quiet, stealth-friendly) or NEGATIVE [-] valence (bright, noisy, not stealth-friendly).

Here are some micro-dimensions (aspects of a single room or area) that Smith identifies:
  • OPACITY. Can the player [+] transparently scout the area freely from vantage points, or [-] are there a lot of blind corners and opaque obstructions?
  • SHADOW. Is the player [+] often safe from visual detection or [-] are there torches everywhere that expose them? Linked to opacity, because the player will want to be safe in shadows when scouting.
  • NOISE. In the context of Thief, [-] more or less the loud sound your footsteps will make on metal, marble or in water. These floor hazards should be well-lit so the player can visually spot them from afar. Of course, [+] carpet and grass and other quiet materials can be covered in shadow.
  • TERRITORY. The [-] well-lit area within a guard's vision cone is their territory, as well as the immediate area around them in which they can hear. Guards should [+] periodically cede territory by facing another direction or patrolling away. (TRIVIA: The average guard NPC in Thief 1 & 2 has 9 vision cones, all of different angles, ranges, peripheral vision modes and degrees of nightvision.)
If an area feels too easy when entering from a particular direction, try adding some [-] negative elements or removing some [+] elements. If it's too hard, vice versa. Randy Smith calls this the "balancing operation." Part of this design phase is ensuring there's at least one zero-failure player path.

To chart a possible player path, draw lines to connect areas of positive valence, doing your best to avoid negative valence. Because we want to accommodate a wide range of player states, you should assume they have low health and no arrows or weapons left. Generally, fewer routes with more complexity / specific timing = less affordance to stealth movement.

It can get pretty complicated. Note the multiplicity of movement solutions and the multiple vantage points / shadowy areas, which Smith calls either which I call [+/-] "short cover" (if a guard periodically patrols into it, thus making it unsafe sometimes) or [+] "long cover" (you can stay there indefinitely).
Smith defines [+] soft cover as "an LoS blocker only for NPCs" such as shadows, bushes or water; and [+/-] hard cover is "an LoS blocker for everyone" such as walls or blind corners.

Smith also highlights the structure in the lower-right, the ring-shaped area he calls [+] "ring around the rosie" -- if the player is being hunted, they can revolve around and keep hiding behind the central wall to evade the moving guard.

A door is an interesting case. Smith argued it was negative because it's opaque and blocks the player's line of sight. However, I would argue that it's more mixed because guards are vulnerable when opening doors, and in stealth games with dynamic lighting models (i.e. The Dark Mod) the door can block light and produce a small pocket of shadow... I guess you're on your own with that one.

Now to be clear, Smith isn't suggesting you chart out an entire mansion mission like this. He actually suggests winging it: building your level and populating your rooms with elements of various valences, then playtest and go over with a balancing pass afterwards. Maybe do the balancing pass entirely in your head, too. If you're collaborating with a few other designers at this phase of design, this methodology gives everyone a common language and grammar to communicate these concepts we've internalized as players but rarely verbalized. And then you can balance together. Hurray!

These valences also apply between rooms. Thief levels rarely imposed strict pacing or wayfinding on the player, but we can use forces and attractions to "pull" the player certain ways, and take advantage of the fact that they'll move towards [+] perceived stealth-friendly areas until they've scouted out [-] dangerous areas.

Using "orbits" (again, my own name / spin for something Randy Smith said) we can induce a very rough pattern of player movement.

Surround a compound with [-] hostile areas to imply fortification, then add at least one [+] vulnerability. Inside, you can have a ring of friendly areas that overlook a hostile area (e.g. a bank vault) and the player will "orbit" around to gather as much intel / recon on the bank vault as possible. The structure also allows for a pattern of alternating affordances, like a [-] [+] [-] [+] rhythm as the player infiltrates each ring of security.

This isn't "pacing" in the usual sense because we aren't spawning waves of enemies or scripting anything; the player is still in-control. The alternating rhythm IS definitely a designed feature though. If you directly connect two [-] areas together, the player might get detected in one and get chased straight into the other, further escalating their failure. Randy Smith calls it "out of the frying pan and into the fire" and it should be avoided. Maybe put a shadowy ring around the rosie in-between the areas, as a stabilizing buffer to help the player out.

As for actual implementation, your level might resemble something roughly like this:

Orbits use affordances to loosely direct a player to explore more of the level fully and to understand areas as interconnected system of rooms -- as subsystems, as hierarchies of nodes, as molecules, whatever analogy you want to use here. The result is hopefully a feeling of mastery and the satisfaction of breaking through these concentric rings of security.

We know this satisfaction, the aesthetic of "sneaking," requires a narrow threshold for failure. But that doesn't entirely explain how to create that feeling, that you're not supposed to be there. Here too is where I would update Smith's original 2006 theory and add some culturally encoded dimensions and affordances:
  • PRIVACY / FUNCTION. Is the room textured in a way that encodes the space as [-] public (a large hall, a courtyard, a dining room) or [+] private (a bedroom, a bathroom, storage closet). Guards are much more likely to patrol public areas, but in bedrooms they're often asleep and vulnerable. Storage closets and freezers are rarely visited, great for storing bodies.
  • CLASS. Is the area [-] richly decorated with expensive things and heavily guarded or [+] a poor servant's quarters / sewers?
The underlying arguments here are that (a) notions of privilege and social class are deeply tied to a game about stealing things of value, especially if the narrative implies that rich people are generally corrupt so it's okay to steal from them, (b) the sacred boundary between public and private is the core of "sneaking," something we're very scared to indulge in real-life, and (c) decorative architecture and visual ornament are highly functional because they communicate affordances and probabilities to the player.

It all helps you make assumptions about the level layout. You can orient yourself along this axis of privacy or axis of class privilege.

A nobleman's bedroom is likely large, well-protected, elevated from the ground floor, with a personal bathroom and an open window or balcony. In contrast, a servant's quarters is much lower, shabbier, with nothing valuable to steal and no windows, but it's likely unguarded and an easy way to sneak into the building.

You also know that the nobles and servants' rooms aren't directly connected. You know that the servants have easy access to the kitchen and side entrances. If you see a huge, tall door of polished wood, it's probably for rich people. If you see a dirty trapdoor, it's probably for poor people.

Mansions are popular fodder for Thief levels, great for emphasizing this servant / master, public / private divide. (I'd also wager that most Thief missions, official or custom, have a bathroom somewhere in the level.) Maybe that's why Thief missions have incomplete or vague mini-maps: the level layout is the puzzle itself, so why would you give it away?

Mr. Dan Pinchbeck, as photographed in the "2009 Hunks of Game Academia" calendar.
This idea of diegetic details communicating tactical affordances, simply by existing, ties directly into Dan Pinchbeck's concept of "ludodiegesis" -- that the existence of a fictional world with its own coherent system of logic reinforces the game mechanics... which reinforces the world... which reinforces the mechanics... which... !

Maybe you'll have 3 levels in a row where the servant's area is utterly devoid of a guards, but then the 4th level has kitchens full of guards -- because the prince is paranoid and suspects his servants are stealing from him. Maybe you'll have a really cramped, dirty city streets area that leads into a wide, spacious estate filled with fruit orchards -- which tells you a lot about power and the estate owner's relationship to the city. What about a city manor with no walls? With loot placed everywhere? The Baron is so powerful he doesn't even need walls. He fears nothing. (And a classic example from Portal 2 is the "TEST" chamber at the start of Act 3; it tells you so much about Wheatley.)

A puzzle tells you about a world, about a character -- it functions as a piece of narrative.

... In contrast, a truly "alien" architecture almost transcends cultural frames. Do the Covenant have a notion of public and private? Do you remember the amazing first glimpses of Xen and your inability to distinguish between built environment and landscape, or the disappointing Xen factory levels with what were clearly assembly lines? It's not enough for an alien level to be fleshy purple with leaky sphincters: it must also subvert our personal logic and understanding of architectures.

* * *

Smith's valence theory, combined with ludodiegesis, is a powerful tool for thinking about level design. If Deus Ex 3 turns out to be lame, or the immersive sim becomes as stagnated and institutionalized as the genres it sought to criticize, then I hope this design framework survives as one of its achievements. You can use this concept of "valences" for anything: an action shooter arena, a race track, a Starcraft map, etc.

I also find it much more convincing than some dominant discourse today, mainly the pop-psychology / art composition garbage about leading lines and color theory and all this subconscious whatever. Let's assume players are rational agents primarily concerned with interaction and wayfinding, not mindless drones who are slaves to their senses.

Don't insult a level by treating it like a painting. A level is a place.