Procedural Generation As The Future
Something that might appear to simply be just a buzzword is actually making quite the comeback recently. Procedural generation; the mathematical random generation of content based on defined parameters. It's been thrown around quite a bit lately. Why is it making a comeback, and why is it such an important concept for today's video games?
What can procedural generation do for us?
Procedural generation is a novel method for the creation of in-game materials using defined mathematical algorithms instead of having to have to create absolutely everything manually. Using math and far smaller assets, you can create an almost infinite number of variations of a given asset. Unfortunately this development style has been often criticized for being perhaps a cop-out or a lazy method for certain genres and games. But it does have its uses and certainly is likely to become more common in the future.
Procedural generation can become a good part of a workflow. It's possible to base an entire game around the subject of infinite procedural generation (as in No Man's Sky), or to integrate it into the development workflow. You can use middleware, tools or plugins to help create more variety in the final product, but ultimately letting it be a small piece of the process.
A commonly explored use that we're all quite familiar with is with the generation of terrain features. Specifically trees, rocks and other foliage. SpeedTree is a popular middleware program that can randomly create vegetation through the use of procedural generation combined with your own artwork. It has the power to generate thousands of unique high resolution meshes and textures in real-time, and even simulate growth and seasonal changes. Avatar, Star Trek Into Darkness, Birdman and more movies have used procedural generated trees to convince us of their lifelike atmospheres.
In games we can see it being used in The Witcher 3: Wild Hunt, World of Tanks, Battlefield 4, ArmA III and even Batman: Arkham Knight. While you can obviously model every single specific piece of environmental foliage yourself, SpeedTree and procedural generation can make it far easier to have the kind of variety that might be see in real life. And that doesn't mean it's going to lack in quality either.
But... but how?
Each object-type would conceivably need it's own specific programmatic algorithm that uses back-end assets of it's own. That is, buildings are a specific procedural generated thing, whereas trees, waterways, the landscape itself and everything else has to be programmed manually. However the results can be enormous and quite surprising.
With procedural texture generation, the way in which any given asset is distributed relies on one of two overall techniques, either periodic tiling or aperiodic tiling. Periodic tiling is the repeating of elements within a given space, so it isn't natural at all. A Voronoi diagram is sometimes used in this case to provide a collection of set points, or seeds, that indicate where things should be placed. This is common in most games and is why we see the same terrain every time we boot up. A one time Voronoi diagram is generated from the terrain and used to place the vegetation.
I'm no mathematician, and I didn't stay at a Holiday Inn either.
Then there is aperiodic tiling, which uses random mathematical principles to place elements in random yet appropriate places. Two techniques are to use Wang tiling for the distribution of vegetation as well as the use of the Poisson sphere to calculate where things should go.
Landscape generation is generally created in one of three different common ways; fractal landscape modeling, physical erosion simulations or through terrain synthesis from analyzing real images or sample terrain. The results can actually be quite spectacular. Again, seed points can be generated to either maintain a consistent appearance or to make sure certain features are put in.
To give all axes the potential to be random, all functions in the pipeline can be randomized. Procedural heightmap generation, texturing, bump mapping, tessellation, everything has to have it's own specific algorithm. And when they come together, some spectacular results can happen.
Those are just two more common uses for it too, and there are plenty more ways in which to leverage the creation of assets with code rather than through hand-creating absolutely everything. Just imagine the possibilities.
So, then, procedural generation can be very powerful when used as an entire modality or as a means to provide variation within a certain specific framework. It can be used as a one time method to make an area to be further refined to end up as the game map, or it can be implemented in the game itself, infinitely generating new terrain throughout the game.
The first use of procedural generation for entire world creation was with Richard Garriott's Akalabeth from 1980. A predefined mathematical seed was used to generate a world that could be returned to. But that was far too simplistic, right? The original Elite game from David Braben was originally planned to have just as many star systems as Elite: Dangerous has now, using procedural generation to make it all possible. The Elder Scrolls II: Daggerfall's world is mostly procedural generated as well.
The demoscene in Europe has seen the use of this regularly. The demoscene is a subculture that creates stunning audio-visual presentations and games that fit within small amounts of space and use as little resource as possible to provide the most breathtaking experience. Games that are graphically complex and gorgeous, yet tiny in size. .kkrieger is perhaps the most famous example. It's a mere 96k in size but was high in graphical prowess (for the time in 2004). Smaller game size is perhaps one of the more exciting aspects of implementing proper procedural programming.
How then, do we seemingly create entire games with procedural generation?
Distinctness is valued in video games. It's not fun to go through the same cavern multiple times or to talk to NPC's that look exactly the same. More than that, we seem to be fascinated with the level of uniqueness that some games provide. Being able to explore the entire mathematical representation of the Milky Way is a very substantial achievement.
More recently is a game known as Evochron Mercenary, a space simulator by StarWraith 3D Games. This is perhaps one of the best examples of the dynamic and positive nature of procedural generation. The file size is curiously low, but the universe within is exceptionally large. Planet terrain, city layouts on those planets, and even the planets and other space phenomenon are created with code, rather than static content. Shawn from StarWraith 3D gives an example of how cities themselves are generated with a seed value that represents it's location within the universe, so that certain building types are used to represent a unique area. The custom engine running underneath combined with this helps to create a game that has a near infinite number of unique areas to visit. Or crash into the planet if you're like me and cant fly so well.
And of course we can't forget No Man's Sky either. A marvel of technology. Nearly everything within is going to be of the procedural generated variety, from the solar systems themselves to the planets and all of the various life-forms on them. That and cities will also be generated with the same technique as is done with Evochron Mercenary. While this isn't the first use of this technology, it is perhaps the most sophisticated showing of what procedural generation can do. They start with very basic elements and thus allow everything to be generated from those elements, much like in real life. The problem with this type or large scale generation is in the refined control.
The problem is that sometimes the results aren't exactly always as desired in complex environments. Simple level design for simplistic mobile games or isometric RPG's might be easily possible, though making an entire world including cities and citizens. That is quite the lofty goal. But it's one that
The goal now is to be able to combine the procedural generation that allows for the easy manual manipulation of the thus generated materials so that they can be refined to fit in perfectly within the game they represent. Even better would be an AI capable of doing a lot of that for you.
Even though procedural generation is a work of seeming mathematical magic, it isn't without it's computational limitations. Mostly that to create such wonderful achievements it can be initially quite computationally intensive. It might take awhile to load games that use procedural generation quickly, especially if it makes such heavy use of it. I was very surprised when Hello Games wanted to make use of the PS4 as it's platform of choice.
Regardless, it's a great approach that isn't just a buzz-word that's floating around due to the popularity of what was a PS4 exclusive. It was originally a way to keep memory footprint down without decreasing the amount of different stuff found inside. But it's evolved to help us create these vast works of art, and could even become a staple of design in the future.