Sunday, February 21, 2010

New Map Generator


I've spent the past few days working on a procedural map generator. Previously, my Earth3 game had randomly generated terrains using some fluid dynamics formulae. The result was a wavy map that somewhat resembled rolling hills. As you can see in the screenshot, the terrain is random, but lacks variety.

The new terrain generator uses coherent noise, which generates much more interesting and realistic terrains. The program starts by generating a Perlin noise map to determine the shape and elevation of land masses. Regions of the map where the elevation is above a certain threshold are designated as mountain ranges. These regions of the height map are blended with a Voronoi noise map in order to gove them a "ridged" look. You can see where the terrain transitions from Perlin to Voronoi, because the mointain ranges are the only regions that have that ridged pattern.

One very useful aspect of coherent noise is that the input parameters allow the user to control the look and feel of the map. For example, increasing the frequency of the Perlin noise causes the map to have several small continents instead of a couple of big ones. Other aspects that can be controled are the smoothness/roughness of the shore lines, and quantity of mountains.

Here's a screenshot of the above map, rendered in Earth3. The map clearly has more personality than the old map. The terrain has distinct geological formations ocurring in different areas, as you would expect to see in nature. The next big feature that this map needs is multi-texturing based on elevation and slope.

No comments:

Post a Comment