This article is part of a collaboration with iQ by Intel.
The amount of discoverable planets in the game No Man’s Sky is a ridiculous number: 18,446,744,073,709,551,616 is the official count. Strewn across a computer model of the cosmos, these stars vary in size, atmosphere, and climate. They are often populated by dinosaurs, which evolve and change shape from one planet to the next. You could spend the rest of your game-playing career exploring a single one of these destinations and not discover every nook to the full extent.
Hello Games, the game’s British development house, is more or less attempting to recreate the dream of every 10-year-old: a game world so vast and ponderous that it is virtually endless. The obvious question is how a small team with a mid-sized budget can possibly replicate a universe that may be as big as the real thing. Given the enormity of the task, populating 18 quintillion distinct worlds seems impossible, even if you recruited the help of every game designer on Earth. The answer is a fascinating series of algorithms, which work together to create a large percentage of the game space.
No Man’s Sky and its pulp science-fiction galaxies depend on what is known in the game industry as procedural generation, a procedure that uses randomness and equations to generate art and assets for a game. A primitive version of the process was conceived when Ken Perlin, now a professor at NYU, was commissioned to create a graphic filter for Tron in 1983. It was a quick fix to automatically add texture to virgin computer graphics, and it worked. Thirty years later, a similar technique was used to randomly assemble the infinitely blocky worlds of Minecraft. No Man’s Sky implements a “blueprint system” in the same vein.
“Our engineers told me you essentially take random elements and funnel them into a box of ‘maths,’” the game’s art director Grant Duncan said at the Game Developers Conference 2015. The results are sunsets of different hues, a large variety of indigenous plants, and various species of animals that are as diverse as breeds of dogs. Duncan’s “box of maths” contains a very complex set of rules that clump together chunks of information in random ways. But, importantly, it’s not completely random. It turns out that we still like to see some order in our procedural generation.
Daniel Cook, who has tried his hand at procedural generation in games like Triple Town and Road Not Taken, explained that the technique is actually fairly simple, comparing it to paper dress up dolls. “There’s usually a blank body. And then you have a set of shirts, bottoms, and hats that you can apply. By mixing and matching various clothing pieces, you end up with a unique look,” he said. “Much of what we call procedural generation is very similar. Instead of shirt and hats, we are mixing together game level rooms and enemies. But instead of a blank paper body, we are hanging those pieces together by a set of rules.”
When this is repeated over fourteen hundred lines, the approximate size of No Man’s Sky’s source code, the environments become both sophisticated and serendipitous. “In the best systems, players are regularly delighted by unexpected and never-before-seen situations,” Cook said. In No Man’s Sky, this is not only true for the players but for the designers as well. In a recent New Yorker feature on the game, Duncan revealed how he constantly gets distracted from working on it because he is exploring parts of the world he has never seen. To aid his cause in painting the galaxy, he has enlisted in-game drones to photograph far-flung planets, since there’s no way he can inspect each one by hand.
It is a foregone conclusion that there are pockets of space and huge chasms that no one will ever see. Yet they will be out there, touched only by math and the rules of design. At the beginning of the game, when the universe is “seeded,” an equation churns out some random numbers. These define the overall shape of the universe. Then, the universe generates more random numbers, which become the stars. The stars pick a number out of a hat, which determines the number of planets that orbit each one. The procedural generation goes on and on in this manner, unfurling all the way down to blades of grass and numbers of leaves on trees, which are just waiting to be stumbled upon.