Radical Content Generation in Unexplored 2
Ludomotion's new approach for generating entire open worlds
Artifacts is a new YouTube series made possible thanks to the AI and Games crowdfunding community on Patreon as well as right here with paid subscriptions on Substack.
Support the show to have your name in video credits, contribute to future episode topics, watch content in early access and receive exclusive supporters-only content.
Unexplored 2: The Wayfarer's Legacy is a roguelike RPG built around an ambitious concept. A fully realised 3D world, complete with backstory and narrative that is fresh on each new playthrough. As the Wayfarer, players must take the Staff of Yendor from its pedestal and make their way across the world in an effort to destroy it. Each campaign of the game creates an entirely new procedurally generated game world for you to explore: meeting friendly and enemy characters, learning the lay of the land, and the path you must take on your quest.
In the event you fail, the next wayfarer will take up the mantle, but the world will not sit idle and wait, instead, it will change in the intermitting time between each character’s respective journeys. But how does it all work? How can a game generate an entire world with unique histories and characters with each permutation, while ensuring it all results in something that is fun, engaging and exciting for each new playthrough?
Welcome to our first episode of Artifacts here on AI and Games. A new series that highlights generative design and procedural content generation. For this opening episode, I sat down with the lead developer of Unexplored 2: The Wayfarer's Legacy, Joris Dormans, to discuss the challenges faced in bringing this new game to life, and how it achieves this complexity while ensuring each campaign is unique, and fun to play.
Generative Grammars: Explained
In order to appreciate the inner workings of The Wayfarer's Legacy, it's important to understand how the previous game in the series operated. The Unexplored games operate courtesy of a procedural generation engine powered by ‘generative grammars’: a simple yet powerful way to achieve content generation ranging from dungeons to quest lines and much more.

