The following blog post, unless otherwise noted, was written by a member of Gamasutras community.

The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

Tanya X. Short is the Creative Director of Kitfox Games. Kitfox Games’ first project, Shattered Planet, released to Steam in July. Moon Hunters is currently exceeding its creators’ expectations on Kickstarter. Both are procedurally generated games.

When developing any game, but especially a game that has procedural generation as an explicit feature, we constantly make decisions of what to generate and what to craft. What to automate and what to build. What to simulate and what to script.

The following article is written to help you choose the best “zoom level” for your procedurally generated game. It’s part post-mortem, part raw idealism, and entirely intended to be just one way to think about design within a procedurally generated system.

Remember that I’m a designer, not a programmer. We might get a bit technical on process and logic, but this won’t include any code! OK? OK.

NOTE: Sure, call it random generation instead of procedural. Whatever! The label isn't the interesting part.







The Endless Puzzle

As developers, sometimes our reasons for using proc gen are obvious. We want the game to be more replayable, perhaps even infinitely so, with an element of unpredictability. This is tempting not only because “infinite fun” sounds cool, but also because any given bit of content or system becomes exponentially more valuable and efficient.

When a player tells me about a level “they found”, I’m genuinely interested in hearing the rest of their story.

Slightly less obvious is the benefit of unique results. Genuinely one-of-a-kind experiences are satisfying to create. When a player tells me about a level “they found”, I’m genuinely interested in hearing the rest of their story -- I don’t know how the next part goes. Sharing that ownership is delicious, which is maybe a cousin to the joy of dungeon-mastering.

Moon Hunters

More tangibly, proc gen games are also more fun to play and test as a developer, and endless content will continue to increase in value alongside the rise of Youtube/Twitch culture (or in any democratised communication culture).

But, maybe most commonly, most developers want to make the game they want to play. And I'd guess if you're reading this article, you're probably a curious person. You probably score higher than average on the Big 5’s Openness to Experience scale. Scientifically, you’re more likely to have this score if you are intellectual, artistic, and/or novelty-seeking... like, say, someone who chooses to work a creative-yet-technical, highly challenging, constantly changing field like games? According to Jason VandenBerghe’s studies of players, high Openness to Experience means you have a high chance of enjoying Minecraft. Hmm.

The point is that you probably enjoy solving interesting problems... and what's a more interesting problem than procedural generation?

The first risk we see when we start is the blank page -- the fear we will generate nothing of meaning.

The Blank Page

The utter nothingness of the blank slate means the algorithm could generate anything, and the chances of generating something terrible looms large. After all, it takes some wrangling of the algorithm just to make some kind of sense. Gaps in the terrain. Ten toes on each foot. Monsters and players spawning on top of each other. Madness.

My favorite (slightly meta) example of this is “To That Sect”, which is a game created by Michael Cook's A.I., named ANGELINA, as an entry into a game jam. It’s incomprehensible. Maybe other A.I.s would enjoy it, but it’s generally not recommended for human consumption. I'm personally hoping ANGELINA makes another appearance at Cook's ProcJam in November.

To tame the chaos, we add rules to the algorithm.

Accepting that our proc gen “molecules” will be larger than actual molecules(1), how large is too large? Where does meaning start? We must choose carefully, as the blind spots in our simulations may tell us more about ourselves than the parts we choose to simulate.

For Shattered Planet, we went with the fairly typical tile-by-tile approach you will usually see in discussions of level generation algorithms, likely descended from Nethack. Our biomes were defined by lists of what possible tiles, items, enemies, and other entities it could generate with. A given tile knew some information about itself, such as what kind of terrain it was and therefore what sprite to render and what kinds of pathfinding to support, but that's it.

The benefits of this approach were clear. We could generate thousands of maps, each of which were different. The entities themselves were hand-crafted, but in their random placement, each encounter would be unpredictable. It felt truly infinite.

On top of this, we translated my level design intuitions and experience into rules. We dynamically determined the “critical path” and generate content accordingly, as the level was built, to encourage a feeling of risk-for-reward. The “rooms” grew themselves with artificial life algorithms to feel organic and naturally crumbled. And so on.

But there was a problem.

Footnote 1: When asked, “So what is simulated by your proc gen systems?”, the ideal answer for many is “everything”! Yet even Dwarf Fortress requires defining possible molecules of content. Tarn (a human, by all accounts) had to create the idea of what grass is. That grass is hand-created content. Algorithms don’t invent/evolve grass from a data input of carbon and other chemical molecular compounds, which are themselves defined by rules of physics. Only the universe has done that, so far. And after BILLIONS of years of calculations, it figured out how to make dinosaurs before it figured out flowers.





