Procedural Content in Extrasolar
When talking about games, the term procedural content gets tossed around quite a bit. It’s common to equate procedural content with randomness, but in reality, some procedural techniques don’t use randomness at all. Procedural content simply means that an algorithm does at least some of the work, rather than having all of the content entirely specified in advance by artists and level designers.
We can classify different procedural techniques based on how they use randomness. On one extreme, randomness is often used heavily in roguelike games, where the game level is different every time you play.
Extrasolar falls in the middle of the randomness spectrum. We use randomness to generate realistic terrain and tens of thousands of unique plant species, but the randomness is carefully controlled in such a way that the terrain and species will always look the same every time you visit them.
On the other end of the spectrum is procedural content with no randomness at all. Left4Dead provides a good example of this. Behind the scenes, algorithms adjust the difficulty of the game based on how well you’re performing so far. Different players may have slightly different experiences, but it’s tightly controlled and not dictated by random number generation.
Procedural level design
In most cases, procedural content refers to a way in which randomized code is used to construct game worlds, allowing players to always see something new. For instance, there’s a great blog post that explains how Spelunky randomly generates interesting new levels.
Many of the games with infinite randomly generated levels fall into the category of roguelikes, named after the 1980 game Rogue. Some noteworthy games in this group include Dwarf Fortress, Dungeons of Dredmor, and FTL: Faster Than Light.
The nice thing about games with procedurally generated levels is that they always offer something new to the player. The challenge, however, is that randomness at this granularity can make it difficult to tell a coherent story. Letting every player have a different experience can be fun, but what if you want all of your players to share a more finely tuned experience?
For Extrasolar, we wanted to have a carefully crafted story that every player experiences in a similar way. The players can make meaningful choices and the content will respond accordingly, but the highlights of the story will be the same for everyone.
This story is set on the stage of another planet and requires extreme visual fidelity to seem believable. For this, we employ procedural techniques in several areas.
To tell the story that we wanted to tell, we designed a carefully shaped island -- with peaks that provide sweeping vistas, high ridges to block the view, dunes that can only be traversed with particular rovers, and out of the way peninsulas that accommodate optional missions for our most dedicated explorers. Thankfully, there are some great tools out there to simplify this task.
We chose to use GeoControl 2, which recently rebranded as Cloddy WorldCreator. This tool lets us paint the desired geography of our island in broad strokes -- a peak over here, a valley over there -- and then uses realistic erosion simulation to achieve a natural appearance.
To make the result even more detailed, we wrote our own procedural algorithms to modify the terrain, adding overhanging cliffs and huge stone dikes that rise from the dunes. The process that adds these geologic features takes more than 24 hours to run, making trillions of calls to a random number generator. If we get a result that we don’t like, we tweak some of the inputs to the algorithm and run the code again. Thankfully, once we have a result that we’re happy with, we can save the output and every player can then explore the same beautiful island.
Well, they’re not actually plants. If you’ve been playing Extrasolar season 1, then you’ve read our biologist’s explanation that since these species have no genetic relation to the kingdoms on Earth, we should really call them something different -- like photobionts. Anyway, that’s beside the point.
What’s important is that in Extrasolar, we expect that our players will be paying very close attention to the individual species within the game. Players would notice if we used thousands of copies that all look identical, so we wanted to showcase a huge variety of appearances -- a perfect job for procedural content!
For this task, we wrote our own procedural modeling system, which our lead artist Brendan Mauro discussed in one of our early development blogs.
Since we generate thousands of unique, high-polygon plant models, it would require hundreds of gigabytes to store all that data explicitly on disk. This is where we get another advantage from procedural modeling. A species may be large to store, but it can be dynamically generated in less than a millisecond. Rather than save the exact position of each of the thousands of polygons that make up a single species, we just save one random number. The system then reconstructs the species by passing the number as a “seed” through a number of instructions that define how the plant should look. So in Extrasolar, when we’re rendering your photograph in the cloud, we look to see if a particular species is visible, and if so, we generate its geometry on the fly, and then throw away the data. Voila -- thousands of unique species without blowing up our memory footprint!
Procedural techniques are also used in building the species populations. For each species type, we hand-paint areas where that species lives. We then use that as an input to a procedural algorithm that plants the seeds based on our desired distributions. This lets us create realistic biomes and also introduce new species to players at a measured pace, while saving us the trouble of hand-picking the locations of all 32,000 plants.
Some of the algorithms we use are similar to the methods used in No Man’s Sky. GameSpot recently posted a video interview with the lead developer to explain their process.
Other procedural details
The beautiful clouds that you see in Extrasolar also use a procedural system. The clouds are constantly changing and are never the same, so unlike the terrain, clouds are computed when your photo is taken. For anyone who’s interested in the nitty-gritty details, we compute a multi-octave noise function in the GPU and ray-trace the clouds with a screenspace shader. Whoo, that’s a mouthful.
For season 2, you’ll be transitioning from Artocos, an arid desert island, to a more heavily forested area on the slopes of a dormant volcano. The procedural techniques that we used for season 1 will become even more critical in building realistic environments. Stay tuned for more progress!