Sunday, March 10, 2019

Bits and bobs

Some small tweaks and improvements.

Varying glacial crinkliness

First, a bit more variety to the fjord routine. At the global map creation phase, the program extends mountain ranges out to sea in areas where it's cold enough for glacial action to have occurred in the past; this is meant to simulate the carving of fjords. At the moment, it extends them out by two tiles. I've changed it so that it will always extend them out by at least one tile, and the probability of extending them a further tile varies according to the roughness map. That means that some glacial coasts will be crinklier than others:




I think that makes them a little more interesting and believable.

Where did the islands go?

Way back when I was talking about global map generation, I noticed something odd. I use a flood fill technique to remove all areas of sea that aren't connected to the main ocean, and illustrated this with the following before and after images:



The flood fill did indeed remove all those annoying areas of sea - but it seems to have taken a lot of innocent islands with it! What happened?

I realised that there's some kind of confusion with the two world maps (one with mountains, one without). When the mountains/islands are made, land is placed under them on the no-mountains map, but not on the with-mountains map. The sea flood fill looks at the mountains map. So it thinks that those islands are sea, and gets rid of them.

Rectifying the problem makes the world map I'm looking at right now go from this:


to this:


Well, I had wondered at some earlier stage why not many islands were appearing, and kept upping the numbers being generated to try to force more. Now that mystery's been solved, perhaps it's time to dial back the island generation a tad...


That's a little bit more like it. Note that doing this has actually shrunk some of the continents: I'm not quite sure what's happened there, but a lot of that land must have consisted of overlapping islands and filled-in sea. Reducing the number of islands has broken them apart. (Also note that truly epic lake in the north of the largest continent - that would dwarf Lake Superior!)

It does mean we get more groups of small islands that look like this:





And I quite like those.

More natural monsoons

When describing the rain modelling, I explained that monsoons are calculated roughly. It would take forever to calculate the monsoon strength on every land cell, so the program instead calculates it for just a sample, and creates blobs of monsoon to compensate. These blobs are circles, and they can result in rather unnatural climatic patches:


They don't look great at the regional level either:


The solution to this is fairly straightforward: instead of making circular blobs, we'll just use some irregularly-shaped templates. Luckily I've already got a bunch of those - they are used for making the small lakes. All I have to do is repurpose some of that code, and this is the result:



Not perfect, but a little better at least.

Getting rid of the seam

One little routine at the end of the global terrain phase involves shifting the map left or right so that the eastern/western edges of the map come in the middle of the widest part of ocean - or, failing that, so that the minimum possible amount of land has to wrap across the edges. This generally makes the maps very nicely centred. But it's got some kind of glitch that causes the "original" edge to be visible as a vertical trench or seam on the finished map. This doesn't look good:


It's not great at the regional level either:


Close investigation of the shifting routine reveals no problems. I think it may be a flaw in the original continents generating routine, where for some reason they don't get drawn on either the left-hand edge or the right-hand edge of the map. But I can't find where that's happening, either.

The solution: another bodge. It's easy to add a routine that, after shifting the map, goes down the seam and makes each cell the average height of its neighbours to the immediate east and west. This gets rid of the sea trench, but it does still cut through the mountains:


Why is this? Because there's a stage of the global terrain generation that removes any mountains that are over sea (just to be on the safe side). Clearly that's removing mountains that are over this trench, before the map gets shifted (and the trench with it). I tried moving the shift-and-bodge to earlier in the whole global terrain creation phase - so it comes immediately after the unconnected seas are filled in, before the mountains get added to the map - and while that seemed to fill in the mountains to a certain degree, the general area just looked worse:


It's blockier around the coasts near where the seam was, and there's still something not quite right about the mountains over the seam itself. I think that something or other isn't getting properly shifted.

An alternative solution is to keep the shift-and-bodge where it was, at the end of the global terrain generation phase, but add an extra bodge to put new mountain ridges over the trench where mountains exist to the east or west. This results in the following:


Not perfect, but not totally implausible either. The trench seems to have turned into a sort of mountainous river valley. Let's just look at the river map for the region...


...and clearly something's very wrong with that river in what was the trench. It's trying to flow north and south at the same time and never reaches the sea. This must be because the shift-and-bodge occurs after the depression-filling routine, and therefore there may be depressions there, which screw up the rivers.

So, I move the shift-and-bodge to immediately before the depression-filling, and this is the result:



And that, I think, now looks OK.

No comments:

Post a Comment