The Problem of Obedience

Algorithms are limited by the innocence of the unimaginative.

The more we guide our algorithm, the higher chance we will create a bland, utterly predictable algorithm that in turn creates meaninglessly different (i.e. functionally identical) results. Even worse, we might end up with a game that is so mediocrely predictable, we might as well have just built by hand in the first place. With every new rule, we could feel we were painting ourselves into a very boring corner.

Our intrinsic fascination with "high resolution" procedural generation would be fine, except that it's an infinite hour problem. Even if you don’t suffer from the common creative problem of perfectionism, it can be very difficult to know when to stop.(2) Sometimes it feels like the only way out is to zoom in even further, to make molecules even smaller than previously assumed.

But we realised our actual trouble with such a “zoomed-in” proc gen approach for Shattered Planet was that everything was completely stand-alone. No entity “knew” about each other, because they were all obedient, mute puzzle-pieces.

In our rush to make everything modular, we had accidentally eliminated relationships between different system elements. This meant there were no real consequences. After 15 hours or so of play, you felt you’d “seen what there was to see” -- and you were relatively right. You might not have seen every possible permutation, but you’d seen everything that had meaning.

This is just a marketing image, but in retrospect, the space between each character is ... symbolic...

Mammals, and humans in particular, enjoy recognising patterns. Pattern recognition is so fun, that we’ll look for them on our own where none seem to exist ("apophenia"). Colloquially, I've taken to calling it the Constellation Effect(3), which is a bit of a Promised Land of game design -- if you can get players immersed and engaged enough to start seeing meaning in chaos, you've got them hooked.

...rather than recognising a particular bit of content ... players enjoy recognising all of the many layered rules of generation.

Humans are so good at pattern recognition, that we’ll find or invent patterns within patterns within patterns -- in the case of proc gen, rather than recognising a particular bit of content (a room, a monster, an item), players enjoy recognising all of the many layered rules of generation. And once they feel they've figured out all of them, the fun’s gone.

In order to deviate from the otherwise-predictable rules and hint more concretely that there might be patterns left to reverse-engineer, we realised we needed to introduce occasionally larger “molecules”, in the form of hand-built rooms and level chunks.

But the Shattered Planet structure simply could not support it -- and it was too late in the development cycle to change the structure drastically. A complete re-factoring was simply unfeasible.

So, as a compromise, we added a few “awarenesses” to the entities, to stitch things together:

NPCs perform happy emotes when they triumph over an enemy, and worried emotes when they are near death

Crablet queens are charmed by players wearing crab-masks

Corruption ("the Blight") and fire grow organically, with their own rules for growth and effect on other entity-types.

Some enemy-types attack one another.

On death, player misadventures are reflected in their obituaries in the form of Mad Lib-style tweetable summaries

Players seemed to enjoy it. It was entertaining enough. It was just enough to inspire a bit of Constellation Effect-ing. The iOS version received a 77 from Metacritic, if that’s your measurement of choice. Maybe we chose the right resolution after all.

But our next project, Moon Hunters, aims to have more extensive narrative elements. The tagline is "build your mythology". So, to achieve a higher meaning-to-noise ratio, we're zooming out a bit, lowering our algorithm's resolution. Of course, that has its own problems.

Footnote 2: If you just want to play with proc gen for the fun of it, go for it. The procedural generation subreddit is fantastic for finding and sharing cool algorithms for generating everything from fingerprints to writing styles to planets. Generate anything you want! Enjoy yourself!

Footnote 3: I'm fairly sure I didn't invent the term Constellation Effect, but I have no idea where I first heard it. Any clues appreciated!

Generating By Chunk

Moon Hunters level generation will still use tiles in a sense, but the tiles will contain so much more information than those of Shattered Planet, we're more comfortable calling them chunks. The chunks are more similar to rooms in Diablo, or the tiles of Carcassone.

We're still sorting out the details, but each "chunk" contains information about:

Defined edges (collision/paths)

Water features (essentially, special collisions/paths)

Possible spawn points for entities

Requirements for neighboring tiles or placement

Essentially, each chunk knows how it relates to the chunks around it. In turn, each entity has environmental conditions for its own spawning. Building in this increased awareness allows me to potentially craft much more interesting levels and encounters. We'll also be able to intuitively create collision and movement rules as part of the content objects themselves, which allows me as a designer to tweak and fine-tune the 'feel' of things more easily than if I had to adjust a line of code in the algorithm.

