2D landscape generation

BlitzMax Forums/BlitzMax Programming/2D landscape generation

Ghost Dancer(Posted 2008) [#1]
Does anyone know any algorithms or tutorials for creating realistic 2D landscapes? I've spent several hours on google and have not been able to find anything that is even remotely useful - most algorithms I did find were 3D which is no use to me, and the few 2D ones I did find weren't good enough.

If anyone could point me in the right direction it would be very much appreciated :)


Dreamora(Posted 2008) [#2]
then take one of those that are not good enough and make those parts better you don't like.

there is no general good solution, good solutions can only be done for specific usages


Ghost Dancer(Posted 2008) [#3]
There were no parts that I liked in the 2D ones I found ;) I would be better off trying to convert a 3D algorithm, but I was hoping it wouldn't come to that, which is why I thought I'd ask here first.


ImaginaryHuman(Posted 2008) [#4]
When you say 2d landscape do you mean as in games like Worms and the like, a cross-section of landscape viewed from the side, or are you talking about some kind of tile-based isometric landscape thingy?


Ghost Dancer(Posted 2008) [#5]
Ah yes, I should have specified that really ;) It's not actually for a game, I'm basically trying to make a world map generator that creates an aerial view of a world. Ultimately, I would like to create images along then lines of this (but without the clouds):



but would be happy with something more basic to begin with. A fractal based one would be best, but I'll settle for anything at this point. Once I know the basics I'm sure I can modify it as needed.


tonyg(Posted 2008) [#6]
Do you want to do this on the fly or can it be pre-generated?


Dreamora(Posted 2008) [#7]
Above can be done by using perlin noise with some usefull flags and doing stuff like "erosion" yourself.
coloring can be done basing on themes and the heights of the pixels (hue).

Don't see why anyone would start out with a fractal for a map thought.


Ghost Dancer(Posted 2008) [#8]
I want the user to be able to create a map with a random seed and change a few parameters like amount of water etc. Speed is not much an issue though - the goal is simply to create a map.

The image above is from a fractal landscape generator app, I just want to be able to do my own, simplified version. There is obviously a way of doing it, I just don't know where to start.

I'll have a look at perlin noise but from what I have found so far, fractals seem to produce the most "natural" looking landscapes (I've just not found any 2D examples of how to do it).


Rob Farley(Posted 2008) [#9]
I'm pretty sure sswift has a perlin noise function in the code archives.

To create a map like that you are effectively creating a 3D map. Each point needs a height so you do have x,y and z coordinates.

You can use your own methods though which I sometimes find a bit of fun... but then I like that sort of thing!


impixi(Posted 2008) [#10]
Heightmap Toolbox V0.3.6, in the code archives, might be of use to you. test5.bmx and test6.bmx demonstrate something similar to what you’re trying to achieve.

Basically you generate a heightmap and then map colours or textures to the height values. I'm using the technique myself to generate overhead maps, though somewhat more advanced than the Heightmap Toolbox examples.


Ghost Dancer(Posted 2008) [#11]
Thanks for that impixi, that certainly gives me a good starting point :)