2019-12-16 Growing mountains

I have started thinking about yet another wilderness map generator... I know, hilarious.

The first task is how to grow mountains. For the “Alpine” algorithm I sprinkled the map with mountain tops and “grew” them by surrounding them with hexes of ever decreasing height. But now I feel like wanting to better model how mountains are created. Something about plate tectonics... Forces pushing from two sides, lifting up the edges, and erosion then cutting river valleys into the rock, or something like that?

I’m still thinking about it. If you have a procedure to generate a wilderness map and would like to see a map generator for it, let me know and we’ll figure it out somehow.

Back to mountains, Text Mapper has an option to see the “Alpine” algorithm documented. It allows us to see how the height map gets generated, for example:

First, we pick 15 peaks and set their altitude to 10. Then we loop down to 1 and for every hex we added in the previous run, we add 3 neighbors at a lower altitude, if possible. We actually vary steepness, so the steepness given is just an average. We’ll also consider neighbors one step away. If our random growth missed any hexes, we just copy the height of a neighbor. If we can’t find a suitable neighbor within a few tries, just make a hole in the ground (altitude 0).

Altitude map

There are a few things to notice:

  1. these inclines are super gradual; we depend on the colouring to tell us where the mountains begin and end
  2. the mountains are placed randomly so they rarely form a true mountain range
  3. there’s also no possibility for long valleys to be created

Thus, when the final image looks as if it has a mountain range, then that’s a trick of the colouring, I think.

Complete map



I had a manual input map of “tectonic uplift” values that I used as an input into an uplift+erosion equation. That worked pretty well. But I think something with more dynamic force generation would be cool.


Shelby 2019-12-16 20:18 UTC

Thanks for that link!

– Alex Schroeder 2019-12-16 22:59 UTC

You are way beyond me with this one Alex. However, it is interesting.

Tim Shorts 2019-12-17 00:45 UTC

Recently I started wondering whether one could see the Alps as a case of Sine-like wave with its peak between Italy and Switzerland but with smaller peaks south of Vallais and the Jura north of the midlands.

– Alex Schroeder 2019-12-19 07:09 UTC

Interesting to see how Large Scale Terrain Generation from Tectonic Uplift and Fluvial Erosion differs from my Alpine algorithm! The one thing I w-try about is that they are proud for having found a solution that produces results in 2min but that is still far too long for a web app. And really, for RPG purposes, do I want a realistic map? Perhaps I do. I don’t know. I wrote a bit about this in 2017-06-09 The Purpose of a Map. “Why am I not seeing a lot of people simply using Google Maps?” Indeed. I wonder. Perhaps I just need to figure out how to add more mountains at the beginning, and have two or three steps of erosion?

– Alex Schroeder 2019-12-20 21:53 UTC

Mountain Range I’ve been experimenting with a mountain range: pick two random points on the left and on the right edge, and lifted every hex that’s close to that line (see Wikipedia). Given that the altitude varies from 0 to 10 (with 10 being the snow peaks and 0 being the ocean):

d < 1+3
d < 2+2
d < 3+1

As you can see, the result is a pretty dramatic glacier wall.

I then tried reducing the number of peaks. By default, it’s width × height ÷ 40 ≅ 7 and so I tried it with just 3 peaks. This result isn’t too bad.

Mountain Range with less peaks

Still, I’m not convinced that the maps are “better”. Let’s simply zoom out and see what this gets us. Here we have a 50 × 20 map (instead of 30 × 10) with 12 peaks (instead of 50 × 20 ÷ 40 = 25).

Mountain range zoomed out

Clearly, the problem is that there are no rivers digging into that mountain range. There’s no fractal, dendritical structure to it.

Compare it to some real data. Here’s from the Open Street Map:


Another element I’m not happy with is that rivers in the flat lands don’t meander: they just race to the ocean, essentially. That’s because the altitude keeps descending: it’s never really flat. And if it were, the forests would turn into huge swamps. Actually, maybe not such a bad development. But clearly there is no erosion digging valleys in the mountains and no depositing of material in the flat lands to cause any meandering, and that irritates me.

One solution would be to create the river system and have them dig deeper, lowering the hexes and their surroundings. The problem is the order of things. Here’s a screenshot of step 9:

Image 3

In the code, these are the steps:

 1. sub { $self->flat($altitude);
	  $self->altitude($world, $altitude); },
 2. sub { $self->bumps($world, $altitude); },
 3. sub { $self->mountains($world, $altitude); },
 4. sub { $self->ocean($world, $altitude); },
 5. sub { $self->water($world, $altitude, $water); },
 6. sub { $self->lakes($world, $altitude, $water); },
 7. sub { $self->flood($world, $altitude, $water); },
 8. sub { $self->bogs($world, $altitude, $water, $flow); },
 9. sub { push(@$rivers, $self->rivers($world, $altitude, $water, $flow, 8));
	  push(@$rivers, $self->rivers($world, $altitude, $water, $flow, 7)); },
10. sub { push(@$canyons, $self->canyons($world, $altitude, $rivers)); },
11. sub { $self->swamps($world, $altitude, $water, $flow); },
12. sub { $self->forests($world, $altitude, $flow); },
13. sub { $self->bushes($world, $altitude, $water, $flow); },
14. sub { $self->cliffs($world, $altitude); },
15. sub { push(@$settlements, $self->settlements($world, $flow)); },
16. sub { push(@$trails, $self->trails($altitude, $settlements)); },

So... move mountains and bogs down and add a new erosion step after rivers? Something like that... And since there are no rivers in mountains for now... Have uplift happen after rivers and before erosion?

I’m not sure. Here I’ve changed the order of things around, and I have allowed rivers to originate in any hex of altitudes 7–10 (thus, even in the white mountains). In order to get more mountains I used peaks = 10 and noticed the nice valley in the area around 18.08. How would erosion change it? Perhaps any area that is has a river that’s already three long gets its altitude reduced by one?

That would be the ones marked in red: the rivers strong enough to carry away a lot of soil?


Perhaps this should work only at higher altitudes, as one imagines the terrain to be steeper up there. Say, the valley from 16.08 to 19.10 and the mountain at 28.04?

I’m still not sure about the white mountains. I guess one really has to imagine the mountains to exist on the edges of the hex, so a river coming from 14.07 is actually a river coming from a circular deep valley surrounded by mountainous peaks, or some sort of glacier?

– Alex Schroeder 2019-12-29 12:51 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Just say HELLO