Devs weigh in on the best ways to use (but not abuse) procedural generation

Devs on Into the Breach, Astroneer, and Moon Hunters chat with Gamasutra about how they've learned to best use proc-gen techniques in their games -- and what other devs looking to start should know.

Like so much in game dev, the decision to use procedural generation in your game is a double-edged sword.

While it provides a theoretically unlimited amount of content, you sacrifice the advantages of your game being bespoke and hand-crafted.

The goal, then, is to craft tools that can turn out procedural content in near infinite quantities and configurations while making that content feel as close to homemade as possible.

To explore some different approaches to that problem, Gamasutra reached out to a number of devs with experience working with procedural tools and asked about how they thought about different methods of content generation, and how they avoid making procedural content that feels banal and recycled. 

Why procedural content?

First and most obvious is the question of why choose procedural content in the first place. For Kitfox Games' Tanya X. Short, co-editor of the book Procedural Generation in Video Games, the answer is simple — it’s just more interesting, it’s a way to build something that even its creator doesn’t fully recognize.

“Procedural content and handmade content each have their own strengths and weaknesses. To me, the main difference is that I enjoy creating procedural content far more, as a designer, because my creation has more opportunities to surprise me.”

"Most newbies in procedural generation are afraid of chaos and random nonsense, when what they should be worried about is generating too much samey, boring blandness."

For Justin Ma of Subset Games, who utilizes procedural content both in their breakout hit FTL as well as their new title Into the Breach, it’s not necessary to exclusively choose one or another, either procedural or handmade.

“Both approaches to content creation have a place in the games world and both can lead to great results if executed well,” Ma says. “Speaking as a player of games, I am generally less interested in completely linear games that test if you can achieve the goals laid forth by a designer exactly how they intended you to play.  I'm much more interested in exploring dynamic systems that give the player a lot of leeway to express themselves.  However the most compelling games to me often use both procedural and handmade content.”

The key focus is always to ensure that at the end you have a product that’s engaging and fun, above all other considerations; procedural content, properly deployed, can help with that.

“You COULD simulate complex procedural systems that are amazing from a technical perspective, but if they're not aiding in making the game enjoyable, it's kind of a waste.  For example, we found that heavily restricting the procedural generated elements was necessary to make Into the Breach's battles less frustrating. Instead, we relied on creating simple mechanics that can interact with each other in a variety of interesting and dynamic ways.”

That solution is a perfect illustration of how bespoke and randomly generated content aren’t necessarily oppositional, and can actually be used to amplify each other’s strengths.

"With Into the Breach we found that the amount of fun you'd have with the game was highly dependent on where enemies stood in relation to their environment.  If an enemy is in a corner attacking a building, it's much more likely that you'll be unable to neutralize the threat without causing collateral damage to the buildings," continues Ma. 

"This feeling of having no potential solution was unacceptable to us so it became clear that we would need to create environments that would minimize the chances of this happening. The types of problematic terrain configurations was quite varied so we eventually decided that we could not rely on procedural generation of maps.  Instead we opted to manually design the basic layout of each map and use procedural generation for less important aspects of maps (such as forests and sand locations) as well as elements that were unique to specific missions (such as where key structures were spawned).  The result was a lot of variety of maps while avoiding problematic layouts as much as possible - however if you play enough you will likely start recognizing key features.”

Zabir Hoque, an engineer at System Era Softworks whose 2016 release Astroneer leans heavily on procedurally generated elements, agrees that the best results are often produced when procedural and bespoke content is married together.

“Generally, handmade content allows for a level of polish that is very hard to replicate with an entirely procedural system,” Hoque says. “The goal with procedural content is to provide novelty, but we want some level of familiarity so the player isn't just experiencing chaos. Artists and designers can be extremely convincing, and building procedural systems that can match that level of care and quality can be quite hard. That being said, having procedural systems enables scenarios that would otherwise be impossible - for instance, in the case of Astroneer, creating varying game planets that provide alternate experiences each play through.”

In generating the landscapes of Astroneer, Hoque and his team use handmade assets as landmarks to break up procedural content and make the whole seem less random and unfamiliar. They treat these handmade pieces as having an “area of influence” that extends around them into the procedural content and influences it in terms of player experience. For Hoque, building procedural tools isn’t just a way to save labor or reduce the amount of artistic content required to build a game; quite the contrary, it’s a way to empower artists.

“From a technical side I think the most important thing to consider when building procedural systems is how to allow for artistic control at various authoring levels,” Hoque explains. “You want to allow for authoring a rule set for general use cases, and then provide enough vectors of configuration so users can exercise artistic control when needed.“

