19 Jun 2017

Note: the /x/ series of posts on my site are mostly unpolished mini posts. The polished version of this will come later, maybe in a few months.

In my polygon map generator from 2010 I built the mountains based on the coastline, then made rivers flow down from the mountaintops. I’ve been exploring a different approach. Last week, I grew rivers up from the coastlines. My goal this week was to build mountains that matched the generated rivers.

I wasn’t able to make something that worked to my satisfaction.


The first ingredient I had was the Strahler Number. It calculates the tree height, and tends to stay the same for long distances along the main rivers:

The Shreve Number is more about water flow, and varies a lot along the main rivers:

#Combining ingredients

The main idea I’m going to use is bend vs fork triangle types (described in my previous blog post). The bends are in blue and the forks are in purple:

Hey, this is looking promising. Those areas that are entirely blue are what I want to turn into mountains peaks and ridges. But there’s also lots of blue in the valley areas, so blue vs purple is not sufficient. I need something more.

The areas I want to turn into mountains aren’t just blue. They’re chains of blue segments. In the valleys, there are blue segments, but they don’t form long chains. I’m going to try using this.

In this diagram I’m computing the segment length between the forks, resetting to 1 at each fork.

It’s a little hard to see but the red is primarily showing up in river valleys, and the other colors in both valleys and mountains. Not quite what I want!

I built something on top of this. I add elevation when it’s a long segment and subtract for forks and for high strahler numbers. Areas that are reachable through several long segments are marked in red or yellow; areas that are reachable through primarily short segments are marked in blue:

I think this reasonably distinguishes the areas that should be sloped (red) vs flat (green). However, it doesn’t actually assign good elevations. It’s a purely ad-hoc function with no good geologic justification.

#Next steps

I now have something that distinguishes flat areas from mountainous areas. I need to find a way to assign elevations so that both sides of a ridge are compatible, with similar elevations. The rivers on both sides may have very different lengths and my current computations don’t communicate anything across ridges. Although the elevation calculation is mostly bogus, I managed to occasionally get some very interesting terrain, like this:

I had hoped to figure out elevation this week, but I’m not happy with it. I’ll have to spend some more time on this. If it doesn’t work out, I’ll go back to a more conventional approach of building mountains first and then rivers second.

Update: it didn’t work out (see next blog post) but it produced some pretty cool output.