1 of 83

Procedural Generation

Lauri Kongas

2 of 83

What is procedural generation?

3 of 83

Procedural Generation

It is the algorithmic creation of data

4 of 83

Procedural Generation

It is the algorithmic creation of data

Almost anything can be created procedurally

5 of 83

Procedural generation vs manual creation

Depends on the objectives

6 of 83

Procedural generation vs manual creation

Depends on the objectives

When used in the right circumstances it can save

  • Memory

7 of 83

Procedural generation vs manual creation

Depends on the objectives

When used in the right circumstances it can save

  • Memory
  • Disk space

8 of 83

Procedural generation vs manual creation

Depends on the objectives

When used in the right circumstances it can save

  • Memory
  • Disk space
  • Design and development cost

9 of 83

Apparent randomness is a key ingredient in procedural generation

10 of 83

Noise

What is noise?

11 of 83

Noise

What is noise?

Pseudorandom vs truly random

12 of 83

The issue with white noise

Nature is smooth

13 of 83

The issue with white noise

Nature is smooth

Two points close to each other on the surface of an object will usually look similar. Points on the surface far from each other may look different.

14 of 83

The issue with white noise

Nature is smooth

Two points close to each other on the surface of an object will usually look similar. Points on the surface far from each other may look different.

What we want is gradual local changes, but large global changes

15 of 83

The issue with white noise

Nature is smooth

Two points close to each other on the surface of an object will usually look similar. Points on the surface far from each other may look different.

What we want is gradual local changes, but large global changes

That’s not how random number generators usually work

16 of 83

The issue with white noise

17 of 83

This is better

18 of 83

Value Noise

A simple type of noise which can be useful for a variety of applications, e.g. creating textures

19 of 83

Value noise 2D example

  • Generate random values in one dimension

20 of 83

Value noise 2D example

2. Generate random values in the other dimension as well

21 of 83

Value noise 2D example

3. Define a grid to use for interpolation

22 of 83

Value noise 2D example

4. Zoom in and interpolate (smoothstep function can give nice results)

23 of 83

Value noise 2D example

5. Stack multiple layers on top of each other with varying zoom levels and weights

24 of 83

Use case study: Generating the Milky Way galaxy in Elite Dangerous

25 of 83

History of Elite

4 Elite games have been released over the years

26 of 83

History of Elite

4 Elite games have been released over the years

Pretty old for a video game franchise - first game released in 1984

27 of 83

History of Elite

4 Elite games have been released over the years

Pretty old for a video game franchise - first game released in 1984

The games are set in space, the player will engage in combat, exploration, trading, etc

28 of 83

History of Elite

4 Elite games have been released over the years

Pretty old for a video game franchise - first game released in 1984

The games are set in space, the player will engage in combat, exploration, trading, etc

Both the older and the newer games feature a significant amount of procedural generation, especially in terms of game world generation

29 of 83

Elite (1984)

Wireframe graphics with hidden line removal

30 of 83

Elite (1984)

Wireframe graphics with hidden line removal

8 procedurally generated galaxies (developers

wanted to go for 248 galaxies, but publisher refused)

31 of 83

Elite (1984)

Wireframe graphics with hidden line removal

8 procedurally generated galaxies (developers

wanted to go for 248 galaxies, but publisher refused)

256 star systems per galaxy

32 of 83

Elite (1984)

Wireframe graphics with hidden line removal

8 procedurally generated galaxies (developers

wanted to go for 248 galaxies, but publisher refused)

256 star systems per galaxy

One planet and space station per system

33 of 83

Elite (1984)

Wireframe graphics with hidden line removal

8 procedurally generated galaxies (developers

wanted to go for 248 galaxies, but publisher refused)

256 star systems per galaxy

One planet and space station per system

Some issues with procedural star system and planet generation

34 of 83

Frontier: Elite II (1993)

Procedurally generated and varied star systems

Newtonian physics

35 of 83

Frontier: Elite II (1993)

Procedurally generated and varied star systems

Newtonian physics

Seamless landing on planets

36 of 83

Frontier: First Encounters (1995)

Procedural texturing (snow, plants, planet surfaces, etc.)

37 of 83

Frontier: First Encounters (1995)

Procedural texturing (snow, plants, planet surfaces, etc.)

Gouraud shading

38 of 83

Elite: Dangerous (2014)

Released 30 years after the original

39 of 83

Elite: Dangerous (2014)

Set in the 34th century when humanity has colonized other star systems in the galaxy

40 of 83

Setting of Elite: Dangerous

The entire 1:1 scale Milky Way galaxy

41 of 83

Setting of Elite: Dangerous

The entire 1:1 scale Milky Way galaxy

400 billion star systems spread across different structures in the galaxy

42 of 83

Setting of Elite: Dangerous

The entire 1:1 scale Milky Way galaxy

400 billion star systems spread across different structures in the galaxy

Nebulae, dust, all kinds of other objects

43 of 83

Mass distribution in the galaxy

Astronomers have constructed a top-down view of the galaxy’s luminosity

44 of 83

Mass distribution in the galaxy

Astronomers have constructed a top-down view of the galaxy’s luminosity

Mass distribution is based on luminosity distribution

45 of 83

Mass distribution in the galaxy

Astronomers have constructed a top-down (2D) view of the galaxy’s luminosity

Mass distribution is derived from luminosity distribution