And Hoque echoes Ma’s sentiments about ensuring that the final product is entertaining and enjoyable, about serving the player first.

“With our terrain system, we could just use Perlin noise everywhere in the terrain with random values and say ‘Look! It’s different every time!’ but this is what leads to the feeling of bland repetition. Instead, we try to think of how the player will play the game and when they’ll seek out novelty, and that is where we try to introduce variation.”

Putting procedural content to work

Once you have landed on procedural generation, the challenge becomes masking it’s randomly crafted nature as much as possible, or unifying it with handmade assets.

“Honestly, there are so many considerations it's hard to sum up,” Short says. “Basically, most newbies in procedural generation are afraid of chaos and random nonsense, when what they should be worried about is generating too much samey, boring blandness.”

Short plans to address this very issue in her GDC talk on March 22nd, where she’ll refer to the work of designers like Dr. Emily Short (who develops middleware artificial intelligence and security solutions at Spirit AI) and Jason Grinblat (of Caves of Qud fame).

"It's a bit pretentious to call your algorithm a co-author, but it's also extremely true, because often your A.I. friend will surprise you with the outputs, in both good and bad ways. It's the joy and the horror of the medium."

“It's a scary, giant topic that I don't think anyone has solved, so I hope nobody in the audience brings tomatoes. But as a quick summary, I recommend first analyzing your system inputs AND outputs for orthogonality — the less overlapping your different modular pieces and systems can be, and the less overlapping their expressions can be, not only are they more likely to be coherent, but also the more interesting your potential user experience will be.”

Short is also quick to point out that it’s often more important that you design intelligent systems to link and organize your content than it is to agonize over the content itself.

She emphasizes the “high value in writers creating a higher order of meaning that correlates data according to themes. It's common to carefully prune your molecules, but less common to actually give those molecules alignments, so that they're more or less likely to find each other.”

By way of example, Short talks about creating tools to define a character’s job, drawing on and arranging a matrix of data points in logical ways.

“The systems therein invent new organizations or symbology or founding myths on the fly, in order to inform the occupation. But rather than just rolling dice and smooshing 100 random things together, it would be more interesting for players if you first picked an archetype for the character, according to some logic of your universe -- perhaps according to playing card suits, say, Hearts, Spades, Diamonds, and Clubs," Short says. 

"If a character is a Diamond-type character, you'll still roll dice to smoosh some things together, but your algorithm will also be able to predict more of an interesting, coherent narrative for the character, informed by their Diamond nature (perhaps a storyline to do with wealth, politics, success, or greed). No matter how you curate the corpus you draw from, it will never have the same kind of boutique variety-of-coherency that this higher order of meaning imposes.”

She’s experimented with these types of high order arrangements, but says there’s work left to be done.

“We dipped our toes in this, in the way we implemented Moon Hunters' hero myths,” she explains, “according to archetypes of Cunning or Bravery, but it was more limited and provided fewer surprising combinations than a ‘suit’ based approach would have. A core lesson that literally all procedural designers repeat like a mantra is to iterate, iterate, iterate -- same as the rest of game development, you have to see how it goes, look at the results, and go back to tweak and refine your work. It's a bit pretentious to call your algorithm a co-author, but it's also extremely true, because often your A.I. friend will surprise you with the outputs, in both good and bad ways. It's the joy and the horror of the medium.”

For Ma, the first step in properly employing procedural generation is try to avoid drawing attention to the fact that it’s been randomly generated, which means eliminating things like repeated, identical assets and blending content of different provenance.

“One frequently used way to avoid a 'bland' generation is to mix in hand-made content," he says. "Games have varying ways of doing this - using a handmade map with elements within it randomized (Into the Breach); dividing the map into randomly selected smaller pieces which could contain random elements within (Spelunky); using set-pieces that get worked into a random maps (the temples in Minecraft); or entirely generated maps that have different 'biomes' within, each with their own principles of generation (hallways of a 'prison' intersecting with a lake in Brogue).”

Short, however, makes the case for letting some of your seams show as a way of being transparent with the player, for how letting the user know that they’re interacting with machine generated content can itself be a source of amusement.

“I actually think designers shouldn't worry as much about making their procedural content too sensible or 'seamless', at least such that it would pass for human-made — it's actually desirable for a player to know that they are engaging in a machine-co-authored system, and to enjoy it in that way," she says. "Someday maybe we'll exhaust this and it'll be more interesting for machines to impersonate people for things other than interfering in elections, but for now, there's lots of low-hanging fruit when the player knows they are spinning a kaleidoscope rather than viewing a static image. It can be intrinsically fun to learn a system's patterns and understand how they work together.”

