Monday, March 8, 2021

River deep, mountain high

 Consider this regional map:


The rivers aren't behaving very realistically. Notice in particular the western-most one that runs roughly parallel to the mountains. In real life, rivers very rarely do this. They flow directly away from mountains as if they can't get away quickly enough.

My rivers do run downhill, usually by the steepest available route (though sometimes they're forced to take less steep routes in order to flow into each other in more natural-looking ways). The problem is that the steepest available route isn't always directly away from mountains. I think this is partly a result of the depression-filling algorithm, which creates slopes that have nothing to do with mountains. It's also because although mountains have raised land underneath and immediately around them, this doesn't extend very far. So mountains don't affect rivers that are more than a tile or two away. In reality, the land slopes down from mountains over a longer distance.

We also have situations like this:

Here, rivers are actually going right across the hills! They're not breaking the laws of physics - they do flow downhill all the way - but they carve valleys from one side of the range to the other.

In real life this can happen, very occasionally. An example is the Gandak in Nepal, which flows across the Himalayas. This is possible because the river is older than the Himalayas, which are geologically young - as tectonic processes have raised the mountains, the river has eroded them, so they have effectively risen around it. Clearly, though, this shouldn't be very common, but it happens a lot on my maps.

I think the reason for this is again associated with the depression-filling routine. If you have several mountain ranges forming a loop, the land in the middle will be filled up - not to the height of the mountains, since the depression-filling routine ignores the mountains themselves, but to the height of the raised land beneath the mountains. It is this level - not the level of the mountains themselves - that is used to calculate the flow of the rivers. So if there's a river on that plateau, it will flow happily off the edge, right through the mountains as if they're not there. Because as far as it's concerned, they're not.

I have a solution for this problem which is fairly straightforward, if inelegant. When the rivers are created on the global map, we simply check for any rivers which are entering mountainous areas, and we remove all mountains from the river tiles and surrounding tiles until they leave the mountainous areas. That gives us this:


Not perfect, but it'll do.

What about the first problem, rivers not running away from mountains clearly enough? As things stand, when mountains are placed on the global map, the underlying terrain is raised in the cells containing the mountains and (most) immediately surrounding cells. I tried extending this further, so that the ground slopes away from mountains for many cells. However, this resulted in too-straight rivers. I eventually reached a compromise: land is raised for several cells around mountains, and water flow is calculated according to this mountain-related elevation, ignoring other kinds of elevation, in those areas. This leads to rivers tending to move more directly away from mountains that are nearby, but then become more relaxed further away, retaining their nicely wiggly courses.

So the area shown earlier becomes this:

I wish I could get the rivers to run away from the rivers for longer, but this doesn't look tremendously bad to me. There are more mountains to the east of this area so it's probably reasonable for the rivers to be heading mostly south. We don't have rivers skirting quite so closely along the edges of mountains, which is the main thing.

There are some annoying grid-like artefacts around the southeast corner of this map though. I think these are something to do with how roughness is being calculated, so that's the next thing to tinker with.

No comments:

Post a Comment