Need some help with voxel terrain generation

I have to make it clear that optimisation doesn’t seem to be a problem for now, anyways when the generation starts, it follows the perlin noise for about a few seconds and dissolves into madness, probably to not overload the player’s computer when generating thousands of blocks; I am also trying to get a world spanning over 10000 blocks. For some more info, I’m trying to replicate the generation of an old game called Castleminer Z whose worlds go over 10000 blocks.

The first solution was generating it layer by layer, the grass layer generates fast while the lower levels take longer to generate but that only worked for lower map sizes like 2^5

The second solution i thought of to deal with it is generate it chunk by chunk and using a task.wait() to not crash but turns out I don’t have the experience to write it, I would also like some other suggestions on how to make it happen.

Here’s how the generation looks like and some parts of the script

Layer by layer generation:

Use greedy mesh for chunks during generation?

Does greedy mesh allow the voxels to be mined individually?

Yep it’s utilised in voxel games

1 Like

alright i’ll check out the method