# Generate islands/continents with simplex noise

Managed to get something like this using a simplexnoise port i made from the original javacode to php:

Used some tips from other post:

Understanding Perlin Noise

basically, lowered the frequency to get more flat terrain.

Now, how could i foce the map to be a huge Pangea? If i manualy set for example, if (x < 5) set height = 0 (water), when i normalize all the map to 0...1 the value 0 get higher (as my simplexnoise function returns -1 1). If i force it to -9999, does not work either.

Has to me something elegant to sneak into the height generation code to make the borderline squares, water.

With MDP algorithm i could seed the sides of the map to -500 for example and then pretty coast would be made, but with simplex/perlin does not seem the case as i can not enter pre-seeded cells with artificial heights.

Any tips?

Maybe I'm not seeing the whole picture, but can't you just the apply the border (by setting those values to 0 / water) after normalizing?

And I suppose you're normalizing correctly e.g: [0,1] = ([-1,1] + 1) * 0.5

Some aditional ideas... last time I generated something like this, I used probabilities and a random number generator.

I simply choose the center of my island, and a maximum radius. Then for each pixel, there was a probability of it being land or water based on its distance from the center and the maximum radius. At the end I also applied a few post processing passes, to detect oceans and remove inner lakes, etc.

Maybe you could keep your current simplex noise approach, but afterwards do a similar post-process on your map in order to make it more "continent-like".

This could consist of going through every pixel, and depending on a random probability convert some of them back to water (by setting the value to 0) e.g. 100% chance of water at the border and decrease to 0% about 20 pixels in). This way it would still look kinda organic.

You could then apply a second pass to remove small islands or something, if you wanted.

Just for reference, using probabilities generates shapes such as this (of course this is in a much lower resolution that yours because it's tile based, not pixel based):

Edit

Even if you don't want to use probabilities (which are just there to give a little extra bit of variation) you'll still need to work with a radius and combine it with your perlin noise in order to get something that looks like an island.

The very least you need to do is take your perlin noise, and apply a radial filter to it so that pixels closer to the border become water. Using a radius will be better for sure than your idea of doing for instance "x < 5 becomes water".

And another thing you could do is ignore the height values in your perlin noise for now. Set a thresold and let the result decide only where there's land and where there's water, nothing else.

You can add mountains as a second pass (e.g by measuring the distance from the coast on each pixel). Then add some lakes, rivers, different biomes in separate passes. Your perlin noise doesn't need to provide all the information at once.

I just found an old link I used before when I worked with this:

http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

I'm sure you'll enjoy it.

• I dont think i will get good results with your binary and probabilistic method, as the mountails will go to the edge of the island which is unrealistic. But stupidly never tried to filter the values after the normalization, i'll give it a try! haha. This happens when you program late in the night after long work hours >_< Commented Dec 16, 2011 at 18:31
• Well that depends on how you apply it. If you don't want cliffs near the water, then just change the method so that mountains become plains, and plains become water. I.e. instead of setting it to zero straight away, subtract a certain height, and if it falls below a certain thresold, then it becomes water. Commented Dec 16, 2011 at 18:35
• And just a bit of trivia, it's not that unrealistic to have mountains reach the edge of an island. I'm an islander myself and we have plenty of those here. :-) Commented Dec 16, 2011 at 18:38
• Check my edit, and I also added a nice article on this subject. Commented Dec 16, 2011 at 18:59
• Amit P.'s article is great, I'm currently porting it to Unity3D; there's also a C#/.NET version based on Amit's code from Baran Kahyaoglu at barankahyaoglu.com/blog/post/2011/07/27/… Commented Dec 16, 2011 at 19:21

I think you're making the mistake of thinking that you can produce this with a single perlin function.

Depending on the result you are trying to achieve you have 2 options:

1. reduce the frequency on that perlin (might be good enough for you)
2. do it the pro way ...

The pro way

I found the reality is waaaay more complex for "realistic" planets.

It seems the best results are achievable through using a stack of noise functions in a tree like fashion.

Typical example might be something like this: http://libnoise.sourceforge.net/tutorials/tutorial8.html

I built a basic tool to try this out for my own use.

I good start point might be to try perhaps a module stack like this ...

billow > scale > clamp = result

That should get you "island like output" with a binary result for a given x,y which you can then feed in to other modules to get the desired final value. Playing with the frequency settings on your billow should then allow you to adjust the size of the islands up to the point of generating continents.

What to do with the basic map:

I took the result of that and fed it in to a select module to determine if I should pull from an ocean module (outputs very low values) or a continent module (outputs from sea level up values, with region a region module for things like plains, mountains, ect).

My model isn't as complex as the version they have on the libnoise site but gets reasonable results in under a minute for a reasonably large planet on a single thread on my cpu.

I'm still improving my generator stack and also threading the generation in to chunks to improve the performance.

Using the gpu is another option, not sure if there's a library available for that though so you might need to code a perlin lib for your gpu yourself if that's the route you want to go down.