Slightly related to a recent post.
I understand procedural generation in video games is basically an instruction set to tell the computer to run through to get the same result every time so that it doesn’t load a whole level each time, it builds the level based on a set of parameters.
How is this different than just loading a built level? Isn’t that what a normal script of code is in any other game? Is an instruction set to tell the computer to load the level?
Is it just the difference between one being done by a programmer and one done by a level designer/artist? They both need assets already designed and made to work right?
In: 30
Procedural sort of implies an algorithm based generation without direct overview.
So the algorithm looks at block 1 and goes “ah 75% chance this block is a pine forest, 15% urban, 10% snow”, rolls the dice and then applies it. And then it does a similar equation for block 2, 3, etc etc.
The exact %s and the relationship between blocks can also interact with each other. A block might be more likely to be pine forest if it neighbors pine forest.
**Regular generation:** The entire level is built by the game developers and is loaded as it was built, down to the smallest detail.
**Procedural generation:** The developers built 0 levels. They instead programmed different stuff into the game, sort of like LEGO blocks. When the level loads, the game puts all the blocks together however it wants, following logic programmed by the developers. This lets the levels be different every single time.
Procedural generation is about being able to create and load a functional level without the developer having to load and test it first. While “seeds” make the results reproducible (if I load a Minecraft world with a given seed, then you load the same seed, you’ll get the same level), the initial level is still effectively random; when I first loaded into the level, it was the first time a human had looked at it.
Making a ‘normal’ level means that the designer places assets, and can apply their human logic to making sure things make sense. Using normal level design tools you can make some really unintuitive or otherwise “bad” levels; it’s the responsibility of the designer to make the level in a way that comes out feels right to the player.
Procedural generation requires effectively codifying that “human touch” into a set of rules that the computer can use. The computer takes a random number (the seed) and from that decides “put a mountain here, and ocean there” etc. and also has to make sure things ‘connect’ properly.
Critically, this ties back to the randomness thing; procedural generation lets you create a huge world without having a human hand shape each region. Look at Minecraft again; people have played on millions of seeds, and each seed has a surface area in the ballpark of the earth. Imagine trying to manually sculpt that many worlds in detail. By creating a procedural generation algorithm, Minecraft can have billions of worlds that essentially build themselves based on a set of rules in the computer, rather than a human spending thousands of hours per map following a similar set of rules in their head.
There are two key differences. The first is variation. Procedural levels can be different each time, but follow the same rules such that the game can still be played (but not the exact same way each time).
The other difference is storage. A procedural world only needs to save the procedure, the seed, and any changes that the player makes. You don’t have to save the exact height of every pixel of land in a procedural world – that information is compressed very efficiently within the seed and procedure. You need to save almost nothing, which allows for truly enormous (and complex) worlds to exist in an inherently limited computer.
Have you played settlers of catan?
In settlers of catan you have 19 hexagonal cards that you shuffle and you follow a rule to draw them and put them to make the board, the result: different boards every game. That’s **procedural generation**.
To get the same result but with **regular generation**, you would have to one board for each permutation of the 19 hexes so 19! boards, that’s more than 121 quadrillion boards! Good luck having enough space in your home
Edit: for the math geeks the actual number of boards woud be 19!/(4! * 4! * 4! *3! *3! * 1!) = a bit over 244 billion boards
A guy named Kevin Perlin invented “Perlin Noise” back in 1983. It actually got an Academy award!
Let’s say you have an 1,000 x 1,000 image. It is easy to program a computer to assign a random color to each pixel. The problem is that doesn’t look very natural it just looks like noise. Perlin noise can fill that image in with something that while random looks like it came from nature. It essentially looks like clouds or smoke in its simplest form.
It can also generate this noise in a spherical shape so imagine a ball covered in clouds. It looks like a planet! Now imagine that instead of using the value of each pixel for color you use it for elevation. Now you have mountains, valleys, etc. Put a water layer in at a specific altitude and now you have oceans.
The most basic Perlin Noise function is also surprisingly small.
>I understand procedural generation in video games is basically an instruction set to tell the computer to run through to get the same result every time so that it doesn’t load a whole level each time, it builds the level based on a set of parameters.
Not always, it can also be a tool to save a lot of developpement time and storage space.
For exemple many open world games use some procedural tools to generate the environments. There’s no point in having an environment artist place each blade of grass and store their position in memory.
It’s much faster to have the artist engineer the landscape by areas defined by procedural generations (here are grass, here are rocky grass, here are grass and bushes, here is a forest, etc.). The artist can then fine tune and hand craft meaningfull areas and let the computer plant the blades of grass.
It also mean that the enduser will only have to store those areas and algorithms to generate those geass fields rather than having the full environment stored in excruciating detail.
Here’s some links to conferences at the GDC about stuff like that :
– [Procedural grass in Ghost of Tsushima](https://youtu.be/Ibe1JBF5i5Y)
– [Procedural placement in Horizon Zero Dawn](https://youtu.be/Ibe1JBF5i5Y)
**Example:** Terrain
**Regular generation:** terrain graphics are built from a terrain map database. Every point of terrain is stored. World accurate, but file-size limited.
**Procedural generation:** an algorithm determines how to generate its own terrain map. Imposed constraints may yield terrain that is similar, but not identical to real-world terrain.
Procedural generation can be used to create seemingly high-resolution terrain from a low-resolution terrain map, sacrificing some accuracy for storage space.
Latest Answers