Creating Procedural Mountains: A Fractal Noise Tutorial

Wow this is probably the best minecraft/roblox graphics I have ever seen good work

3 Likes

You can change the size of the terrain by adjusting SIZE_X and SIZE_Y in the final code snippet. This will allow you to change the size of the terrain as it alters how many x and y coordinates the for loop iterates over.

As for lag, there is no real performant solution for roblox on a large scale like this.
I would recommend exploring with chunk loading/unloading to simulate a StreamingService type setup. If you only need to calculate and generate chunks near the player, you reduce the lag a lot.

If you are generating chunks you also don’t need to Instance new parts for every coordinate. Since only so many blocks will be in the game per player, use PartCache to keep a store of cached parts and just move them to their required positions.

I hope this helps!

4 Likes

Out of all I’ve researched on this topic, this is one of the most useful and straight forward tutorials I have read. I will definitely keep a reference to this for a long time, and I hope others who decide to start looking for information on procedural generation can find it as well.

This is the only somewhat performant way so far to go, even Minecraft has a similar set up, albiet with a different design that is probably much more performant than anything we will make. Chances are it will lag even with chunks depending on your set up. However, if you put in the effort you can take it one step further and only generate what is visible to the player to an extent, reducing lag even more.

3 Likes

This is truly amazing, how Roblox devs always find out a new way to make games better at Roblox.

In your generateBlock function, multiply the position and size of the block by a scalar value before setting it.

Amazing tutorial. Ive been messing with Fractal and Perlin noise for a while, and this helped a lot

1 Like

Simply amazing, it’s a 10/10 to me, this is the best post I found, honest !

1 Like

How can I use this with 3d Perlin noise?

Just add a third argument to the generation code, for example:

math.noise(x, y, z)

But what difrennce does that make?

It adds an extra dimension to the noise, which is the thing you asked for.

If you only use x, y you’ll only get 2D noise.

Is there any chance that you could maybe also make a tutorial for generating actual terrain in the same kind of method? Because converting the blocks into terrain keeps the blockyness, and using the smooth tool over the whole map would be a pain.

I would look into modifying the generateBlock function to produce terrain voxels instead.

You can get pretty precise by using WriteVoxels to get the result you want.

Alright I’ll look into it, I’m hoping I no longer have to hand make all my terrain since roblox default generation is kinda bad

The ‘I hated it’ vote option must be satire, so I went with it. Fantastic tutorial!

7 Likes

Absolutely fantastic, I think multiple keywords could fit into the generation part, like lacunarity being intensity, and scale being zoom?

Workspace.Terrain:FillBlock is also pretty good
Terrain | Documentation - Roblox Creator Hub


defiantly needs a chunk system and maybe parallel luau to make performance smoother

yeah, I ended up going with the preset terrain generation in @5uphi’s Infinite Scripter plugin, it comes with loading/unloading, and uses parallel as well

1 Like

Thank you so much for making this! I looked for days and days trying to find a tutorial on perlin noise with octaves but it wasn’t in lua.

1 Like