As we’ve mentioned in previous blog posts, Road Not Taken has procedurally-generated levels. That is, you get a completely new experience every time you venture into the forest. When designing a game like Bioshock or God of War, a designer must hand-select the placement of every corridor, every object, and every enemy in the game. With Road Not Taken, we’re not hand-selecting anything. We spend our time creating interesting objects and enemies, and then carefully defining the probabilities of when and where you will encounter them.
The process reminds me of Duchamp’s painting ‘Nude descending a Staircase, No. 2’. For thousands of years, humanity painted a single instant, captured in time. Duchamp, inspired by advances in motion pictures, decided to paint all the possible states of a woman walking down the stairs in a single painting. To me, designing a roguelike is a little bit like that. Instead defining a single level, we use algorithms to define all possible levels at once.
Generating a level one pass at a time
The level generation system builds each level by laying down multiple passes of increasing detail. Each pass tweaks the balance of the level and gets it a little bit closer to the final state that the player will experience in the game. A single generated level in Road Not Taken is built up out of five distinct passes.
Pass one: Lay out the rooms
In Road Not Taken, the forests you’re adventuring through are a simple grid of grids. For example, a forest level might be a 3 by 4 grid of rooms, with each room being a single 6 by 8 tiled screen. One of the forest rooms – the top leftmost one – is labeled as the starting location.
At this stage, we also set some constraints, such the the number of children you’ll rescue, the minimum number of parents on the map, and a targeted difficulty. These variables shape the rest of the map.
It seems simple, but selecting the right numbers is a slow and painstaking process. We have to find all the values that yield broken (or not-fun) levels and eliminate them. So I spend a large portion of my days setting various numbers really high or really low, and then play the resulting levels to see how they feel. Through this process of elimination I learn things, such as “collecting 100 children is a total drag.” But collecting just 1 child is boring, too. Is there something in the middle that works? Tweak by tweak, a fun experience comes into focus.
The exciting part when dealing with original game mechanics is that no one (myself included) knows what constraints will feel good. Sometimes the answers surprise me, so I try not to make too many assumptions. I just dig in, make hundreds of ugly levels, and explore the unknown in hopes of stumbling on something surprising and delightful.
Pass two: Add blocked paths
Each room has an entryway that is blocked by boulders. That path can only be unblocked by a specific object that must be collected into a matching set by the player. For example, you might need to gather and group five trees of a certain type in order to unblock the passageway. We can, theoretically, make almost any object in the game (in any quantity) the key to these doors, though some end up being more fun than others.
So we look at the target difficulty for the room, then look at the set of available lock objects, then pick one for a door. The lock objects are placed in the room with the door. We repeat this step till all the paths in the forest are blocked off.
After we added this step during the prototyping phase, the game stopped being fun and we very nearly ceased to work on it. Unblocking the paths was a pleasant experience, but something subtle was missing. It just wasn’t fun enough.
Pass three: Move some lock objects out of the rooms
Cristian Soulos, our lead programmer, figured out how to keep things interesting. He realized that Road Not Taken would be more fun if all the pieces you needed to solve a puzzle weren’t just sitting right in front you. So he spread the lock objects for some of the doors into different rooms. This forces you to search and explore the forest if you want to unblock every path and rescue every child. (I always imagine the computer giggling evilly at this step.)
As soon as we added this to the level generation system, Road Not Taken went from being fun to play for 10 minutes to being fun to play for hours. The lesson here is that when working on original game mechanics, it often isn’t obvious what will be fun up front.
Pass four: Add goal objects and critical crafting ingredients to the rooms
This is the point where the children, parents and critical crafting ingredients are added to specific locations in the forest. Rescuing those children is your primary goal; they are what changes Road Not Taken from a fun toy into a game that you can win. Crafting ingredients increase your chances of success — if you use them correctly — by giving you tools to more efficiently explore the forest and deal with enemy creatures.
Pass five: Add a dash of difficulty
In addition to the lock objects, we have challenge objects. These make your life more difficult by attacking, blocking, and/or confusing you. First we look at the target difficulty of the room, a simple number that increases as the player’s skill increases, and also increases over time. Then we fill up the rooms with objects and enemies that increase the forest’s difficulty till the target difficulty is met.
Each object has an expected difficulty and some constraints on how many can appear in a level. Objects also have rules dictating what they shouldn’t appear next to, and how deep into the forest they generally appear.
Not all objects show up all the time, so the player is forced to mix up their strategy. You may have started relying heavily on crafting potions, but on a map where the key ingredients for those potions don’t appear, you’ll need to use other tactics. Many objects in the forest have multiple uses, so you always have plenty of options, though you might need to experiment for a while to figure them all out.
Some interesting benefits of our procedural level generator
There’s a single difficulty slider: It takes a great deal of effort to tune it all correctly, but once we’ve done that, we can generate easier or harder levels with the change of a single number. I can testify that some of the harder forests in Road Not Taken are insanely brutal, even for me, the lead designer of the game. But they are also incredibly satisfying when you solve them!
Robust in face of new content: A short while ago, we added 10 really unique new objects and enemies to Road Not Taken. If this was a more traditional game with levels that have been entirely handcrafted, a change of that magnitude would likely have required weeks of additional rebalancing and level reworking. But in our procedural system, with a few minor adjustments, everything just worked. So now we have lots of freedom to try out fun new ideas without losing all our old work, which means we can put dozens or even hundreds of interesting objects and enemies in the game. It also means that, with a little luck, we can do lots of interesting updates after Road Not Taken is released!
The combinations continue to surprise me: There are trillions of different levels that can be generated within Road Not Taken. I’m constantly running across new scenarios that I wouldn’t have predicted. What happens when a raccoon spawns next to heavy stone blocks? Pure chaos… and not something I planned for.
Keeping it fun for ourselves as well as you
As a game developer, a little-discussed secret is how often we get tired of our own games since we end up playing them over and over again for months (or years) before release. But Road Not Taken keeps surprising me, and I’m not tired of it yet. :-)
We just finished another balancing pass and the game is really shaping up. At this point, we probably have most of the objects and enemies that will be in the game by the time we launch. Now there’s just a ton of polishing and minor feature work left to go. With any luck, we’ll be ready to launch sometime this Spring or Summer!
PS. In case you haven’t seen it, we recently released a new live action teaser trailer for Road Not Taken. Check it out!