Ma believes that those patterns work best when they’re established by a joint effort between designer and machine.

“We highly restrict how much randomness plays a role in key designs like pacing and difficulty.  In FTL that meant determining the exact number of events that had fights vs events that gave free rewards in each sector (though their locations within the sector were completely random)," he recalls. "With Into the Breach, the exact enemy types that spawn are random but we restrict the numbers of certain enemy types that can spawn at any given time. You can rely on randomness to create variety, but you still have to highly curate what occurs to ensure the game is fun and fair.”

In a similar way, and akin to how Short talks about including high level ordering of random content, Hoque and the Astroneer team are careful to ensure that the procedural content in their game is defined by authored limiters. For instance, when crafting the area around the player’s spawn point, they begin with a subset of terrain, rolling hills and gentle slopes, and only as the player moves further away from that starting point do they introduce more wild and varied elements like cliffs, caves, and mountains.

“The hope is while you are progressing in Astroneer, and resources that you need are on a 100 foot tall plateau on a different planet, you use the experiences with the more gentle early terrain to figure out what to do," says Hoque. "On the technical side we take two general rules of Perlin & Billow noise and blend them using artistic discretion based on play-tests. When the player has explored for a bit and has enough experience to leave the home planet, other planets then use these noise functions in different ways to create more difficult and varied terrain. In this way, we are combining simpler general rules to provide a more tuned experience.”

Naturally, some elements lend themselves better to procedural construction than others. Terrain will always be easier to machine generate than living things.

“With noise, we can generate fairly unique terrain over entire planets, but procedurally generating something like creatures is a whole different process," Hoque continues. "Humans are so familiar with organic creatures that it is a very tough problem to procedurally generate creatures that are modeled, shaded, and animated in convincing ways.”

The procedural toolbox

The upside of the proliferation of procedural content for designers is that there are a number of tools available to create it (and a fair amount of institutional wisdom exists around how to properly employ those tools). That experience is hard won, though.

“Our original terrain authoring tool was very prescriptive and constrained even though it was procedural,” Hoque says. “The terrain was composed of a stack of modifiers that would continue to manipulate and refine the base planet’s sphere shape. The stack of modifiers had baked in notions of where certain terrain features would be expressed. Thus, each novel terrain feature required revisiting the authoring tool to support its reordering within the modifier stack. For instance, the cave tunneling terrain modifier couldn’t be inverted and placed above ground to form bridges without writing a bespoke modifier that did just that.”

"Honestly, any game tool can be used towards procedural content — Unity, GameMaker, whatever. Go nuts. Be brave."

A system based around modifier stacks presented a serious impediment to the kind of creativity Hoque was hoping to engender. When the game first hit Early Access on Steam, the team decided to tear down their planet generating tech and start again from scratch.

“The new terrain system is a flexible shader graph very similar to Unreal Engine’s material shader graphs. However, instead of shading 2D pixels with RGB data, we shade 3D voxels with voxel occupancy and object placement probability data. This approach allows us to sculpt the terrain to the artist’s needs so long as it can be expressed in a functional manner.”

Astroneer’s terrain shader graph editor was constructed inside the Unreal Engine, which Hoque calls a “great framework that allows us to build custom tools for the game."

"The terrain shader graph is JIT compiled to machine code using LLVM to support live editing scenarios. This is similar to the process of a website JIT compiling javascript code on the fly to improve performance," he continues. "When we actually package and ship a build, the terrain shader graph is ‘Ahead of Time Compiled’ for maximum performance. This allows full function inlining and constant propagation. This is essentially the same process that C++ engine code goes through. The 2017 GDC presentation on how Horizon Zero Dawn spawned objects was a huge influence on how our tech works, except we are doing those things in 3D.”

In closing, Short reminds fellow devs that not all the tools for procedural generation are complicated development engines or software suites -- there are lots of options for those looking to dip into the waters of procedural generation.

“When I contributed to G.P. Lackey's Unknown Peoples twitterbot, I used Notepad!" Short says. "Cheap Bots Done Quick (using Tracery) is a fantastic technology, great for dipping your toes into the first steps of smooshing random text together and assembling human-readable grammars. It won't let you do the higher-order meaning stuff I mentioned before, but it's a good way to get started. We used it for Unknown Peoples — and with G.P.'s permission, here's its source code."

"Honestly, any game tool can be used towards procedural content — Unity, GameMaker, whatever," she adds. "Go nuts. Be brave.”


Explore the
Advertise with
Follow us

Game Developer Job Board

Game Developer


Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Advertise with

Game Developer

Engage game professionals and drive sales using an array of Game Developer media solutions to meet your objectives.

Learn More
Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more