Random Terrain Generation With Seeds

So i have been trying to make a game with random terrain so the terrain is randomized everytime.

Is there an efficient way to do this?

1 Like

Use a noise function for smooth random terrain, place parts in a grid, then assign their heights according to the noise function. You can change the material and color depending on their heights aswell, more information here: https://youtu.be/tI9g1E65-H8

1 Like

Yes But as i found out its not really randomized. As it is only customized by the values and variables is there a way the player can choose the generation?

If I’m understanding you correctly, you’re referring to how math.noise will give you the same output for the same input, and is only adjusted by the frequency/amplitude/octaves you give it?

If that’s the case, if you’re doing a 2D height map, you could do something like:

local Rng = Random.new()
local SEED = Rng:NextInteger(-10^6, 10^6)
...
...
local height = math.noise(x,y, SEED)  --add noise equation stuff to x,y

and for a 3D volume grid, you could do:

local d = math.noise(
SEED+x, --add noise equation stuff to these
SEED+y,
SEED+z
)

This will basically ‘shift’ your terrain over by whatever ‘SEED’ ends up being. Although it’s still pseudo-random, for practical purposes you should still get different looking terrain each time you launch.

3 Likes