jackdelahunt/Eiram

Random terrain generation

jackdelahunt opened this issue · 0 comments

What other people do

Games of this kind generally go to generating terrain with perlin-noise. Most have their own implementations with some variation, like the addition of more fields like amplitude, frequency and persistance; link.

What we can do

Unity provides a perlin-noise function in the Mathf library so that is sorted. I still need a way to randomise a seed however. Dotnet has a random class which can be used to generate the random offsets needed for the perlin-noise function; link. Using the Next method in the Random class should work just fine; link.

Example:

System.Random prng = new System.Random(seed);
float seedOffsetX = prng.Next(-100000, 100000);
float seedOffsetY = prng.Next(-100000, 100000);

float value = Mathf.PerlinNoise(seedOffsetX, seedOffsetY);

Some scailing may also have to be added as I am currently not sure how detailed the noise is.