How Unexplored generates great roguelike dungeons

This is The Mechanic, where Alex Wiltshire invites developers to discuss the inner workings of their games. This time, Unexplored [Steam page].

“Dungeon crawlers are very much the hero’s journey, where you start off as a nobody and end up as the big hero,” says Joris Dormans, creator of realtime dungeon crawler Unexplored. “Or at least that’s the plan.”

Unexplored creates great hero’s journeys. As Adam said in his Wot I Think, it consistently generates some of the best ever roguelike dungeons. They often feel like they’ve been laid out by hand, organic caverns giving way to rooms and corridors, each space sprinkled with foliage and architectural details, as well as puzzles, traps and obstacles to cross. And the thing that makes them feel so satisfying to crawl is something that calls back to the fundamentals of level design, and even architecture in general:

THE MECHANIC: Cyclic design

What makes for a good dungeon? If you talk to Dormans, it’s about pacing. If enemies are constantly thrown at you it’ll just feel like one big fight, so you want some quiet times of simple exploration and other things to do, like puzzles to solve. Making a dungeon out of different parts allows you to feel progression, because as you walk through it you get better – or your character does. And in a roguelike, walking through dungeons is your hero’s journey.

These ideas came from Dormans’ background in the humanities and specifically doing a PhD in game design. Having made games for as long as he can remember, he wrote a paper in which he made a detailed analysis of the dungeon design in the Zelda series. The aim was to build up a set of rules which dictate their form and to test then by creating a generator which attempts to replicate them.

As he worked, his ideas about level design grew and developed, and at the centre of them was one about cycles. It’s pretty simple: it says that interconnecting spaces are a good thing because they naturally bring you back to where you started, helping you to feel your character developing. When you return to familiar surroundings with a new item or weapon you tend to realise the difference between how you were before and how you are now, and get a handle on your hero’s journey.

And besides that, people like to be in interconnected spaces. “If I look at how my daughter experiences spaces, as soon as there are cycles and loops she starts running around,” says Dormans. “At a friend’s house she runs circles around it because it’s a well-connected space and enjoys that much more than our house which is basically a tree, a central hall with rooms coming off it. It’s not as interesting to walk around that space.”

After completing his PhD, he found himself participating in a workshop about designing a generator of parks in which you can hike. A walking simulator generator, if you will. On hikes you tend to circle back to the point that you started, preferring to avoid retreading your steps, and so he started to work out a system that used cycles as the structure rather than linear paths.

“That got me thinking,” he says. “In a dungeon, if you have a branching tree structure and you find a key at one end of a branch, you always have to traverse back. If there’s a cycle there, you can always go forward to get back to a point. That’s a completely different experience which is much better. You always feel like you’re going forward.”

Eventually he decided to make a game out of this concept, and that game is Unexplored. “It’s much bigger and more sophisticated than I’d originally anticipated and it’s got to the point that it’s getting very hard to control,” Dormans admits. ”It’s a huge system, based on rewrite grammars, and there are about 60 grammars in there with two or three thousand individual rules.”

The idea of interconnected dungeons really isn’t new, to the extent that Rogue’s dungeons were made of interconnected chambers. But Unexplored pushes the concept so much further, using locks and keys to give you reason to go off on a loop and return.

No, wait! Unexplored’s locks and keys are honestly great. Here, a lock can be a difficult enemy standing in your way, and a key a good sword hidden in a chest down the passage over there. It could be a corridor filled with lethal spikes and a lever to lower them. It could be a river of lava and a scroll of fire protection. It could be a room filled with spinning robots and a cloak of invisibility.

What makes them special is the creative aspect of the key, where as a player you have to interpret its use, and the way the different types of key have different fundamental properties. Some are one-use affairs; some are equippable items that you’ll get to keep. Levers change the state of the level itself. And there’s also the variable nature of the lock. Not all are impassible doors. Some locks are skill-based, so you might want to risk running them without trying to find, or use, the item that renders them harmless. And you might even already be carrying an item that will get you through a lock.

