Random Cave Terrain Generator

I made this a few months ago for a game. It was used as the start point, then we decorated it.

It’s single player. Press Generate to make a cave

It’ll create a branching cave network of just about any size, and construct huge chimneys at the leaf nodes. It’s entirely uses seeded random numbers, so is completely repeatable.

Variables (NOTE - Whenever there are two numbers, the first is a multiplier where the current generation is the variable, and the second a delta)

  • Length - Length of the long caves
  • Width - Diameter of the long caves
  • Cave Radius - Radius of the dome places at junctions
  • Generations - How many times the path splits in two (things get very slow very quickly if you make this big!)
  • Seed - There’s some randomness to the splits and the gradient
  • Drop - Gradient. ie, how far the caves tend to drop ever n distance. Can’t remember what n is.
  • leave radius - Radius of the chimneys at the leaf nodes, I think
  • Y Noise - Uses perlin noise to adjust gradient
  • R Noise - Ditto, for tunnel radius
  • Noise Scale - Adjust the scale of the perlin noise for the above two. I think larger is smoother, but I might be misremembering.

I’d love to hear folk’s game ideas for this sort of terrain!

7 Likes

Thank you! I’m currently making a terrain module so that you can script terrain easier in-game. Is it alright if I integrate this into my project? I’ll give you credit.

1 Like