0
\$\begingroup\$

I believe this question can help beginner game developers. I've looked through a dozen or so answers on perlin noise here and on Stackoverflow, and found only 1 concrete implementation of perlin noise that I have listed below. There's a lot of advice, but it's hard to translate into what I have to do with X and Y values, and if I have to do this at all times, or only when I want specific features to appear.

Here's what I got from Stackoverflow: I believe this was advised as mixing various noise octaves. It seems to generate a fairly interesting terrain, although it rarely generates mountains for me.

  float perlinNoiseValue =
    +1/15.0* fabsf([generator perlinNoiseX: perlinX y: localYIndex z: 0 t: 0])
    +2/15.0* fabsf([generator perlinNoiseX: 2*perlinX y: 2*localYIndex z: 0 t: 0])
    +4/15.0* fabsf([generator perlinNoiseX: 4*perlinX y: 4*localYIndex z: 0 t: 0])
    +8/15.0* fabsf([generator perlinNoiseX: 8*perlinX y: 8*localYIndex z: 0 t: 0]);

I'm looking at this answer on Perlin Noise by Byte56, and it's hard for me to translate verbal descriptions into what I have to do with X/Y inputs. Can someone provide concrete examples, along with descriptions of what terrain features such noise generates?

For example, does mixing noise by picking the max value equates to something along the lines of

float perlinNoiseValue1 =  fabsf([generator perlinNoiseX: perlinX y: localYIndex + 300 z: 0 t: 0]);
float perlinNoiseValue2 =  fabsf([generator perlinNoiseX: perlinX y: localYIndex z: 0 t: 0]);


float finalValue = fmax(perlinNoiseValue1,perlinNoiseValue2);

Do I always pick the max value in the case above, or only in some cases when I want a certain feature to manifest?

Does flatter terrain look like ?

float flatterTerrain =  fabsf([generator perlinNoiseX: perlinX y: 0.2*localYIndex z: 0 t: 0]);

Does wider valleys and hills look like?

float widerValleys = fabsf([generator perlinNoiseX: perlinX*3.0 y: localYIndex z: 0 t: 0]);

\$\endgroup\$
2
\$\begingroup\$

As mentioned in the answer you reference, this is sort of the artistic side of procedural generation.

These are the kind of functions you just have to keep tweaking until you get something that works for you. Everyone is going to have different ways of generating terrain and even a number of different ways to generate noise. It's unlikely there's going to be a standard template for generating noise for specific terrain types.

I suggest you make an in-game interface for your noise values and set it up so you can tweak the values and have the terrain generate in real time. This will allow you to figure out exactly how different values affect your terrain, and the range of values that give you the types of terrain you want.

\$\endgroup\$
  • \$\begingroup\$ I get the artistic side. I'm just not sure which X and Y values would actually result in a continuous terrain, because Perlin is stateless, right? So if I plug in a non-linear function of X, I should get weird terrain, right? \$\endgroup\$ – Alex Stone Dec 29 '13 at 4:02
  • \$\begingroup\$ Right, you're not sure which values to use. No one else knows what values you should use for your generation algorithms either. This is why you need to play with the values and see what comes out. \$\endgroup\$ – MichaelHouse Dec 29 '13 at 4:11
  • \$\begingroup\$ Here's a very complex place to get started with some real numbers, but like Byte56 says they're going to be nothing like what you end up with for yourself: libnoise.sourceforge.net/examples/complexplanet \$\endgroup\$ – Patrick Hughes Dec 29 '13 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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