Jump to content
  • Advertisement
Sign in to follow this  
Stealth Kill

Simplex Noise 2D Terrain

This topic is 1137 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



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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!