Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently using Perlin noise to generate a terrain. This is my actual attempt to create caves. I do get some sort of cave structures but they are small and are always close to the edges of the terrain. Also my terrain looks very irregular I'd like to have a more flat terrain. I've been playing with the values I pass to the Perlin noise function but I can't seem to get something good.

Do you have any pointers or suggestions to my actual approach in order to get something more regular within the Minecraft standards?

share|improve this question
5  
I believe, in Minecraft, caves are not generated with terrain, but rather cut into the terrain after. –  UnderscoreZero Apr 25 '13 at 16:58

1 Answer 1

up vote 5 down vote accepted

Terrain generation falls under the form part of development. It's an artistic endeavor, so I'm not so sure there's a correct answer. However, I can try to tell you about the knobs you can turn to get different results, and it'll be up to you to turn them to get the result you want.

  • Compress/expand: You can stretch or shrink the noise along a specific axis to alter the features of your terrain. This would primarily be useful on the Y axis, but would also work when used on the X and Z together. For example, if you want flatter terrain, apply a factor of .2f to the Y input on your noise function. Or if you wanted wider valleys and hills, you could expand the X and Z axis to stretch the noise out over a larger area.

  • Mixing noise: You can have multiple noise functions and combine them for interesting effects. For example, always choosing the maximum between your two noise values will give you more features (hills, peaks, etc.).

    • Noise selector: You can even use a third noise value as a selector to choose between two noise values. This is a good way of generating cliff faces and dramatic changes in landscape. I used this technique with some success in my game.
  • 2D noise with 3D noise: You can use a 2D height map to limit your 3D noise. This makes it far easier to control the surface of your world and vastly reduces weird features like floating islands.
  • Caves: Likely the easiest way to generate caves is to make them in a later stage of generation and remove them from the existing terrain. There's a bunch of methods to use, and it totally depends on what kind of caves you want. You can use simple 3D noise with a very low cut off between solid/air. Or you can use noise like Perlin worms to generate special noise that works well for caves.

I suggest you set up your code in such a way that you can easily change values and generate a new map, preferably without rebuilding. You need to be able to quickly test changes in your values so you can start to find the input values that work with your algorithm to give you the results you want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.