Gamesโ—โ—โ—โ—โ—Difficulty 4 of 5

How can a game fit billions of worlds into a few numbers?

Two programmers fit a galaxy of planets, prices and names into a game without storing any of them. A single number did the work, and a flaw could trap players.

โ–ถ Start the story

Procedural generation means making a game's content with an algorithm instead of by hand, usually by combining human-made pieces with rules and computer-generated randomness. The trick that makes it work is the seed. A map seed is a relatively short number or string used to procedurally create the game world. The same seed always gives the same world, so the world does not need to be stored: it is regenerated whenever you need it. You can even reset it or share it with another player just by sharing the seed.

The idea is older than video games. Advanced Dungeons & Dragons let a dungeon master build dungeons and terrain with random die rolls. Early computer games such as Beneath Apple Manor (1978) and Rogue (1980) did it on screen, producing dungeons randomly, and the genre was named roguelikes after Rogue.

The classic example is Elite. A single seed number is run through a fixed algorithm and produces a sequence of numbers that determine each planet's composition, including prices and even a name and description. This means no extra memory is needed to store planets, yet each is unique and fixed. Elite was originally planned to contain about 282 trillion galaxies, but the publisher feared that such a gigantic universe would cause disbelief, and eight were chosen.

From one number to a planet
  1. Step 1: A seed

    One short number

  2. Step 2: A fixed algorithm

    Run the appropriate number of times

  3. Step 3: A sequence of numbers

    Fixes position, prices, name and details

  4. Step 4: A planet

    Unique and fixed, with no extra memory

Today No Man's Sky features a universe of 18 quintillion planets, and Minecraft's 64-bit seeds allow 18 quintillion maps. The catch is that quantity is not variety. Writer Kate Compton called the risk procedural oatmeal: thousands of worlds that are mathematically different but feel the same.

18 quintillion

planets in No Man's Sky, and also possible Minecraft maps

Quiz me

0/3

  1. 1.Why does a game with procedural generation need very little storage for its world?
  2. 2.What did the publisher of Elite fear about the planned universe of trillions of galaxies?
  3. 3.What does 'procedural oatmeal' mean?

Recap

A procedural world is a recipe plus a seed, and the hard part is making the results feel different, not just be different.

๐Ÿ’ก A trick to remember it ยท Think of a seed as a recipe card number: the same number and the same recipe bake the same world, but a new recipe changes the bake.

Surprising fact ยท A seed only works with the version of the algorithm that made it, so changing the recipe changes the world.

Sources (2)

No source, no claim. Every fact in this lesson (16 claims) cites at least one of these.

  1. [1]Procedural generation ยท Wikipedia
  2. [2]Elite (video game) ยท Wikipedia
More lessons in ๐ŸŽฒ Games (3) See all games lessons โ†’

One more light on your map.

Get one lesson like this every day, about the things you love. Free, in two or five minutes.

Get the share card for this lesson โ†—