This article was originally published on Eye For Games
The Feature Lens is a column that dissects video games and peeks at their most fundamental components. This series of articles explores features through time, and the practices that can make even the tiniest of games great.
Think of your favorite video game. Now imagine that you could explore it from scratch, discover its secrets and explore its challenges anew. Chances are, playing the game all over again in this manner is not possible. It doesn't have to be that way, though, thanks to procedural generation.
No Man's Sky and 2016 propelled procedural generation into the spotlight. In essence, the method is able to create a massive amount of content on the fly. Most importantly, it reaches this goal with minimal effort, albeit significant initial investment.
Procedural generation is literally a bottomless pit and a Pandora's box of unwieldy proportions. It is the means through which Elite could create an unfathomable number of galaxies even three decades ago. More recently, the technique would power a game world larger than whole countries in The Elder Scrolls II: Daggerfall.
And yet, hiding behind the novelty in which No Man's Sky presented it, the history of procedural generation stretches back decades.
Human nature is quite remarkable at adaptation, and that is where procedural generation gets its roots from. A game is much more than the levels that players see. Behind a virtual world are a myriad of lines of code and often large assets. Today, much of that is taken to be almost a prerequisite for a successful game. Yet forty years ago, compromises had to be made.
Back then, the limitations of the memory resources available straddled developers. This meant that they had to strive to strike a balance between the bare necessities and the content available to players. However, strip the game of its fundamental components and what remains is an unplayable product. Instead, the earliest game developers had to innovate and adapt in order to include both.
The result was the technique widely known as procedural generation. As the name implies, it deals with the creation of content on the fly in a systematic manner. By taking in what could merely be a number, the approach can extrapolate and create just about anything from the assets at hand.
In this way, a piece of code possibly be smaller than an entire level could generate almost unbounded universes. Thus, as early as in the 80's, procedural generation could create thousands of levels in memory space less than a fraction of a floppy disk. This massive potential reached an apex in the 1986 game, Elite.
Still hindered by memory limitations, the space simulator turned to procedural generation to create the galaxies. The result was astounding, generating hundreds of trillions of galaxies at run-time. If that number seems unbelievably large, that is because the number is magnitudes higher than the estimates of real galaxies.
It's precisely for this reason that Acornsoft, Elite's publisher, opted to include only eight galaxies. In this way, Elite sat in the sweet spot between a comfortably-small game world and inconceivable possibilities. As it turned out, the decision would turn out to be a highly influential lesson for game developers.
Ten years later, another procedural generation wonder came to light. In 1996, Bethesda released the second installment of The Elder Scrolls franchise - Daggerfall. In TES II: Daggerfall, players explored the regions of High Rock and Hammerfell. More than anything, the game's primitive graphics hid a technological feat that would take decades to rival.
Daggerfall boasts an area larger than Switzerland and a population larger than Montenegro. These figures ensure that it still boasts one of the biggest open worlds in existence. Yet with such an extensive world came the problems that would characterize procedural generation games to this very day.
In spite of the sizes of High Rock and Hammerfall, the game was limited in terms of assets. This inevitably led to complaints about the game becoming repetitive. Moreover, the traveling time linked with such vast landscapes sapped the enjoyment out of an otherwise successful game.
It is perhaps for this reason that the technique was not replicated in future installments. In later installments, starting from Morrowind, Bethesda reduced the size of game worlds. Instead, it gave preference to hand-made content and NPCs that exhibited diverse personalities.
As the years went by, memory sizes grew bigger - enough to accommodate any number of curated levels. Graphics improved, constraints disappeared, and the whole video game spectrum evolved along with the eras. Yet as the limitation vanished, procedural generation remained ever-present in video games.
Moreover, procedural generation remains unchanged. Instead, it withstood the test of time and persisted with very few modifications. Untouched by technological advancements, the most obvious shift in procedural generation came to its status. Abandoning its label of necessity, it evolved into a feature that enjoys ever-growing prominence.
PROCEDURAL GENERATION IMPLEMENTATIONS
As the name implies, procedural generation is the product of a number, called the seed, rules and assets, although variations exist. These components are unplayable on their own, but they can be thought of ingredients for a recipe. The end result is a completely different, more complex product.
These pieces are thus fed into a function, or a procedure that joins them together to create the new content. There are innumerable ways in which such a function could combine even a nominal number of assets. It is thus easier to comprehend how seemingly-infinite content made it into Elite and Daggerfall.
Although the base formula has remained largely unchanged, developers have attempted to innovate. From artificial intelligence to additions to make the resulting content more wholesome, studios both small and large have tried to alter the way in which they go about creating content programmatically.
Legend of Dungeon, for instance, used dynamic music to make areas more personal. In the rogue-like game, music adapts to the procedurally-generated dungeons, enriching the gameplay.
"There are thousands of combinations, and the music has to layer well, and also sound good on its own, separate from the rest of it's parts."
Alix Stolzer makes up half the team at Robot Loves Kitty, the studio behind Legend of Dungeon. She explained to Eye For Games how this was only made possible through a system of "tracks [that] are broken into many different elements." The result is an accompaniment to the procedural levels of the game.
Surprisingly, most innovation in procedural generation has originated from AAA studios. In particular, AI is still only making its way into procedural generation, and indie studios have not been heralding its arrival.
The appeal of combining AI with procedural generation to tailor content to players is almost natural. The premise of video games that adapt to the player's style is an exciting venture. This technique can most notably downsize the overwhelming set of possible content. Instead, it chooses from among this cesspool the content that makes most sense.
For example, some levels may make more sense than others, or are more adequate to a certain class of players. In this manner, AI could push levels that present an added challenge, or that are an adaptation to the gamer's playing style. The charm is undeniable, as Alix Stolzer conceded, adding that AI in procedural generation could even become standard practice in the future.
"In the future, having an AI generate levels tailored to the player could become standard practice. Is that still procedural generation though?"
Experimentation with the unlikely pairing of AI and procedural generation was fruitful in Valve's Left for Dead. The survival-horror game, published in 2008, came with the novel concept of an AI Director.
The AI Director's job is a simple one - supervise level generation and oversee players. In the context of the game, the levels comprise zombies, and this is where the AI Director toils. Through its exercise in observation, it would restrain procedural generation. Fewer zombies give panicked players respite, whereas the number of enemies spikes at a time of relative ease. The effect is subtle, but elegant, and compels players to come back and play the game over and over again.
Perhaps a defining factor in the slow adoption of AI in procedural generation is the complexity of the latter technique and AI's infancy. In spite of the obstacles, the potential is there to be exploited, and new approaches lie on the horizon.
Although usually associated with levels, procedural generation has appeared in other settings. In Skyrim, for example, Bethesda implemented the Radiant Quest System. The procedure creates an endless stream of quests for players, serving two distinct purposes.
The procedurally-generated quests gave players renewed purpose after completing the main storyline. As a side-effect, it keeps players playing for indefinite time, even if these quests were generic in nature. The new objectives also served the purpose of exploration. Such quests take players on journeys to unexplored locations, encouraging them to discover new locations.
The Borderlands franchise is also well-known for its use of procedural generation. Instead of levels, procedural generation is used to create a record-breaking number of weapons and items. In fact, by combining various weaponry components, Borderlands 2 was able to create in excess of 17 million guns.
THE GOOD, THE BAD, AND THE BITS INBETWEEN
Indie studios have been behind the resurgence of the roguelike genre. This genre often relies on a renewed challenge, with players having to die often and restart the game several times before mastering it.
This sense of challenge calls for new approaches to deliver new content on the fly. In practice, procedural generation has become the chief tool in approaching this ideal, and not only in the roguelike genre.
Apart from the usual contenders, simulations, role-playing games, and even adventure games have used the approach to keep gameplay fresh. This was one reason why Bit Kid, Inc. is incorporating procedural generation into its upcoming metroidvania game - Chasm.
The pairing is not evident, nor the norm, but offers interesting possibilities. James Petruzzi, who is working on Chasm, explained how "after you play a game once you know exactly where to go and what the next room will always contain." Procedural generation is perfectly-suited to overcome this hindrance, and in Chasm it improved "the sense of discovery and exploration."
Having a quasi-infinite amount of content may also mean a respite for small teams with less resources. Indeed, a small procedural generation system can take on the workload of many level designers. From among the multitude of levels, some can be chosen and included in the game, in similar fashion to Elite.
Notwithstanding the many benefits of procedural generation, the difficulties are also numerous, as any developer who has ever implemented it can vouch. James Petruzzi explained to Eye For Games how Bit Kid, Inc. discovered all too well the complications that haunt the technique.
Pacing and difficulty are notoriously difficult to get right by hand. Procedural generation added an extra layer of abstraction that made balance even more unmanageable. In fact, in spite of the method's allure as a means to create countless elements, striking the perfect equilibrium is no mean feat.
"Initially we tried to generate giant sprawling spaghetti-like areas, but we soon realized it was nearly impossible to pace. Eventually we realized we had to break things down into smaller, more manageable inter-connected sections."
James explained how the team behind Chasm ended up "redesigning the generation several times trying to figure out how it could best integrate with the world of Chasm." And this problem does not only affect unlikely pairings, as Federico Casares can attest.
Federico is working on Winds of Trade - a naval strategy game that takes place in the 18th and 19th centuries. In Winds of Trade, the player boards a ship and trades in a procedurally-generated world. Like Robot Loves Kitty, Federico explained how Hermes Interactive saw in the approach a window of opportunity to make their game infinitely replayable.
Hermes Interactive also had to deal with its own balancing issues. In particular, Federico had to ensure that the worlds in Winds of Trade made sense in a bustling world with a multitude of trading hubs.
Reaching this ideal is one of the biggest challenges that studios face when dabbling in procedural generation. Whereas Bit Kid, Inc. had to rewrite the algorithm, Federico had "to start adding constraints everywhere to prevent those things [balancing issues] from happening." In turn, this made "the algorithm susceptible to other issues, like making the patterns easier to spot and degrading performance."
In fact, performance is one aspect that does not immediately come to mind when considering procedural generation. It is, however, a real problem when creating large worlds such as those in Winds of Trade, where a sea of variables have to considered.
The team at Hermes Interactive overcame these obstacles, but they are a testament to the hidden catches that inundate the approach. It is not unusual, for example, for patterns to accompany procedural generation. Ultimately, repetition in content not only gives away the technique, but risk becoming a nuisance to players.
"I wanted players to have a different experience every time they played the game, having to relearn the way the different value chains are set, how the relationships between countries work, which shipyards will repair your ships for the least amount of money, and so on and so forth."
Patterns are by no means a new challenge in game development. Indeed they, have been an issue since the advent of procedural generation. They have influenced the decision to downsize Elder Scrolls' game worlds following Daggerfall, and part of the reason why Elite was only a fraction of its potential size.
Unfortunately, patterns are a by-product of any rule-based system. Federico Casares expressed his belief that patterns are unavoidable, but explained how making them complex can draw attention away from them. For example, a linear process can create islands by combining various approaches. The final result is a game world that combines a string of processes, making it less predictable.
Yet the ingenious mind does not contend with limitations. Patterns could have been a serious issue in Legend of Dungeon, but instead they became a telling sign of the player's progress. By using particular tilesets for different dungeon depths, the areas became recognizable. In turn, this visual cue allows players to focus on progression. Shortly after release, Robot Loves Kitty released an update that added new tilesets. This move not only included new areas, but also eliminated monotony.
Above all, procedural generation is a game of constraints and balance. A myriad of independent games have managed to exploit its benefits, see through its obstacles and overcome them. Yet as No Man's Sky shows, procedural generation is not always a centerpiece, but a bolt in a much larger machine.
Acornsoft saw the inevitable downfall of having an impossibly-large game world. The players' sense of disbelief at Elite's immense universe would have a transparent veil over the mathematics behind the game. That would inevitably bring an impersonal touch between gamer and developer.
This factor was also observed in other games and various fictional universes. The collective game worlds of Morrowind, Oblivion and Skyrim are but a fraction of the size of High Rock and Hammerfell. This did not hinder the successors of Daggerfall. On the contrary, they received critical acclaim for doing away with repetition, and shifting their focus to exquisite, handcrafted worlds.
Other franchises, such as The Witcher and Grand Theft Auto, also take place in worlds created by hand. Indeed, few games have repeated the feat of creating game worlds via procedural generation since Daggerfall. Nonetheless, the critical reception of No Man's Sky ensures that other studios may have their work cut out when using this technique.
"We have a large repository of possible rooms the generator can use, and even if you see the same room in another playthrough it can still be different depending on the enemies, treasure, and traps selected to spawn in it."
Player preference plays a significant role in how game worlds are perceived. Handcrafted game worlds are more opportune for games that require players to play through them once. On the other hand, procedural generation is a major component of games that are replayed frequently.
This may explain why Daggerfall's content led to some disappointment among players. The preference for handcrafted content has proliferated even in sandbox games. Although a core gameplay element is the ability of players to shape the world, studios have introduced constraints.
In Starbound, for instance, Chucklefish Games limited the number of biomes. Instead, hand-crafted items litter the landscapes. Whereas patterns are noticeable, the trade-in proved fruitful, as critical acclaim proves.
It is also for this reason that Bit Kid, Inc. currently limits procedural generation to linking together handcrafted rooms. James Petruzzi explained how creating "the rooms by hand we can keep a high quality feeling." Moreover, the team also knows "where enemies can end up, and ensure the platforming and power-ups you get are used often and appropriately.
From Elite to Daggerfall, and from No Man's Sky to Starbound, the lessons in procedural generation are there for the taking. However, the undeniable allure of infinite possibilities is but a cloak for the many traps that the technique brings with it.
Developers who heed the warning signs of procedural generation can create an engaging product. Conversely, those who ignore them risk robbing the game of the most primordial link between computation and fun experiences - the human touch.
This article was made possible thanks to Federico Casares, James Petruzzi and Alix Stolzer. Federico Casares is part of the team behind Winds of Trade, a game developed by Hermes Interactive that launched on Steam in 2017. James Petruzzi is one of the founders of Bit Kid, Inc., which is currently developing Chasm. Alix Stolzer is half the team at Robot Loves Kitty, which has released different games to critical acclaim. Following Legend of Dungeon, Alix is currently working on Upsilon Circuit.