Generative Grammars provide a set of production rules that can operate on a graph structure, you iterate on the graph to replace specific parts of it with new nodes and connections, and this is done by matching a production rule against a particular segment of the graph. Even with a handful of simple rules, you can begin to craft structures that can later be adopted for puzzles.
The original Unexplored, released in 2017, took the generative grammar concept and spun it in a new direction. 'Cyclic generation', as it is known, is an approach for procedural generation that ensures that whatever gameplay is created, even on a more abstract level, is achieved using a series of cycles. This idea originated from Dormans' research of classic action-adventure games such as The Legend of Zelda, during which it was observed that human-crafted levels often result in players achieving cycles of gameplay. Something that most PCG systems, and notably generative grammars, failed to achieve.
Let's discuss an example: in everything from classic all the way to contemporary Zelda games, players may visit a location and find a locked door, meaning they need to find a key in order to open it. Or perhaps there's an enemy that is introduced that you cannot defeat until you find a specific item. In each case, the game world is designed such that you're introduced to the problem, and through further exploration, you discover the solution, and will organically find your way back to the original problem to solve it. Hence there is a cycle of introducing the problem, exploring for a solution, and returning to the problem such that you can solve it.
Procedurally generated games seldom capture this aspect of traditional game design, given even the earliest of PCG games such as Rogue all the way to more modern games like Spelunky and Dead Cells build outwards from a starting point, and have some logic to determine where the level exit should be, often very far away from where you began. Generative grammars are good at rewriting the structure of a graph, but not great at retaining references and linking back to them organically. Hence it was clear there was a gap in the market to exploit.
The original Unexplored was the proof of concept that this idea could work for an actual video game title. The proof was in the pudding, given it could procedurally generate dungeons that felt far more organic and connected, given they would force the player to backtrack or weave in and out of portions of a given area in order to progress. And this was the cyclic generation concept in practice: rather than building the level itself, the cyclic generation would devise the design of the level. Afterwards, several additional layers of generation are applied to transpose the design of the level into a fixed geometric area, complete with puzzles, treasures and monsters.
Joris Dormans: "Yeah, actually, I'm very happy with the first game. That project was very well-scoped in the sense that I just wanted to do content generation or focus on content generation. I wanted to show everybody that I can do that pretty well and I did not really have very big ambitions for the design. So that's actually one of the reasons that I just stick very true to the Roguelike formula in the sense that now you're in this dungeon, you need to get this amulet and you need to get out and I threw in as many fantasy tropes that I could imagine *laughs*.
But as I said, I didn't have that many ambitions and I was just happy to see it did well, it was well-received. And if I look at - I haven't looked at the Steam reviews for a long time by now - but at one point about half of the Steam reviews said, "this is one of the best generators that I've I've ever seen." And that's probably not by accident, because we also put a lot of spin on that.
We tried to market the game as something that has this quality called the Cyclic Dungeon Generation. You could say this also had had a marketing purpose as well, even though it's a technical thing. We wanted to make sure that we could use that, leverage that to make sure that the game stands out and finds an audience.
But from my perspective as a designer, I had to park a lot of things that I find interesting as a designer, not as a programmer, and that had to do with the design sphere of things. So what does it mean to have an adventure in a dungeon? What is actually fun in an adventure is about fantasy worlds and for Unexplored 2 we started aiming for those goals. We really wanted to double down on that feeling of adventure."
For the remainder of this episode, I will be discussing some of the inner workings of the original game such that you understand how the sequel works. But if you're interested in finding out even more, I'd encourage you to check out episode 57 of the main AI and Games series, which looks at the original Unexplored game in much more detail.
Radical Content Generation
For the sequel, the concept was to take what the original game had achieved and subsequently explode it in scale. While Unexplored built 20 individual levels the player visited in sequence, Unexplored 2 generates an entire world on both abstract and granular levels. An open world map full of locations to visit, individual level areas for players to explore, hidden tombs and dungeons to explore for treasure, and an overarching storyline that is persistent and is influenced by the actions of the player and other non-player characters in the game.
Joris Dormans: "It took me about a year and a half to make Unexplored 1. And that was me with a little help from a few others. For Unexplored 2, it took me about four and a half, five years with a team that went up to nine at one point. Not everybody full time, obviously, but still, it's a considerably larger team in a larger amount of time.
And sometimes it feels like we didn't make Unexplored 2, but we actually made Unexplored 3 because our goals tended to shift, right? So when we started out we thought, okay, maybe it's going to take two years. And the ambition was, okay, let's repeat the success. But in an open world and really focusing on that sense of adventure.
But while we're at it, so many more things came into grasp and it was just too, too tempting not to reach out to some goals. Really diving deep into the whole notion of the world evolving and that legacy mechanics, that sort of that sort of thing."
The new approach, which Dormans nicknamed Radical Content Generation is much more ambitious in scope, using even more layers of generation in order to achieve its creative goals. However, it still relies on the same core technology as before. In essence, hasn't really changed from the previous game.
Joris Dormans: "The technology hasn't changed a lot. Actually very, very, very little. I still using the same libraries and when I started in Unexplored 2, I expected to do a lot more changes than I actually did. The changes that I did were mostly optimizations and the occasional bug fix. And so those underlying libraries, they did not change.
But the way we're using it, that's changed quite drastically. So Unexplored 1, there's basically three steps more or less. So you've got first, the outline of the dungeon with each level and it specifies what monsters, what things, what items should be present in a particular level. And then it takes that makes a level plan, which is the cyclic structure. And then it takes the plan and tries to make that into a map that's decorated and everything. And basically we still have the same structure for Unexplored 2, but there's a few differences. So instead of making an outline for a dungeon, obviously I'll make an outline for the world completely and that already is pretty a big difference with Unexplored 1 and Unexplored 2 is that level data is actually changed during a run, and in between runs right, so there is more opportunities to actually change that structure."
And so now let's dig into this in more detail. Starting with the open-world generation and how everything from this point feeds down into the lower-level systems.
Open World Generation
The world of Unexplored 2 is broken up into two distinct elements: an overworld that is the main backdrop for the story to play out, and within the overworld are individual locations for the player to visit. Players have to navigate the overworld to reach locations as part of their ongoing quest, all the while handling the challenges faced by random bandit encounters, the terrain they seek to cross, be it thick brush, swamplands, deserts or icy mountain passes, and of course, then deal with the threats that await them at their destination.
It's critical that for each playthrough of Unexplored 2, the overworld creates a unique and distinct gameplay experience. The top level of generation for the game is to figure out how this map should be built, ensuring that it satisfies key design requirements reflective of the development team’s aspirations, while still creating something that is challenging to traverse and enable for interesting gameplay opportunities.
In the original Unexplored, the cyclic generation operated at the highest level, and composed a level plan, that is then decorated into a playable map. This was done 20 times, to create 20 levels that represented a single playthrough. In Unexplored 2, the open world is crafted a series of nodes and one playthrough can have up to 400 nodes in a given map that a player can visit, or move between. And each node encodes data on what that node looks and behaves like, but also subsequently feeds information to the later generation systems, such that when the player visits that node as a playable area, it will then result in one or more levels for them to explore, and that's handled by another layer of procedural generation that we will discuss shortly.
So let's start with how the overworld map is built. It's created using a process known as Voronoi Tesselation. Named after the mathematician Georgy Voronoy, that partitions a plane based on a set of points established within it as you can see on screen. By creating a series of points, you can then separate the area out into a series of shapes that are not guaranteed to be the same as one another. Unexplored 2 starts by establishing the topography of the open world, by creating a Voronoi diagram with a 3:2 aspect ratio, and around 80 points. This process effectively creates a tiled grid from which a map will eventually be built.
From this, a starting point for the player is established, which represents where the player will lift the Staff of Yendor from, and another point will represent the final goal location of where it is to be destroyed. After this, the generator begins to add specific tile types in the grid cells. The Ocean is fleshed out on the left side, and a mountain range appears somewhere in the middle of the map between the starting point and the goal and can iterate out several times such that it grows along the graph. After which, the map begins to identify what are known as adventure sites: key locations that the player will visit as part of their story, or be the home of interesting locales that players may wish to explore in their own time. Alongside this, each of these sites is assigned a geographic region: swamps, hill areas, deserts, forests and barrens. Once complete, all remaining tiles are assigned a region by allowing them to grow out from the adventure sites, hence forests and deserts will begin to stretch farther across it. Then the final step of building the geography is finalising the topography: rivers are created by following the edges between Voronoi cells, which can then be used to dictate whether it is possible to cross between them.
The final piece of information is the encounters: seeding into the world where it is possible for the player to encounter new allies or enemies. This is encoded within the areas between tiles, including the difficulty of any possible encounters that may occur.
With the Voronoi diagram finished it is then translated into an actual graph that is rendered out as the map. To do this, the game actually generates a second Voronoi representation with even more grid cells (around 1200) that transposes onto the original, and this is then rendered in the game world while including additional information such as elevation and bridges and the like based on the rivers that cross regions.
Now it's critical to understand that this top level of generation is only responsible for the open world map. Each tile in the original Voronoi that is accessible - meaning it's not in the ocean or the highest of mountain ranges - has now got additional information seeded inside of it. The region it represents, the encounters the player could experience, key locations they plan to visit and much more. Each of these cells is now a separate location that the player can explore, but it will need to be generated by a separate set of systems on arrival. So next, let's go into more detail about Unexplored 2 generating individual level areas.
The Theory of the Place
When visiting a particular location in the overworld, the specific cell in the Voronoi graph that represents it contains a myriad of information that is going to be used in the generation algorithm. As mentioned already, once the overworld is generated, each region is aware of its topography, the biome and, what opportunities it should provide. This can be as part of the main storyline, but also side quests, and enemy encounters. With this information at hand, the big question is how do you then bring all of this together in a way that doesn't just service the gameplay but also feels meaningful in the context of this particular run?
The original Unexplored's solution for level design, Cyclic Dungeon Generation, would no longer cut it, given - as the name implies - it's designed to build dungeons. But Unexplored 2 is more than just dungeons: locations you visit are typically in the open world, above ground and much more natural and organic. So it needed something that fits that design ethos.
Joris Dormans: "Writing a dungeon generator for something that has monsters in it. That's not, that's somehow that's... I'm not going to say it's trivial or easy, but it's fairly easy because you're just going to have a succession of rooms and put some monsters in there. And if the combat's good, you immediately have a good gameplay.
But what we are trying to do is move away a little bit from that endless combat all the time and touch into a few other things of the adventure mode. And that requires different types of levels."
And so the location generation systems operate using a design philosophy Dormans refers to as 'the theory of the place'. In short: the theory of the place is an idea whereby the level generators construct the anatomy of a level such that is sensible, interesting, and seemingly natural, and then like before fills out all the details in multiple stages. Inspired by tabletop roleplaying games, the concept is designed to align with the sense of adventure that a player should experience in an open-world game. It leans on the existing tools crafted for the first game and then seeks to generate a blueprint for what this location can conceptually be, and then the lower levels of generation can manifest it into a playable space.
Joris Dormans: "You have this tower somewhere in the forest, right? And that's where the story is. And the tower is the place and the forest is the surroundings. And there probably needs to be a path leading up to the tower to make sure that that the player can find it and in the environment that might be all these hazards. And that's actually a cyclic dungeon structure applied to a forest, for example.
And that could definitely be one of the cases. And it might also make it possible that there is a back entrance leading into the same place, but that's hidden or difficult to reach. But that way that allows you to bypass to the main gate, for example, which might be guarded and everything. But what this leads to is, is that there is this level's structure and there's a lot of markers inside that structure that allows encounters to know where to spot enemies or where to spawn certain things. And that's actually also layered on top. And that's something that we didn't have in Unexplored 1."
When generating, the system is told what the place entails courtesy of the overworld systems. It knows the type of location this place is, and the gameplay purpose or focus of said space. It could be just a clearing in a forest the player stops at on the way to their next story location or a keep on a hilltop one can explore if they choose, or a temple, complete with a dungeon inside of it that will mark the next stage of your quest. Regardless of what it is, it should be recognisable as a distinct and unique location. A big part of this is how each level builds up to its focal point. The theory of the place focuses on making the journey to the point of interest part of the challenge and the enjoyment.
When a location has been established by the overworld generator, the type of environment will correspond to a built-in template for that location type. So when playing the game, if you encounter a temple in a forest biome, an encounter in a river crossing, or even a regular village of civilians you encounter, these are all built from established templates. Each template is built to provide design rules of how these should come together. So for example, the temple in the forest should be deep inside the forest, and a path needs to be built to reach it. It should be readable to the player, that the temple is the goal to reach and the path is worth traversing when first presented.
Hence the generation begins by identifying a location for the place, and the path that is taken to reach it. The path itself is a process whereby it can decide on having one or more entry points to the place, and some may even use the cyclic generation concept of using lock and key mechanisms, thus providing a sense of challenge for the player as they attempt to reach it. All-in, this helps present the idea that the place is of importance and distinction, given the path being taken to reach it.
To add further challenge, encounters with other characters or enemy monsters are then created along the path, and often in the place itself. There may be a primary encounter, like a guard at the entry to the place, while patrolling enemies can be avoided.
Once again this is all courtesy of the transformation grammars, given they will encode information about the structure of the environment, make requests for specific features such as the spawning of guards, or having a treasure vault, and then even themes that relate to the specific biome regions the overworld map uses. This is all decorated and then crafted into a playable space, much like was seen in the original game.
But unlike the original game, it can even request that the level expands beyond its current form, with the main structure of the place simply being an entranceway to a dungeon underneath it. And the dungeon will often rely on the generated level of the place to inform the structure of the dungeon it then generates beneath it.
Plus on top of all of this, each location template has variations that can be used to mix things up if the generator so chooses. Hence a place might be isolated from its environment, and there isn't a direct path to it. Or the secondary entrance to the location is intended as an escape route from an encounter. Or the second entrance could be a shortcut to a treasure vault. Ultimately each location has more opportunities to generate something unique.
One of the more notable results of this process is that these generated spaces are often smaller than the dungeons seen in the original game. This alongside a change in how these locations are introduced and presented to the player, with the camera swooping from the point of interest to the entrance point, were all part of a larger intention to move away from combat as the primary focus and encourage greater exploration.
The Passage of Time
With the overworld and individual location generation systems in place, there are still additional systems in play. When generated, a particular game world is stored in a save slot of the players choosing, and they can have multiple saved worlds at once. While roguelike gameplay often imagines that every playthrough be 100% unique by re-generating the world from scratch, Unexplored 2 takes a different approach by allowing players to run multiple attempts on the same save file. So when your Wayfarer dies, you have the option to try the run again in the same procedurally generated world. However, the next Wayfarer does not spawn immediately, and this is where the additional generative systems kick in: the game world moves forward in time and introduces changes both significant and subtle that will impact your next playthrough. But also, sometimes the world changes during your run as you're playing it. This is enabled by the templates for each location being used to re-generate aspects of that location after it has already been built.
While the larger geographic features remain intact, level data can change both during and in between runs of the game. A good example is encounters that are generated. Say if you visit a location, when it is generated it could have placed an encounter in a given spot. This is because it knows an encounter exists in the level and it has spawn markers flagged for that encounter. But over time, that encounter might move. Or the encounter evolves into something larger because it is unresolved. Given the level data knows what encounters it can support and where, it can lead to multiple different encounters being created in the same generated area, even on the same run, after different periods of time.
Joris Dormans: "Every time you enter a level, basically, then the level is more or less fixed and you can’t regenerate it when playing in the level. But for example, if there are bandits in this tower and you defeat them and you defeat the boss of the level. Then that encounter, that's sort of seeded those stories, that's going to be ended.
So then the generator knows the next time you travel there, the particular stories that were associated with that encounter do not have to be regenerated again. So if there's no story in that level, then that level is probably going to be empty and it will fill it in with some decorative things and maybe, maybe a wandering creature or two.
So then the generator knows the next time you travel there, the particular stories that were associated with that encounter do not have to be regenerated again. So if there's no story in that level, then that level is probably going to be empty and it will fill it in with some decorative things and maybe, maybe a wandering creature or two.
But basically it will essentially it will be empty. But once it's empty, there's also the freedom to add new encounters because the encounters are just basically saying the next time you get here, something very bad has happened and there's restless bones everywhere and undead and whatever. Because who knows what happened at this place. And then it can generate the level accordingly.
And basically it's there because it's all the same. It's generating the environment from the same seeds. The environment is going to be exactly the same. But the details are going to be a little bit different because the rooms are filling up differently when the level is generated as a particular order in which things are done. And every little node here is one transformation and every node has its own seed.
Sometimes changes in the stories do lead to slightly different changes in the geometry of the level. But at least the structure of the level is exactly the same. And I doubt people actually notice that sometimes, though, because there's now wolves instead of bandits, one column moved a little bit to the side to make room for something. That I don't think people will notice. *laughs*"
On player death, those changes can be even more drastic. Enemy encounters can move and change across tiles, and locations can evolve in a much more drastic fashion, but all the while retaining the consistency of the game world. It gives the game a rather tangible feature that seldom few titles actually accomplish: lasting consequence. As you see how your actions, or even inaction, can lead to a pervasive and drastic change to the game world the longer that you play it.
Closing
Unexplored 2 takes a unique look at how procedural generation can be used in roguelike game design. By adopting its own design philosophy and tailoring its level generation systems to suit, it enables entire game worlds to be built that cater to the sense of exploration that the developers seek. All the while creating an environment that feels lived in and ever-evolving with each step you take.
Thanks for reading this inaugural episode of Artifacts, all about Unexplored 2: The Wayfarers Legacy. Plus a special thank you to Joris Dormans for taking the time to sit down and chat about the game in detail. If you've yet to try the game or want to learn more, links to the game itself, and Joris' blogs on the development of the game.
Artifacts is our new series on all things procedural generation and generative AI here on AI and Games. If you're a longtime supporter you'll notice it's the same approach, but a slightly different topic. We already have several episode ideas in the backlog, and I look forward to getting some out to you shortly. But in the meantime feel free to let us know what PCG-focussed games and projects you'd like to see on the series in the future.
Links & Related Reading
Unexplored 2: The Wayfarer’s Legacy
Adventures in Level Design: Generating Missions and Spaces for Action Adventure Games,
Joris Dormans, PCG Workshop, Foundation of Digital Games Conference, 2010Level Generation in Unexplored 2
Joris Dormans, Ludomotion.com, 2019Generating World Maps for Unexplored 2
Joris Dormans, Ludomotion.com, 2019The Theory of the Place: A Level Design Philosophy for Unexplored 2
Joris Dormans, Ludomotion.com, 2021