Now that we've covered a variety of different noise algorithms, we can start to actually put them to use. Noise algorithms can be used for a large variety of things and many noise algorithms with different seed can be used with one another to give interesting designs.
This is what we will be doing today. We are going to use 3 simplex noise algorithms, all with different seeds, to create a "world" with different biomes. These 3 noise algorithms will be a heightmap, a heatmap, and a rainfall map. The heightmap will determine 1 of 5 possible options. Lake, beach, biome, mountain, or snow-topped mountain.
If the heightmap makes it a biome, we need to determine the different biomes based on the heat and rainfall at a select point. This is where the image below comes into play.
We can see on this image that the amount of rain and the temperature determine what the biome is. It gives us 10 possible biomes to choose from and each biome corresponds to a specific color in our final image.
Let's take a look at how this is actually done.
We can see that this part is quite simple. We supply a width and a height and every point on there we get the simplex noise 3 times. One for height, one for wetness, and the last for temperature. We then call the method GeneratePoint with the 3 values returned and this is what makes the biome colors. Let's take a look at that method.
GeneratePoint is quite a simple method as you can see. We first check the height to make one of our 5 possible height options. Then we use the wetness and temperature to make the biomes their own unique colors.
Below you can see an example output of what our algorithm created.
This is our biome map! It is by no means perfect, or even accurate to how the real world works but it shows how we can use noise layering to create new and interesting outputs!The method we use here, however, is completely random, which makes for some strange results. For example there's "tundra" biomes ( turquoise color ) in the middle of a "desert" biome ( orange-ish - yellow color ). This should never happen in real life but because of the randomness of this it does.
This is actually similar ( albeit much less complex ) to how some games like Minecraft generate their worlds, so hopefully this gives some insight into that.
This method obviously needs some improvements and we will work on it in future variations. But in the meantime I hope you learned something. As usual the code is on GitHub here.
No comments:
Post a Comment