Behind the scenes of my procedural world generation

The world generator is built upon multiple octaves of perlin noise, which is simply multiple layers of noise stacked together to make a more detailed pattern. By stacking noise textures of different scales, you can make some really interesting patterns.

The generator begins by creating a random path, and then blocks are drawn in along that path. That's why the first step kinda looks like a brush that's drawing the world. The shape of the brush at any point is based off of perlin noise.

In the next step, big strips of terrain are removed, which breaks up the large islands into smaller, more interestingly shaped islands.

The next step has some interesting design behind it. It's important for the player to be able to get from any point in the map to any other point. Since we just removed large strips, and since islands can have some distance between them, the generator has to add smaller islands, which are like stepping stones between the big islands. The generator places the small islands to maximise the amount of the map that the player can reach.

The game then adds detail by making islands droop down a bit and by removing weird hiccups such as lone blocks floating in the air.

A colour palette is then generated, and the game sets the colour of the separate islands. It's kinda like a fill bucket was used to colour parts of the world.

Finally, the game generates a set of points that encapsulate the generated area, and place the swirly black clouds on those points. That way you'll be surrounded by these clouds that establish the boundaries of the world.

Padding 30.png

It might sound simple, but I'm very happy with the way it came together. Those few steps produce a lot of really interesting complexity, I've seen valleys and mountains, cliffs, caves and so many other weird and wonderful features. I mentioned perlin noise earlier, and boy is there a lot of it. There are many noise textures generated, which determine things like the 'brush' size, the density of islands, the shape of the removed slices and so much more. These different textures add a nice amount of complexity, and really increase the variety of worlds that can be generated. It is worth noting that the generator doesn't always make a perfect world first try. If there isn't enough blocks placed, or if all the blocks are placed in a few big landmasses, then the generator will scrap what it's got and try again.

Padding 30.png
Padding 30.png

So yeah, that's roughly how the world in my game is generated. Hopefully this was informative, if you've got any questions, please leave a comment and I'll answer. Also, if you're interested in giving the game a go, you can play it here. It was actually really interesting making the first gif of the post, the slowed down generation revealed so many interesting bugs, which oddly enough, ended up making the environments even more interesting. I also really enjoyed making the world generator, it was awesome when I finally had the generator complete and could tweak all the different values to perfection. Thank you for reading! ✌

Source: ldjam.com archive

Found a bug?
Tell us on Discord