First Steps into Procedural Generation

Last updated: 16 January 2024

Posted on: 03 January 2024

Introduction

After straying away from Minecraft for so long I decided that I wanted to try my hand at procedural generation. That's when I came across a tutorial series from The Man, the Myth, the Legend Sebastian Lague. It was for generating procedural landmasses, so I decided to follow along.

P.S. Here's the link to the series if you want to follow it yourself.

The Terrain

So sadly I don't have any "in progress" photos. So you'll have to take my word for it, or follow the series yourself, The terrain was generated using planes. These planes were then modulated using Perlin noise to create an infinite terrain. Image of the terrain The terrain would generate as you would walk around the map. It would also despawn if you got too far away. You can tell that these are planes as I clearly hadn't figured out how to plug the holes in between the planes. The textures were generated based on the height map. the sand and grass were dependent on the height, and the stone on the steepness of the rock. The grass and trees were placed randomly along the terrain, however would not be placed below the water line. Below the water line

This was also the first time I was thinking about performance. So I dived into learning about LODs and how they worked. LODs or level of detail is a term used to describe how different levels of detail are used depending on how far away the player is from the model. Though I had clearly figured out how to make LODs, I clearly hadn't figured out how to make them seamless, as all the tree models turned into green clouds. Tree models at different LODs

As far as I can remember the clouds and inventory system were free assets I'd discovered at the time. Though I was happy with how they looked.

The Water

The water was the standard Unity water. However, I added a time-of-day system to a later demo to show off how I could make the water transition between different materials. Here are some example images. The day example material: Day Example Material The night example material: Night Example Material If you want to play around with it a little, here's the link to the day/night example. Weirdly the sun doesn't change anymore in position, so I wonder if that's a Unity bug or something else.

Conclusion

I believe that for a first dive into procedural generation, this was a really successful one. I have to once again shout out Sebastian for his amazing tutorial series which taught the subject so well. This ignited my love for procedural generation and spurred me onto making the many Minecraft clones I've made to this day. Maybe I'll make a post about one of them at some point.

If you want to take a wander around some procedural-generated terrain, here's the link, otherwise thanks for reading!