Sign in to follow this  

Simplex Noise 2D Terrain

This topic is 829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wanted to post in this topic but it's too old

http://www.gamedev.net/topic/630940-how-to-use-perlin-noise-in-terrain-generation/

 

I need help using the simplex noise class.


I'm creating an byte array for my world and filling it with solid tiles
 

           for (int i = 0; i < mapSize; i++)
            {
                for (int j = 100; j < mapSize; j++)
                {
                    worldArray[i, j] = 1;
                }
            }


Ok so the Noise.Generate method is returning a float mostly values between -1 and 1


Thats why i'm rounding them that i get 0 = air or 1 = solid block
 

            float frequency = 0.0085f;

            for (int x = 0; x < worldArray.GetLength(0) - 1; x++)
            {
                for (int y = 0; y < 100; y++)
                {
                    float val = (float)Math.Round(Math.Abs(Noise.Generate((float)x * frequency, (float)y * frequency)));
                    worldArray[x, y] = (byte)val;
                }
            }

I'm getting a terrain but it's really not nice with lots of floating islands.

 

I think I'm using the returned float values wrong?

Share this post


Link to post
Share on other sites

This topic is 829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this