Question

I want to make a world generator so that every time I load it, it generates a new heightmap. To do this I'm using a 2D integer array. The dimensions are the x, z, and the height (y).

Is there some simple generation algorithm that will randomize the terrain?

Était-ce utile?

La solution

This is probably the most well-known page describing implementation of Perlin noise - it has all you need, you just need to put a bit of effort into understanding it.

If you are in Java and want ready-to-use solution, you could also use the noise generator implemented in Java3D. There are also many more Perlin noise implementations floating around the web.

I personally prefer the diamond-square algorithm to the Perlin noise. It tends to generate less axially biased noise (that terrain features are suspiciously parallel to either of the main axes, creating visually distracting elements).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top