Procedural content generation is a popular piece of technology, to say the least. From Minecraft's rolling hills to Dwarf Fortress' intricate world histories, we love games that can generate parts of themselves each time we play them. But other than tweaking the sea level in Civilization V, we don't tend to think of content generators as things that can change much. What kind of Spelunky levels would Minecraft's worldgen make? Do Dwarf Fortress' histories share a literary style? This week The Saturday Paper is about generating the content generators - and the world of possibilities that opens up beyond.
We're reading A Procedural Procedural Level Generator Generator, a paper by Manuel Kerssemakers, Jeppe Tuxen, Julian Togelius and Georgios Yannakakis. In it, they describe a system they built for interactively designing level generators for Infinite Super Mario Bros. - and it offers up some interesting insights and ideas about how we use content generation in the games we make today. Users of the tool can view level generators abstractly, look at them in detail, see sample levels, and combine generators they like to make new ones - similar to the way the evolutionary system we saw two weeks ago worked. There's a download link to the tool later in the post.
How do you 'look' at a level generator, though? The image above shows how - the tool generates lots of levels from a single generator, and then lays them on top of each other, averaging out all the colours representing each type of tile. It's surprisingly effective - you can see generators that repeat particular patterns (such as rising and falling sections of blocks) as well as see which level generators are more chaotic, or that feature lots of detail at different parts of a level.
If you select one of these level generators, you can see a generated level in more detail - even playing one out yourself to see what kind of output it provides. You can also select two generators to combine together, to try and mix features that you like into a single generator. To understand why this works, and how these weird patterns you can see in the image above come out, let's look at how these level generators are described.
The procedural procedural tool uses agents to generate their levels. Each agent is like a robot with a particular set of instructions attached to it. Before generation, the level is a blank white canvas, and the agents are set out at different times to lay tiles into the level - in this case, things like coins, platforms or breakable blocks. The agents have lots of parameters that describe their behaviour, such as how often they act on the level, an area they randomly spawn in, how they move across the level, and what tiles they drop[ref]If you want to see a complete description of the agents, there's a very clear breakdown in the paper itself.[/ref]. With just a dozen or so of these agents you can describe a wide variety of level generators.
When you choose two level generators you'd like to see combined, the tool chooses a random grab of agents from each generator, and combines them into a new one. The different rules will all interact in different ways (some of the agent rules also allow them to react to tile placement, offering up even more interesting combinations). You can then view these new generators in the composite view we looked at above, drill down and play levels from each one, or go on to combine them further if you see something you like.
Sample levels from a single generator - you can see similar patterns or themes in placement.
The tool has some mixed but undoubtedly interesting results. Some generators show great diversity, while others produce variations on the same level over and over (both of which I can see being useful for different types of game). What's encouraging about the tool is that it's fast and robust - it can generate an average-sized playable level in an impressively nippy 1/20 of a second, and using Robin Baumgarten's Infinite Mario AI it can test the initial set of level generators to ensure they tend to generate playable levels. This means that the tool is in excellent shape for further development to explore other genres, or look at different ways of representing level generators.
What's most interesting to me is this little quote in the evaluation section:
...[some generators] generate levels that look completely different from each other in the game view, while retaining a common “theme” or “style”.
'Theme' and 'Style' are not words you associate with procedural content generators very often, but I think it should be. Instead of thinking of Minecraft's world generator as the only possible generator that could appear in such a game, we should think of it as just one possibility in a huge space of generators. There are generators that favour dramatic mountain ridges, ones that place villages in valley passes, and run rivers through deserts. This research helps us think of generators as things that we might also one day generate - perhaps automatically, even.
This is something I hope we can explore more in the research world, but it also has a place in game development too. Can my dungeon generator have a personality? Could Dwarf Fortress' world generator develop a taste for romantic subterfuge one day, and shift to preferring political intrigue the next? This paper is an excellent example of how to build simple abstractions of content generators, and explore a whole new exciting space through this.
At the start, I also mentioned the idea of Minecraft's world generator making levels for Spelunky. The authors of the paper talk at the end about their hope to build a generic level generator generator - one that could create level generators for roguelikes as well as for platformers, simply by a designer sitting down and selecting the right combinations of generator until something they like comes out. The idea of generalising content generation across games and genres really appeals to me, too. Of course, this all requires people to spend the time generalising their games so that they share common inputs or interfaces, something that many developers can't afford to do. Perhaps the research in this paper will lead to some Tiled-esque middleware that might take care of this for them, though. I certainly hope so.
Where To Find More
The paper is freely available on Julian Togelius's site here. The authors are all very approachable too, and I've met a few of them in person too. Manuel is currently part of Abbey Games, who are developing the exciting-looking Reus, but plans to return to finish his Masters' degree after release in May. Jeppe is currently hard at work at ITU Copenhagen on his project "A Framework for Real-time Collaborative Game Design in Digital Environments", where he's working on tools that let designers sketch games out while the player is playtesting them. Julian is heading up games research at ITU Copenhagen, and Georgios recently moved to the Institute of Digital Games at the University of Malta.
All are very enthusiastic about their work and I highly recommend getting in touch with them to learn more about the work and its current status. We'll also have comment threads on Reddit's /r/gamedev and Gamasutra's blog section too - I'll link them here once they're online. The authors of the paper may be popping into those threads to answer questions and discuss the work, so be sure to join in if you want to chat!
Aside from reading the paper, you can also interact with the tool itself! The authors have very kindly packaged up the tool and uploaded it to coincide with The Saturday Paper - the first time it's been made available to the public. I'm incredibly grateful for this, and I know many of you will be excited to take a look. Download it here. It has some GUI issues on some Macs, but Windows users should be just fine.
As ever, don’t forget to let me know what you thought of the column this week. Let me know by emailing me – email@example.com – or getting in touch @mtrc on Twitter. Thanks for reading!