Creating a procedural world: Version 0.4.


While  mining through the ground collecting randomly placed resources was kind of fun, it was very basic. Every meter you went down there was more of the same until you reached a different layer of blocks.

Very predictable, and not very natural either. A planet's soil is not a neatly layered like an onion, so what can we do about this? The answer is: Perlin Noise.

So what exactly is this noise? 'Perlin noise is a procedural texture primitive, a type of gradient noise used by visual effects artists to increase the appearance of realism in computer graphics' (Wikipedia). Realism is what we need, but what are some examples of this 'noise'? I'm sure you ever played Minecraft, Terraria, Starbound or any other game that has procedurally generated worlds. All of these games use some kind of noise generation, and we're going to use it as well!

So where to start? Luckily the internet has plenty of useful tutorials about how to use Perlin Noise in Unity3d and very quickly I got a procedurally generated texture on a plane.


Although it certainly looks random, everything look similar as well at the same time. This would be much better for creating something like a texture with in a 3d world, but not our 2d world.

After some tweaking I got betters results and I also changed the texture to use green and red colors. Why colors you may ask? Well traditionally, creating heightmaps or procederal textures results in data represented in colors. This data is used to assign specific textures to specific colors. So currently we got this:


Already shaped like the world we currently have, it gives an impression of how it will look like. Both colors would be a different block of dirt and sand grouped into random patches that look natural.

Now how would we translate this data? I quickly figured that the colors were not necessary as we are not creating a texture, so we need the raw data. This data consists of an array with arrays as values, like a table with rows and columns. Each column has a float value between 0.0 and 1.0.

By deciding for which value which block should be created we need to determine a threshold value. Let's say that any value higher than 0.5 would result in block type 2, and anything lower block type 1. Now let's see what that gives us:


Now we have our procedural world! The only problem is that it still does not look natural enough but instead a bunch of blocks, which of course is true. How can we solve this? In nature, different materials blend together smoothly , so let's try to emulate this by adding gradients to our blocks.


Much better! But there's something missing obviously, which are the resources. Originally they were added randomly, but lets make some Perlin Noise for generating nodes of resources as well.


And there we go! A procedural world with different block types blending with eachother and resource nodes.

Interested in how it looks ingame? Go ahead and download version 0.4!

Files

Mines of Volantis 0.4.zip 18 MB
Oct 15, 2018

Get Mines of Volantis

Buy Now$1.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.