In other words, Unexplored’s locks and keys invite creative interpretation, skill and risk-taking, and they don’t feel as arbitrary as those in most games. And sometimes, you might mess up using them: you might swig your potion too early or not realise why it’s useful. For Dormans, that’s OK because of the player-centric nature of the roguelike. “If you beat the dungeon, you really beat it yourself. There are no save-games, no hand-holding. You did it, so it’s your victory and that’s really powerful. And to make sure that happens, you need this rough environment where you can make mistakes and they can be deadly.”

It’s also possible to become trapped in a room. Dormans regularly sees players exhibiting what looks like really stupid behaviour, where they’ll find a trap like a pressure plate, and then purposefully trigger it again. “I don’t know what it is; testing a theory?” But sometimes Unexplored serves up situations where this behaviour gets them trapped. For example, a room which slams all the doors closed when you enter and has a scroll of teleportation lying on the floor. Players can use the scroll, escape to safety, and then re-enter the room, whereupon the doors slam again, but they’ve now used the scroll and can’t get out.

“At that point it’s probably better to kill them, and I try to do that. There are some rooms with gargoyles that will kill you if you don’t get out within 30 seconds. Sometimes people make bug reports about getting trapped but there was a solution and maybe they didn’t see it. There’s a fine line between generator flaw and something they missed. Fortunately, people seem to have quite a lot of trust in the generator so they tend to try to figure it out.”

The generator works by starting out with a graph of interconnected nodes and lays down an entrance and sets up the first cycle: a lock and key and a path to go around. It then adds more detail to the level: a patrolling enemy, obstacles and items.

It decides what kind of lock and key it will be, often themed to match the level, such as lava for a fire-based level. It performs another pass to add more detail and decides what kind of space each room will be.

It then converts the graph into a tilemap of the dungeon level itself. Now it places individual items – traps, decorations, barrels – creates rock formations and the shapes of each space.

And then the level is complete.

The game begins generating the whole 20-floor dungeon while you’re on the character screen of a new game so you don’t realise it’s happening. But not before it’s made a dungeon plan, a separate process which lays out a meta structure to the dungeon, placing elements across the whole journey to give it an arc from levels one to 20.

There might be a fire dragon on level 12, so you’ll find a cloak of fire protection on level five. But it’s protected by a mini-boss, which might be weak to an item that’s hidden elsewhere on that level. It can also lead to sophisticated puzzles, such as a set of pedestals where you have to identify where to place one of a set of statues found elsewhere. There might be hints to how to discover clues to the solution for which pedestal and which statue: in the pattern of the flooring of a library, perhaps, written on a wall, or revealed with a glow only seen if you make the room go dark.

“It also allows me to do a lot of foreshadowing, which is interesting because it helps you plan ahead,” says Dormans. “One particularly nasty boss that can spawn towards the end is the Wraith Lord and it has a Sword of Slaying, which can kill you in one blow. Normally you wouldn’t get away with something like that, but the game makes sure there are hints beforehand that warn the player that it’s coming and has this sword, and tells you there’s an item that will ward you against that magic.”

Unexplored is interconnected outside of individual levels, a concept that makes its roguelike dungeon generation feel like a huge leap forward for the form. As for what Dormans wants to do next with it, he’s thinking much bigger.

“One of the things I’ve found out that it’s pretty boring to generate a sprawling dungeon like this,” he says. “It’s more interesting to have smaller dungeons that are more strongly themed, like distinct places, and I think it’d be interesting to put them in an overworld, and make it so you can travel the country and find dungeons with only two or three levels and strongly themed. That’s much more interesting to generate, and you can almost generate a history to it. That’s a step I want to take, using the same generative techniques and maybe some of the gameplay to make much more of an adventure story.”

