1
\$\begingroup\$

I've been using 1D Simplex Noise to create a random world surface, and it keeps generating with the same looking surface terrain, with some minor variations. Here is my sample code-

Tile[][] tiles = new Tile[rows][];
for (int i = 0; i < rows; i++)
{
    tiles[i] = new Tile[cols];
    for (int x = 0; x < cols; x++)
    {
        tiles[i][x] = new Tile(0, new Vector2(x, i), scale);
    }
}

int left = Main.rand.Next(rows / 4, rows / 2);

double seed = Main.rand.NextDouble();
for (int i = 0; i < cols; i++)
{
    int height = left + (int)(Noise.Generate((float)seed) * 10);
    height = (int)MathHelper.Clamp(height, 0, rows - 1);
    tiles[height][i] = new Tile(2, new Vector2(i, height), scale);
    //FillLower just fills everything under the top tile
    FillLower(tiles, height, i, scale);
    seed += .05f;
}

My question is am I doing something wrong with the Simplex Noise method? How should I generate it so it'll look different?

Images for reference- http://imgur.com/I0g98z8,M61UBfb,tYPflb7

\$\endgroup\$
1
\$\begingroup\$
double seed = Main.rand.NextDouble();

give you a 0..1 double value

(float)seed) * 10 

give you a 0..10 value

seed += .05f;

give a little delta.

Try

double seed = Main.rand.NextDouble() * 255.0; //or greater
...
int height = left + (int)(Noise.Generate((float)seed) );
...
seed += 1.0; //play with this increment
\$\endgroup\$
  • \$\begingroup\$ When I do it this way, I just get a straight line for my terrain generation. \$\endgroup\$ – TheUnrealMegashark Jun 3 '15 at 20:43
  • \$\begingroup\$ Whoops, figured it out (I think). \$\endgroup\$ – TheUnrealMegashark Jun 3 '15 at 20:47

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.