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 have a simple perlin noise algorithm in my 2d game, I feed it x and y location of a tile and get some value between 0 and 1. I then use a bunch of if-else statements to break these numbers into terrain types:

  • 0 is water
  • 0.5 and less is plain
  • 0.6 and less is hill

Then there's features like forests, but in the current system a hill cannot have forest on it. I'm using only 1 perlin generator here, and my question is whether I need to have multiple perlin generators with random seeds to control elevation, vegetation and other terrain features?

share|improve this question
    
Only add to existing answers that you may want to implement an erode algorithm pass: float4x4.net/index.php/2010/06/… to obtain believable heights distribution. Apply a noise pass to the xz plane (assuming y is up) to obtain areas with more flat terrain was smart too and maybe no need for the erosion pass. Placements of things like trees will require its own pass, for example, anything belows 0.5 means no tree, above that means tree, or different types of tree. If you have 3 tree meshes, tree_type = (int)((value - 0.5) / 3) –  Hatoru Hansou Jan 2 at 11:54
    
Ups, It's more like, tree_type = (int)((value - 0.5) / 0.5 * 3), If less than 1, no tree at that coordinates, from 1 to 3, any of the three tree meshes. –  Hatoru Hansou Jan 3 at 0:22

2 Answers 2

up vote 2 down vote accepted

I think that it might be important for you to differentiate between the raw terrain and the stuff on the terrain. Many algorithms work with multiple passes.

First pass would be to use noise like you're doing to create raw terrain. Second pass would be to figure out what biome is appropriate in broad areas of your new terrain, you are almost doing this by assigning types like "hill" but this is deeper and more varied. Third pass then randomly drops down biome-stuff like trees.

How you represent this final version in your program is entirely up to you.

See Byte56's answer for good links to making more elaborate noise, you'll get some use out of that I warrant.

There's really only one perlin generator at work, everything else is built on top of its output. The biome-stuff doesn't need the properties of noise, it can be pseudo-random.

You can, of course, get more and more elaborate and start working with multiple levels of detail via parameter changes and multiple calls to the perlin function(s) but for simple uses it's not often necessary.

share|improve this answer

You don't need them no. You can easily design your perlin noise generator to accept various inputs to produce the desired outputs.

See my answer here for details about mixing noise. And here for controlling noise with noise.

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.