f0ssel

Island Generation

2 min read #gamedev

After a good time away I’ve had some free time to spend messing with a problem I’ve had lately, and that is that I wanted a full map generated without watching chunks come into vision in the distance like they have been. I’ve tweaked my previous generation code in a lot of ways and made a lot of processes simpler and re-useable for other scripts, and finally came up with version numero uno of my island generation code.

islandGen02

It basically just generates the infinite noise like before but starts stretching the mesh downwards under sea level after it passes a threshhold. I was not happy with how drastic the linear approach was (you could see the change in slope very obviously, or you had mile long beaches) so I tried a quadtratic approach and ended up settling with an power of 4 for the curve from 0 to 1. Like so:

Graph of y = x⁴ against a straight line, from 0 to 1

This meant that after passing the threshhold, it would very slowly start to lower elevation until it got very close to the maxium distance (this being a factor of 1 of the threshold) where it would very quickly fall off. This allows mountains to still be very near beaches without a visually obvious fall off towards the shore.

islandGen01

My first concern with the generations as I went through 20-30 different random seeds is that the mountain ranges always seem to start at the northwest side of the island and will continue towards the southeast side, dispite the seed being changed every iteration.

Hope to post more soon, exploring this island felt really great. I estimate running from one side of the island to the other should take anywhere from 15-30 minutes, so it feels massive. The much larger polygons and giant scale in general makes it feel a lot better than before and really opens up a lot of awesome views from the vantage points on the island.