That distribution is given a third dimension

46 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

47 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

8 layers of these cubes - linear dimensions from 10ly to 1280ly

48 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

8 layers of these cubes - linear dimensions from 10ly to 1280ly

Child sectors inherit information from parent sectors

49 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

8 layers of these cubes - linear dimensions from 10ly to 1280ly

Child sectors inherit information from parent sectors

Bigger sectors are used to generate more rare systems (e.g primary neutron star)

50 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

8 layers of these cubes - linear dimensions from 10ly to 1280ly

Child sectors inherit information from parent sectors

Bigger sectors are used to generate more rare systems (e.g primary neutron star)

Smaller are used to generate more common systems (e.g. primary red dwarf)

51 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

8 layers of these cubes - linear dimensions from 10ly to 1280ly

Child sectors inherit information from parent sectors

Bigger sectors are used to generate more rare systems (e.g primary neutron star)

Smaller are used to generate more common systems (e.g. primary red dwarf)

Generation happens until sector has run out of allocated mass or number space

52 of 83

Sectors

Galaxy is divided into sectors (cubes) based on octrees (8 children per parent)

8 layers of these cubes - linear dimensions from 10ly to 1280ly

Child sectors inherit information from parent sectors

Bigger sectors are used to generate more rare systems (e.g primary neutron star)

Smaller are used to generate more common systems (e.g. primary red dwarf)

Generation happens until sector has run out of allocated mass or number space

Sectors have attributes like mass, metallicity, type and age

53 of 83

Generating the primary star of a system

Lots of different attributes - e.g. metallicity, magnitude, position in the sector, radius, initial and final mass, existence of a planetary nebula, surface temperature, classification

54 of 83

Star color

Black body radiation

55 of 83

Evolution of a star

Different stages of a star’s life are simulated - proto-star, main sequence, giant, death (stellar remnants)

Star evolution depends on the initial mass of the star

56 of 83

Star system generation

57 of 83

Creating the rest of the star system

Generate the main bodies (stars) by simulating collapse of gas

58 of 83

Creating the rest of the star system

Generate the main bodies (stars) by simulating collapse of gas

Generate a protoplanetary disk from the remaining mass (elemental distribution)

59 of 83

Creating the rest of the star system

Generate the main bodies (stars) by simulating collapse of gas

Generate a protoplanetary disk from the remaining mass (elemental distribution)

Simulate clumping in stable orbits around the star

60 of 83

Creating the rest of the star system

Generate the main bodies (stars) by simulating collapse of gas

Generate a protoplanetary disk from the remaining mass (elemental distribution)

Simulate clumping in stable orbits around the star

Step through time

61 of 83

Stepping through time

A lot of physics simulation going on:

  • Gravitational clumping

62 of 83

Stepping through time

A lot of physics simulation going on:

  • Gravitational clumping
  • Gravitational heating

63 of 83

Stepping through time

A lot of physics simulation going on:

  • Gravitational clumping
  • Gravitational heating
  • Moon / ring formation around clumps of mass

64 of 83

Stepping through time

A lot of physics simulation going on:

  • Gravitational clumping
  • Gravitational heating
  • Moon / ring formation around clumps of mass
  • Mass erosion from radiation pressure

65 of 83

Stepping through time

A lot of physics simulation going on:

  • Gravitational clumping
  • Gravitational heating
  • Moon / ring formation around clumps of mass
  • Mass erosion from radiation pressure
  • Special events

66 of 83

Stepping through time

Identifying the resulting clumps of mass:

  • Gas giant vs brown dwarf vs star

67 of 83

Stepping through time

Identifying the resulting clumps of mass:

  • Gas giant vs brown dwarf vs star
  • Chemical composition - icy, rocky, metallic planets

68 of 83

Stepping through time

Identifying the resulting clumps of mass:

  • Gas giant vs brown dwarf vs star
  • Chemical composition - icy, rocky, metallic planets
  • Tidal heating, tidal locking

69 of 83

Stepping through time

Identifying the resulting clumps of mass:

  • Gas giant vs brown dwarf vs star
  • Chemical composition - icy, rocky, metallic planets
  • Tidal heating, tidal locking
  • Tectonics, volcanism, atmosphere

70 of 83

Unique ID of an astronomical object

71 of 83

Nebulae

Based on 3D volume textures for density

72 of 83

Nebulae

Based on 3D volume textures for density

1D RGB texture to define density to light absorption relationship

73 of 83

Nebulae

Based on 3D volume textures for density

1D RGB texture to define density to light absorption relationship

Step through while subtracting colors

74 of 83

Planet surfaces

Non-landable planets - perfect spheres with normal-mapped surfaces

75 of 83

Planet surfaces

Landable planets - start out as cubes, subdivision is used to enhance resolution the closer the player gets, terrain is based on layered noise

76 of 83

Planet surfaces

77 of 83

Combining procedurally generated with real

The galaxy in Elite: Dangerous also contains thousands of real stars, nebulae and other objects from stellar catalogs

78 of 83

Galaxy map

When moving around in the in-game galaxy map, star system information is generated and displayed on the fly around the focused area

79 of 83

Galaxy map

When moving around in the in-game galaxy map, star system information is generated and displayed on the fly around the focused area

The radius of generation in the galaxy map is dependent on the star density of the focused area

80 of 83

81 of 83

82 of 83

83 of 83

Thank you!