Recursive Unlocking: Analyzing Resident Evil's Map Design with Data Visualization
Resident Evil is often credited with inventing the survival horror genre. While that particular accolade may not be entirely factual, the game is worthy of recognition for cementing horror as a viable, mass-market console genre. Critics are quick to point out that Resident Evil's basic game system, consisting of static backgrounds, 3D characters, and character-centric pivot-and-move controls, were lifted almost entirely from Alone in the Dark. Resident Evil, some will argue, might have taken the Dark formula and spruced it up for prime time, but it can hardly be credited with any great game design innovation.
Though it's true that Resident Evil used Alone in the Dark as its template, I think that critics who write the game off as a copycat are not paying enough attention. There is a wealth of interesting game design ideas in Resident Evil, and in this article I want to tackle one of them in particular: the design of the mansion map.
It's been a while since we all played Resident Evil, so let me refresh your memory. At the beginning of the game the protagonists find themselves locked in the sinister Spencer Mansion, which is also home to lots of zombies and (as we eventually find) a large underground secret laboratory. As the game starts there are only a few rooms that are accessible--access to most of the mansion is sealed behind locked doors, secret panels, and powered-down elevators. As the player progresses through the mansion he finds keys that unlock doors in areas he's already visited, and must eventually return to those areas to find more keys to unlock new areas of the structure. Thus the player travels through the map in a very non-linear fashion, moving back and forth between rooms as items are collected and puzzles are solved, and eventually passing into areas with entirely new rooms. The map opens itself up like a spiral shell. I call this design Recursive Unlocking.
This approach has interested me for a long time. The genius part of the Resident Evil level design is that in the course of playing through the game two things happen: the player unlocks shortcuts and the player runs out of ammo. At some point the game becomes entirely about traversing efficiently through the mansion; it's a run from the safe room (where we can save) through the shortest possible set of rooms until we reach another safe room or a new puzzle to solve. There's simply not enough ammo to dispatch all of the zombies in the game, so route planning and deftly maneuvering through the Victorian building is eventually the key source of challenge.
Though the Recursive Unlocking pattern is interesting, I've struggled with how to study it. The actual order in which rooms are accessed has a lot to do with the player himself; most of the time there are two or three puzzles that are in the process of being solved simultaneously, and the level of traversal efficiency can depend on the order in which these puzzles are attempted. That said, there's clearly a method behind the design of Spencer Mansion and its surrounding areas. The brains behind this game carefully architected the map so that the player's traversal through the mansion would occur at a pace that they could control. To understand how the Recursive Unlocking methodology works, it would help to understand how the space was designed in the first place. Since we can't just call up Shinji Mikami, Hideki Kamiya, and the rest of the (large) design team, I turned to the next best thing: data mining and visualization.
When designing a game we can assume that the level designer thinks in terms of the fastest path through the space. If several goals must be completed before the next space is unlocked, the level designer knows the most efficient order in which to complete them. He's likely to lay the main path out first, then go back and flesh it out with extra details, secondary goals, or side-paths. Therefore, if we look at a highly efficient traversal of the space that doesn't rely on bugs or tricks, we should be able to get a rough approximation of how the level was put together originally.
What I did is take a video of a speed run of Resident Evil: Director's Cut (using Jill, on Arrange Mode, with 100% completion) and trace the player's path through the game. I recorded each room transition in order, along with a time stamp, to produce a mapping of the speed runner's entire path through the game. Then I wrote some code to render this path over a 2D map of the whole game using Processing. Finally, I took all the data I had, threw it into a spreadsheet, and made some graphs.
The results are pretty interesting. The speed runner takes the most efficient path possible through the game; no time is wasted with story or items. The only rooms visited are those that are necessary to progress to the end of the game. Since this is Arrange Mode, the actual details of the traversal might differ slightly from the original Resident Evil, but even so the main arc of the game, the way that the player moves from one part of the mansion to another, is clearly visible and worthy of analysis.
Visualizing Recursive Unlocking
Here's a visualization of the most efficient path through Resident Evil 1.
You can download a full-res movie file (Quicktime format, 30 MB) of this if you want. There's also a Java applet version, but it doesn't work well in some browsers and needs a lot of memory.
What you are seeing here is the path from room to room that UltimateSpeedRuns took to finish the game in a little under an hour and a half (you should also check out his hilarious 44 second speed run of Clue). The game starts with Jill entering the dining room on the first floor of the mansion and ends with her running down a hall in the laboratory to catch an elevator to the helipad. There are 213 room transitions here, which I've sped up to show in about a minute (if you want to see them in real time, try the Java applet).
So that looks pretty cool and all, but what does it really tell us? Let's start with some of the raw data collected for this research.
There are 116 unique rooms in Resident Evil, split between four major areas: the mansion, the courtyard, the guardhouse, and the laboratory. A room is any space the player can occupy: a hallway, passage, closet, or room. To finish the game, UltimateSpeedRuns visited 213 rooms total, which means that most rooms were visited only twice. Does it strike you as odd that a game known for requiring a lot of backtracking can be completed without passing through most rooms more than two times? Remember, this includes all hallways and passages, as well as proper rooms, in the game.
In fact, the data shows that we can be far more efficient than that. Of the 116 rooms in the game, 19 of them were not visited at all in this run. These are rooms that contain story pieces, or access to guns or other items that are not strictly necessary for progression. The majority (44, 38%) of rooms were only visited once. The most visited room in the entire game is a small hallway in the upper-right part of the mansion's first floor. This room connects the mansion to the courtyard, to the second floor, and it is also right in the middle of several shortcut paths. It was visited a total of eight times.
This means that while there is some backtracking involved in Resident Evil, the path is from beginning to end is mostly linear. In fact, looking at the video above, we can see that there is a common pattern to the traversal: the player enters an area and then spends a lot of time in that immediate vicinity, visiting adjacent rooms several times before moving forward or heading back the way they came. You can see how an area will light up with activity for a few seconds, then the player travels on to some other part of the mansion. There's a little bit of micro-backtracking within these "hot" areas, but very little retracing of steps across the larger map. At a macro level, Resident Evil is pretty much a linear string of these hot spots.
The presence of these high-activity areas reveals a key trait of the level design in Resident Evil: items and puzzles are organized together spatially and on the game timeline. When a puzzle in a room becomes solvable, it's likely that the next item required after it, or the previous item required to access it, is in an adjacent room. The hot spots we see in the video are areas where a bunch of related items are stored in close proximity, but the unlocking of these hot spots is sequenced, so we also know that related items are revealed to the player when they become relevant. The message to the player is this: the items you have now are useful soon, and you won't have to travel far to use them. Looking at the fastest-path traversal of this game, we can see how a skilled player only collects items when they are relevant and close, which leads to hot areas of the map and helps him avoid back tracking. That he can schedule item collection and traversal like this at all indicates that the levels were designed with this sort of progression in mind.
Of course, regular players might not realize that there's an optimal order to collecting items and solving puzzles. They may backtrack to previous areas unnecessarily, or miss a key item and be unable to progress. But because the items and puzzles are staged both spatially and on a timeline, the player who wanders around looking for the next step should find himself returning to the same areas over and over. If there's something left to be done in one room, there's probably an item or puzzle in a room close by as well. This design serves to shrink the search space for the player, to localize the area which requires extra focus. I'm sure many players do this unconsciously without realizing that they are being guided by the game design.
Recursive Unlocking in Practice
There's one specific moment where the player suddenly makes a long arc back through the first floor of the mansion, revisiting the areas where the game began. You can see this in the video at about 35 seconds in, which puts it at roughly 60% of the way through the game (it occurs 51 minutes into the speed run). This is a great example of the Recursive Unlocking pattern because it shows how the designers use this map layout to control tension and pacing.
At this point in the game the player has been all over the mansion. Then they left the mansion and spent some significant time (about 15 minutes of speed run time; 16% of the total game time) in the guardhouse. They then returned to the mansion and fought a boss (the giant snake, second appearance). This lead to a new area of the mansion that the player has seen but been unable to access (the library on the second floor), and eventually deposits the player back in the long hall next to the dining room where the game begins. The next destination for the player is the courtyard, which is accessed from the top-right corner of the map, and to get there the player passes back through the main hall and a bunch of other rooms that appeared early in the game.
We can see in the traversal visualization that this is one of the few times the player actually has to cross the whole mansion map without doing anything on the way. This trip serves a couple of purposes. On some level, it is comforting for the player to revisit these early areas, as they are familiar and the location of nearby saves and health has been long since memorized. On the other hand, the passage also serves to ratchet tension up as the player approaches a new area (the courtyard basement): the zombies that the player originally faced in these halls have now been replaced with giant spiders and hunters, both of which are pretty hard to kill. And finally, this section serves as a reminder of where we are; it brings us back to the beginning of the game and reestablishes the mansion in our memory. This is the last time the player will see the mansion; after traveling through the courtyard basement the he continues to the laboratory, which is the last environment in the game. So the last bit of the mansion that we see is the area that introduced us to the mansion to begin with. It is these rooms that we'll remember the best when the game is over.
Using Traversal to Fight Fatigue
Another interesting aspect of this visualization is the way that the player moves between the four main environments: the mansion, the courtyard, the guardhouse, and finally the laboratory. These areas all look very different; the mansion has huge ceilings, Victorian stylings, and lots of zombies. The courtyard is outdoors, and has zombie dogs, snakes, and eventually hunters. The guardhouse is a wooden structure, old and dilapidated compared to the mansion, and it's overrun by spiders. The lab is all metal hallways and complex piping, with sliding doors and glowing screens--another big departure from the previous areas.
The mansion accounts for the biggest chunk of the game, but it's less than half (43%). One fourth of the whole game takes place in the laboratory, and the guardhouse and courtyard combined account for the remaining 30%. In terms of rooms, the mansion itself is the most dense (59 rooms visited), followed by the lab (21 rooms), with the guardhouse and courtyard about tying for third (with 18 and 17 rooms respectively). These areas are not reused much; the player generally enters one of these areas, solves a bunch of puzzles (another hot spot in the traversal), and then leaves, never to return again (the courtyard is sort of an exception--it gets traversed twice).
The four major locations in Resident Evil look distinct and play differently to prevent player fatigue. After solving a bunch of statue puzzles and placing gems into stone eye sockets for a few hours, the player is ready for a change. Leaving the mansion gives the designers an opportunity to change up the pace of the game, introduce new enemies, and just give the player a break from the areas he's already seen over and over again. Given that the entire design of the Resident Evil map is based on recursion over the same key areas, these secondary spots are an attempt to prevent monotony.
It's also interesting to note that by looking at how much time the player spends in each room, we can sort of get a sense of how the design changes from area to area. The speed runner in our video goes through the mansion rooms at an average of 37 seconds per room. The mansion is primarily a traversal puzzle. Time spent examining the environment isn't recorded by this data, as the speed runner did not bother. The guardhouse is similar: 36 seconds per room. But the courtyard and laboratory areas are much longer: 53 seconds per room and 59 seconds per room respectively. Perhaps the difference in speed is related to an intentional change of pace between these areas, or perhaps it is a side-effect of the development process. Either way, it seems clear that the rooms in the mansion and guardhouse feel different than those in the courtyard and laboratory because they are passed through so much more quickly.
Other Fun Facts
Here's a couple of other interesting tidbits I gleaned from this data.
The hunters are introduced almost exactly half-way through the game.
The door opening animation, which plays between rooms to mask the room load time, takes about 5 seconds. In total, the accumulated cost of this load time is about 25% of the total play time of this speed run.
Arrange Mode (used for this test) moves the locations of items around on the map, but doesn't generally disrupt the order or point in progression in which they appear.
Visualization of player data can give us interesting insights into how games like Resident Evil work on the macro level. Using a speed run for this sort of visualization is ideal because it removes any bias and confusion that might stem from individual player sensibilities and shows us something close to the path that the level designers intended. In Resident Evil's case, the Recursive Unlocking pattern is used to control the pace of the game, the flow of the narrative, the progression of enemies and weapons, and even to force a change of scenery on the player, all while maintaining a non-linear feel. This sort of analysis reveals how much thought actually went into the construction of the layout of this game. I think you'd be hard-pressed to find another Adventure game from the Resident Evil era that pulls off such a tight and formal traversal; this level design is clearly the product of serious planning. The data here shows that the layout of Spencer Mansion and its surrounding areas was probably the single most difficult part of the Resident Evil design, but the work that Capcom's designers put into it made the game the masterpiece that it is.