Thursday, March 7, 2019

Small lakes

Let's take a break from the thankless drudgery of trying to clean up the lakes/rivers code... and put some more lakes in.

Fear not, though, these lakes are simpler - at least for now. The lakes we've been dealing with so far have been huge, like the American Great Lakes. But we want smaller lakes too. We need to have lakes that are small enough to fit on a single tile - lakes that aren't generated at the global level, but are created only at the regional level. We're going to make two kinds.

The first kind will be normal lakes that are basically small versions of the non-rift lakes we've already been dealing with. Like them, they will be created using templates. At the end of the river-drawing phase of the regional map generation, we'll have a chance for a lake to be pasted over the rivers that have just been created. Like the large lakes, the land will be scooped out underneath it to give it depth.

These lakes will be centred on the central "junction point" of the rivers in that tile. First we work out how close to the edge of the tile that point is, and then we choose a template that is no bigger than that, to ensure that the lake does not spill out over the edge of the tile. (If it did, it might start interacting with rivers on the next tile along, and that's a can of worms we want to keep firmly shut.) The result looks something like this:


Bearing in mind that each of those cells is 2km across, that's still a pretty big lake, but not on inland sea scale as the really large ones are.

A huge positive point about these lakes, compared to the global-size ones, is that there's no need for any more messing about with the rivers once they're done. Within a single tile like this, there can be only one river outflow. So there aren't going to be two or more rivers flowing out of the lake. So we don't have to fiddle about with the rivers to ensure that there is only one, and that means no awful problems of the kinds we've been looking at in the last couple of posts.

A second kind of small lake is the glacial lake. These parallel the rift lakes that we also created at global level. Like rift lakes, glacial lakes are generated by creating lake cells along the path of an existing river. This is quite easy to do. First, we define a region of the tile - by default the whole tile, but it may be smaller. This is to vary the size of glacial lakes. Then we go through that region, and any cells that contain rivers are turned into lake. Neighbouring cells may also be turned into lake. Finally, these lakes are made to be generally deeper than the other kind.

Where a single river passes through a tile, this method yields a long, thin lake like this:


That lake is roughly the size of Loch Ness (though it's a bit wider and not as deep), and if you look at a map of that region you can see that there are a fair few long, thin lochs knocking around:


If the area of the tile where lake is created is large, and the river has tributaries, the result is a lake that looks like this:


I think that that's quite plausible as a glacial lake too. Such lakes are created in the long, wide valleys left behind when glaciers retreat and melt, and you find them, for example, in the mountains of New Zealand:


(The area between Queenstown and Arrowtown is flat - I know as I used to drive through it often - so it's part of that same valley; imagine if the lake level were a bit higher and that area were flooded, the lake would look even more like my glacial lake.)

So I'm quite pleased with the glacial lakes.

Now we have another way of adding variation to our terrains. I have already mentioned the roughness factor, which varies across the world and is used to add some variety to the amount of displacement in terrain. Where it's high, terrain is a bit rougher and coastlines are a bit wilder. We can also say that the higher the roughness, the more likely lakes are. Moreover, we can say that in glacial regions (i.e. areas that have seen glacial action in the past, which are defined simply by temperature) there is a much higher maximum probability of lakes (and they will be glacial lakes rather than the other kind). This means that we have some areas where there might be lots and lots of lakes, with rivers running out of one and into another, often in complicated networks:


This is meant to imitate regions such as Finland:


My glacial lakes can't really rival the Finnish ones for complexity, but it's not a million miles off. The effect is particularly nice if there happen to be fjords nearby too:


It also looks rather good when such lakes appear in mountainous areas (as they often do, because those areas tend to be colder and more prone to having had glacial action). Some of these mountain lakes look like they might be very beautiful:


So there we go, a bit more variety for our landscapes. And that, I think, brings this blog more or less up to date. Unless there are any features I've forgotten about, anything more I add will be - like the last couple of posts before this one - documenting what I'm doing right now rather than describing what I've already done. So who knows where we'll be heading next...

No comments:

Post a Comment