I'm confident that the quality of encounters and story-bits will be much higher, on average.

We anticipate, however, new problems which are mostly the reduction of every benefit normally expected from procedural generation. Compared to Shattered Planet, we expect that Moon Hunters will be:

More limited -- chunks are less flexible and therefore less valuable than tiles

-- chunks are less flexible and therefore less valuable than tiles More predictable -- like hand-scripted games, players will probably be able to 'feel' when challenge will ramp up and ramp down, for better and for worse

-- like hand-scripted games, players will probably be able to 'feel' when challenge will ramp up and ramp down, for better and for worse Less replayable -- instead of 50 satisfying map gens per playthrough, we anticipate 5. Instead of 100 satisfying game completions, we anticipate 10.

-- instead of 50 satisfying map gens per playthrough, we anticipate 5. Instead of 100 satisfying game completions, we anticipate 10. More time-consuming to produce -- maybe most damning, as a designer I will have to hand-craft exponentially more chunks than I did tiles, which slows production.

We believe it's worth it. We're treating proc gen in Moon Hunters as more of a spice than a core feature, compared to its centrality in Shattered Planet. It's barely even mentioned in our Kickstarter, except that it's "different every time".

Of course, there's probably a drawback we haven't encountered yet, so that will be fun to discover when it pops up. But in the meantime, Moon Hunters procedural generation will be building on Shattered Planet in one other, more ambitious way that bears mentioning..

Beyond Level Design

Shattered Planet's event system tags the player with certain titles based on results of choices made. You always begin as 'Curious', but throughout play, you can earn various titles like 'Error-Prone', 'Bad Singer', or 'Destroyer'.

Example: this robot has earned "Scientist" (upper-left-hand corner)

Some combination of these then generates strings, Mad Lib style, to form your obituary. We actually gave each title an integer rating that corresponds roughly to rarity and/or memorable-ness, and the highest-rated titles are more likely to appear as part of your generated obituary:

We didn't intentionally build on this for Moon Hunters, but when I started obsessing over mythology systems, it became more and more obvious how much an obituary and a legend could be seen to have elements in common.

In short, we asked ourselves what "molecules" make sense for a mythology algorithm. In the same way that mountainsides can be seen as made up of dirt chunks (or dirt cubes), we decided the protagonists of legends could be seen as made up of personality chunks, which are the result of decisions.

But that's a specific paradigm of storytelling -- what if, rather than focusing on the concept of people having consistent 'personalities', we looked at their motivations? Ben Kybartas conceived of procedural narratives as entities with motivation constantly seeking for the "most dramatic" results from every action. Or what if we focused on the storyteller and their knowledge/intimacy or ignorance/distance of the subject? Or what if we treated legends and myths as cultural artifacts, reflecting the values and tropes most valued by that culture, intended to become ritual?

If you look at procedurally generated personalities and dramatic scenarios through the lens of science fiction, you'd likely come up with something like the unique Astrobase Command, which features dossiers of characters and their ... quirks.

You can see different perspectives on "what is a culture" if you compare, for example, the rules of generation in Ledoliel and Crusader Kings II. The former depicts culture as a result of personality-in-aggregate, such as ancient evil. Its "molecules" are traits. You interact with that culture on a one-on-one basis, giving gifts, or touching, or talking to its ambassador.

By contrast, Crusader Kings II creates culture through the formation of laws, with minor variances based on the virtues and flaws of their political leaders. Its molecules are power structures and taxes. You interact with that culture by changing those laws, and/or marrying into its power structure.

I'm particularly excited about the next crop of proc gen enthusiasts because I think some of us are starting to look beyond physically quantifiable things to generate. I mean, continents and weather and animals are pretty cool and all, but not many professionals historically have tried to generate interesting people or families or societies.

I'm definitely keeping an eye on /r/proceduralgeneration because a next step after fingerprints and handwriting is to look at the algorithms that make us think the way we do... and the next step after that is to turn those generators into games!

Summary

By choosing your molecules you are choosing not only the replayability and mechanical value of your procedurally generated game, but also the nature of the content. It's easy and tempting to get wrapped up in generating at the highest level of detail, and that might suit your simulation if you're willing to really invest in flexible, highly aware units of content.

For a game that's using proc gen for "added flavor", it might make more sense to step back, zoom out, and let each molecule take on a meaning of its own.

Have a particularly gnarly proc gen problem you're trying to solve, or resolution decision to make that you want a second opinion on? I'll be checking the comments for the next week or so, or feel free to tweet at me!