Perlin Worm Cave Generation

How do I make a cave with perlin worms?
The cave should be made with blocks and hollow inside.

I’ve read the articles on it and all the devforum posts, but I still don’t understand how it works, everything I found makes terrain-like flat results.

Could anyone help?

2 Likes

The first thing that you will have to do is to understand the theory behind Perlin worms. The inner workings of this algorithm can be found here.

Note that it is probably easier to use Perlin Noise for the job.

-- Simply put
-- You can modify this quite a bit to your liking
-- math.noise provides you with an optimized implementation of 3D Perlin Noise
local function isSolid(x, y, z)
    return perlin(x, y, z) < threshold
end

I once built a 2D Minecraft/Terraria-like game with caves. It is open source, so you can see how I did it.

1 Like