Post By Pritchy96
First Experience With Fractal Terrain Generation
I've been a programmer for a couple of years now, and a long time lurker of this website. I decided to combine the two interests and came up with a Fractal based Terrain Generator in C#. I thought I might share my results with you all!
A rough outline of the process used:
I first generate two Plasma Fractals, using the Diamond-square algorithm. One will be the actual map image, whereas the other will be used as a shader of sorts to add some variance to the colours of the map.
I take one of the images and colour it based upon the RGB value of each pixel. This gives me the basic map, unshaded. This isn't as slow as it sounds when you edit the raw Bytes of the image.
I then go through the image and multiply the RGB value by a coefficient calculated from the corresponding pixel on the shader map, to give some variance to the colour.
Finally, I randomly displace each pixels RGB values by a small amount - Adding 'noise'
Sorry I had to use a different map for each image, the way I programmed it is such that it does all the colouring at once to speed things up. It would be a fair rewrite to get a different image for each stage of the same map!
And finally, a shot of the program:
Overall, the generation time is pretty darn quick - around 1 second for a 600x600 pixel map. Times *should* linearly scale, too: ie, a 1200x1200 map will take approx. 2 seconds to complete. I could speed things up (and clean up the code a lot ) in a later rewrite.
I'm not 100% pleased with the results, overall - there is often unrealistic features, and everything looks a bit fractal-ly. I won't post the .exe file here as most browsers are convinced it's a virus, and I'd rather not have to deal with that. I can however post it's github page, if anyone is interested
https://www.google.com/?gws_rd=ssl#q...n%20generation is an excellent starting point. Ultimately, it will depend on your goals (fast generation for in-game world generation, realistic generation, artistic generation, learning new programming techniques, etc.)