On the evidence of Unexplored, that would be quite a hero’s journey.


  1. Excalibur101 says:

    This is real fucking cool.

  2. whitechapel says:

    Great post. I’ve been super-excited about Dorman’s work since I saw the 2010 paper ‘Adventures in Level Design: Generating Missions and Spaces for Action Adventure Games’ and I had no idea he was going to actually produce a game out of it.

    Dormans – in the unlikely case that you are reading this – in the 2010 paper where you are linking the mission graph and spatial graph, the algorithm proposed seems to have no enforcement of the long-range order of the mission graph into the spatial graph (beyond the double arrows), i.e. there’s no apparent shaping of the player’s path through the dungeon so that they are more likely to run into pre-requisites (cloak of fire protection) before hazards (fire dragon). How is this addressed in Unexplored? It sounds like you still use replacement grammars for the mission graph (although not the spatial graph).

    • jorisdormans says:

      It’s actually done at the dungeon planning stage, which is briefly mentioned in the article. This creates a set of specifications for each individual floor.

      But for the individual levels of Unexplored I ended up with a blended version of missions and spaces: the mission is generated directly into a graph that represents the spatial layout. In this case this turned out the best way of dealing with the problem of transforming from an abstract representation of the level (mission) to a geographic one (space).

      • whitechapel says:

        Thanks so much for the answer. I also hunted down your YouTube video to understand more.

        Final question, if I may, how do you map the non topographical level graph to the real (square) map grid? I have seen this down elsewhere via a brute force recursive backtracking algorithm but it seemed a bit fragile. Ta!

        • jorisdormans says:

          The trick is that the graph I start out from is also laid out on a grid. This way I can make use of all the advantages of graph transformations while creating the structure for the floor, and still easily map the result onto a tile map. Initially every node and every edge corresponds to one tile. So if the graph was 5 x 5 nodes, the tilemap would be 9 x 9 (or actually 11 x 11 because a border gets added as well). Then I increase the resolution of the tilemap, shrink door and corridors, while growing rooms and caves.

  3. Snids says:

    You can see why this game is so amazing. It’s made by a properly clever bastard.

  4. Premium User Badge

    Drib says:

    I really wanted to like this game.

    The dungeons are great. They’re unique and not gridpapery, and seem a little less… artificial? than other roguelikes.

    But other than that? The game is an incredibly paper-thin roguelike. There’s just not much to it.

    I had my hour of fun, but then every run felt the same and there just wasn’t anything more going on. The dungeon generation is super neat, it’s just that the game itself isn’t.

    Or maybe I’m just a soulless jerk I dunno.

    • mcnostril says:

      I guess it depends what you’re looking for, but I see what you mean (personally I’m enjoying it a lot though).
      It’s definitely on the simple end, with very straightforward interactions; each run tends to be dictated by gear and the dungeon itself, and a lot of runs can be rather similar in their progression (I think a big part of this is the way stats work; interesting, but rather limiting) so the actual moment to moment gameplay doesn’t vary all that much.
      Basically, every run tends to play very similarly unless you specifically go out of your way to play differently or the dungeon generation does something special, which, to its credit, it seems to do somewhat regularly (and the updates since launch have already expanded on this a bit by fixing some bugs that were hampering dungeon generation and monster variety).
      However, I find the core gameplay to be quite satisfying. The combat and sneaking around feels good, and when you get some of the nastier dungeons it makes for some really exciting moments, especially before you’ve learned the game’s repertoire of tricks.

    • Lobotomist says:

      Its strange you would say that. The game is basically graphic port of Brogue, and than some. I never heard anyone saying Brogue is paper thin

    • aterriblesomething says:

      i feel you, drib. i really like a lot of what the game is putting down, but ultimately the movement and combat feels… weird, sort of loose and futzy.

  5. Lobotomist says:

    This is amazing game. And I really recommend it to anyone who has love for roguelikes or dungeon crawling or heck – just game where every playtrough will surely have some new crazy thing happening.

    Technically the game is basically Brogue translated to 3D world, but than with things added – like this really outstanding dungeon generation – and huge focus on puzzle solving.

    Another great thing is that developer is daily adding new things, and is always on forums to listen to people and take any suggestion they have.

    Really enjoying this game. Its roguelike I was searching for ever since they started moving ascii to graphics

  6. w820912 says:


    May I know where could I get the “Module inspector” for making similar levels?

    Thanks a lot!