Here's how tool known as "procedural generation" is creating infinite worlds and multi-million-selling hits
The new release No Man's Sky, created by the small team at U.K. indie studio Hello Games, presents players with a mind-bogglingly vast galaxy to explore. There are 18 quintillion planets in the game, a figure that's almost impossible to wrap your head around. (Try this: A quintillion is a billion billion, or a one with 18 zeroes after it. Nope, doesn't really help much, does it?)
Each planet in the game is unique. Most are too close or too far from their suns to support life, but those that exist in the sweet spot will have their own unique biomes with weather systems and landscapes – craggy mountains, lush forests, arid deserts, and churning oceans. There will also be creatures of every shape and size, and you'll never find the exact same species anywhere else in the cosmos.
Gamers have calculated that it would take a player billions of years to explore all of No Man's Sky. And it would not have been possible for the tiny team of 13 developers at Hello Games to painstakingly handcraft this virtual universe, even if they worked on the game from now until the heat death of the actual universe. They were only able to create all of those planets with the help of something called "procedural generation." It's a tool that's fast changing how games are made. "It's a bit like leaving your game uncompleted, and teaching the software to finish designing itself while someone is playing," says Mike Cook, a researcher at Falmouth University who focuses on the potential of procedural generation.
Procedural generation is essentially a way for game developers to introduce carefully controlled elements of randomness into their work – an inexhaustible variety of levels in Spelunky, an endless array of bizarre weapons in Borderlands, hordes of zombies appearing out of nowhere in Left4Dead. Instead of molding and shaping each tiny nuance manually, the game makers program certain parameters into an algorithm that can generate the content itself.
This is a sea change from how games are typically made. Take the levels in the classic Super Mario Bros. They're built out of a handful of recurring elements – blocks, pipes, powerups, turtle shells – which a team at Nintendo employed to create a painstakingly laid out series of obstacle courses. Hardcore fans can memorize every nook and cranny of the gameworld, because it's always the same.
Meanwhile, a game like Minecraft uses a similarly constrained set of building blocks, but it creates a randomly generated expanse of rivers, waterfalls, forests and caves that's different every time you play. That's a big reason why this game with chunky lo-res graphics has earned the undying devotion of so many children, as well as a $2.5 billion purchase price from Microsoft. "Being able to do that infinitely, forever, and never run out of new things to see – that's a huge deal," says Cook.
Procedural generation in games is not new. The 1980 fantasy computer game Rogue used randomness to keep things fresh, presenting players with a different layout of dungeons, monsters and treasure every time they played. (It was so influential that it spawned a whole genre known as "Rouguelikes.") The technique has long been employed to create randomized maps in venerable franchises like XCOM, Diablo, and Civilization.
This method of content creation has proven to be a godsend for indie developers, allowing tiny teams to create game worlds with the freshness of those in blockbuster franchises like Fallout or Grand Theft Auto. "Procedural generation gives a small team that’s wanting to punch above its weight a big advantage," says Guillaume Provost, lead designer of the recent release We Happy Few. "It gave us the ability to create large worlds."
But No Man's Sky isn't presenting each player with a unique galaxy every time they fire it up. It's using procedural generation to create the same sprawling galaxy with the same contents for every player to encounter, even though it's so large that someone could play for the rest of their lives without stumbling upon a planet that another player has already explored. "In No Man's Sky, everyone's universe is built from the same seed," says Cook. Specific numbers, or "seed values" are run through a series of algorithms – what Hello Games' art director, Grant Duncan, calls “boxes of math" – to create a unique result. The blueprints of the entire universe have already been created using this technique, but the game only builds out a player's immediate surroundings so as not to make your CPU melt down. Whenever you arrive on a planet, the game runs the preset seed values for that planet through the algorithm, thus summoning up that planet's singular terrain, weather, flora, and fauna.
Using procedural generation isn't simply about offloading the creative process onto an algorithm – the real challenge is that it requires developers to teach an algorithm the difference between good and bad game design.
The true craft of making a game like No Man's Sky was creating a system from which a variety of interesting results can emerge, but with no boring or obtuse results. For instance, Hello Games built a base template for sea creatures that could be seeded to produce an endless variety of results: a sleek shark-like species, or a whale-sized leviathan, or a bizarre aquatic nightmare straight out of an H.P. Lovecraft story. Everything from the size to the coloration to the presence of scales will be unique – even if you lived long enough to visit every habitable planet in the game, you would never see the exact same species of aquatic life twice.
This means that the staggering achievement of the 13 people at Hello Games is not so much the vastness of their virtual galaxy, but the suppleness of the systems they created to generate and populate that galaxy. It also allows them to make sweeping changes on the fly. A couple of days before the game's release, the developers announced that purchasers can download an update that will completely overhaul the game experience. Planets are moved around, some star systems are an order of magnitude larger, biomes and atmospheric systems are tweaked, and diversity of animal life is boosted. "We changed the rules of the universe generation algorithm," writes co-founder Sean Murray in a note on the update.
"These generators are works of art in their own right," says Cook. "Every game has different requirements, and its own special little problems to solve. Every generator is unique in some way, which is what makes it so challenging and exciting."
And as staggering as No Man's Sky may seem, Cook is convinced that it's only a hint of what we'll soon see. "We are at an interesting stage for procedural generation," he says. "People are trying new things." He runs the annual ProcJam, where developers create games that use the technique for things that go far beyond randomized levels. He cites The Inquisitor, a murder mystery that switches the motivations of suspects with each play through and generates different clues and evidence accordingly. And then there's Ultima Ratio Regem, which creates detailed religions and cultures that have their own distinctive styles of painting, sculpture, and architecture. Cook himself has created a piece of software that generates entire games from whole cloth, complete with their own objectives and rulesets.
The true potential of procedural generation will eventually be fulfilled by the children who are marinating in it every time they boot up Minecraft, and scrounge around online for the most interesting seeds that will generate fantastical environments within the game. "Kids who are eight years old now are growing up in a world where procedural generation is just a fact of life and a part of culture, just like 3D animation was for Nineties kids," Cook says. "They will be the first generation who really see it as an art form."