问题
I have been experimenting on making a random map for a top down RPG I am making in Python. (and Pyglet) So far I have been making island by starting at 0,0 and going in a random direction 500 times (x+=32 or y -=32 sort of thing) However this doesn't look like a real image very much so I had a look at the Perlin Noise approach. How would I get a randomly generated map out of this :/ (preferably an island) and is it better than the random direction method?
回答1:
a perlin map can be generated easily.... it is simply a 2d array of values (typically 0 - 255) you just need to pick a threshold (say 126) anthing higher than that and render your land square. otherwise render water
something like this may help http://simblob.blogspot.com/2010/01/simple-map-generation.html
回答2:
You could also use 1d perlin noise to calculate the radius from each point to the "center" of the island. It should be really easy to implement, but it will make more circular islands, and won't give each point different heights.
来源:https://stackoverflow.com/questions/12232901/how-to-make-a-2d-map-with-perlin-noise-python