what technics and math involved in making randomly generated worlds in video games? like space engine for example?

577 views

what technics and math involved in making randomly generated worlds in video games? like space engine for example?

In: Mathematics

3 Answers

Anonymous 0 Comments

Generally the base of a procedurally generated world is generally something called Perlin noise. It creates something that looks like [this](https://rmarcus.info/blog/assets/perlin/raw_perlin.png) a continuous black and white image where you can have the black bits represent low elevations and white bits high elevations. In space engine I imagine the perlin noise is wrapped around a sphere, or they just use a perlin noise generator that uses spherical coordinates in the first place.

I’m far more familiar with Minecraft world generation I will use that instead but similar ideas should arise in other games, perlin noise is nearly ubiquitous in procedural worldgen. At this point in the Minecraft world generation, you have a stone world filled with valleys mountains and planes. For any z coordinate less than 60 ish, Minecraft replaces any air blocks with water at this point.

As it starts, it’s a stone world. At this point biomes are made by using more perlin noise, the game creates another two perlin noise maps known as temperature and rainfall and based on this chooses the biome for a certain location (dry warm biomes are deserts for instance, etc, even if the game has no real notion of temperature).

Biomes might do some things, such as in Minecraft I’m pretty sure they scale the perlin height map to make it less mountainous, but the main thing they do is replace the top few blocks with something else. Desert biomes will replace the top few stone blocks with sand and sandstone, for instance, other biomes replace with dirt and grass. Flora is also spammed on top, with various decorative flowers being randomly placed on top of this perlin map, trees are probably grown in a similar method to saplings, it selects random blocks, and tries to grow a tree there if it has the space to do so.

Caves are generated by a slight modification to perlin noise known as perlin worms. A 3D version of perlin noise exists but it doesn’t “snake” very well so perlin worms were designed to instead. At this point, ores are generated by randomly randomly replacing certain blocks in a chunk with ore, then replacing more ore with an increased chance around the block.

But yea, it’s all perlin noise and it’s variations, 3d perlin noise, perlin worms, etc.

Perlin noise functions take in a seed from which their look is based off of. If you use the same seed, you get the same perlin map, thus same world.

You are viewing 1 out of 3 answers, click here to view all answers.