Monday, February 13, 2017

Mountain Placement

With the mountain drawing finished (for now, anyway) I want to turn my attention (at least briefly) to the problem of placing the mountain symbols on the map.  This is a challenge because the mountain symbols don't correspond one-to-one for mountain locations on the map -- that is, they symbolize the mountains, but there isn't a mountain symbol on the map for every mountain.  So I have to choose what symbols, how many, and where to place them to symbolize the mountains on the map.

Figuring out where the mountains are on the map is straightforward.  Like most procedural map generation, I have a height map for the world.  I decide what percentage of the map should be mountains (this can vary, so that map might have lots of mountains or few mountains) and declare that percentage of the highest land locations "mountains".

My initial approach for placing the mountain symbols was to go through the map from North to South (essentially from back to front) and when I hit a mountain location, I check to see if there's already a mountain symbol on the map within some distance (based on the size of the symbol I would put down for this location) from this location.  If there is, I skip putting down a mountain symbol.  If there isn't then I put down a mountain symbol for this location and continue on.

That approach was used (for example) to generate this map:
This works okay, but one drawback is that it essentially picks the locations to illustrate with symbols at random.  On the theory that the big mountains are more important, I rewrote the algorithm to walk through the mountains from biggest to smallest, so that the tallest mountains get drawn preferentially.  
I'm not sure this noticeably improves this particular map, but I think it will produce more consistent results.

By varying the distance to exclude other mountains, I can control whether the mountains are sparse or dense on the map.  Dense layouts have a certain appeal -- the mountains almost form a texture:
On the other hand, a sparse layout isn't terrible, and might look better on a map that was already busy with other features.

Right now, I'm calculating the exclusion distance as a circular radius around a location.  A more sophisticated approach would be to create a bounding box around the mountain, or even intersect the actual symbols.  But I'm not sure that would add much value.  I'm not trying to make the mountains never overlap with each other.  A certain amount of overlap is good, and the semi-random occurrence helps create some interest as well.

You may recall from a previous posting that Dragons Abound can generate mountain ranges that extend along a fault line.   How does my current mountain placement do with that?

This isn't perfect -- it would be nice to have a unified set of similar mountains running down the spine of the mountain range -- but it isn't terrible.  You can see mountain passes and some high valleys in places.  And it's a lot simpler than trying to figure out the "spine" of a mountain range and how to place symbols along there :-).

1 comment: