World Seed

Hi :slight_smile: its my first question, im building a voxel terrain system, im just using my own 2D perlin noise to get the terrain height for now, but i was wondering how can i have a world seed system like minecraft, in the sense that if the seeds are the same, trees will spawn in the same place, any ideas? i cant just set the random seed because the trees wont spawn in order, maybe another perlin noise? i have no idea. im thinking about having a noise function for temperature, humidity and height, then getting other values from that, such as tree spawning, let me know

When I did this, I had multiple layers of blended noise and multiple nested generations, all kinds of crazy stuff going on. I never felt the need to use more than one “world” seed.

The control over the various aspects of noise generation should come from the other parameters; scale, octaves, iterations, blending (if any), etc. These are experimentally found fixed values you can safely hard-code. Assuming these parameters are fixed, the same seed will produce the same world every time. This is highly desirable in most situations.

In case you are unaware, the seed value should be applied to the position arguments from which you sample noise. Adding the seed value to the position arguments is sufficient to introduce the seed to the generator and have it function as described.

I don’t really have much to say about implementing a save system, but there is one thing I feel strongly about that I would like to advise you on: Don’t use Perlin noise!

Perlin noise has significant directional artifacts. It’s an older function, and regardless of the fact that people talk about it all the time and that it’s the one that’s built into Unity, it’s more often than not a worse choice than the alternatives.

Look up Simplex noise (Perlin’s newer function) and OpenSimplex noise (a similar function I came up with that works a bit differently). You should be able to find C# implementations of both.