Custom map scripts: changing grain leads to broken rivers

Joined
Apr 11, 2015
Messages
438
[Version: 1.0.0.341]

I've been trying to create new map scripts and have noticed a problem that happens when changing the default grain value of the vanilla game's maps.

There are two issues that occur:

1) Rivers will flow into single tile lakes. Often these rivers don't have a name.

2) Rivers won't have names, including rivers that flow into oceans. If rivers don't have names, then it's unknown whether they will get floodplain events or whether Dams can be built on them.

This issue is not rare. Every map script I've tried, such as Pangaea, Splintered Fractal and Fractal, will lead to occurrences of this issue and there are instances on every map I've generated. The issue occurs whether the grain value is lowered (chunkier) or raised (snakier).

For example, here's a couple of examples from the Pangaea map script.

Here are the original bits of code from the map script that I've changed:
Code:
    local grain_amount = 3;

...

            if grain_dice < 4 then  
            grain_dice = 1;  
        else  
            grain_dice = 2;  
        end

...

            if iNumBiggestAreaTiles >= g_iNumTotalLandTiles * 0.84 then
...
    local continent_grain = args.continent_grain or 2;

Here's what I changed them to:
Code:
    local grain_amount = 4;
...

            if grain_dice < 4 then
            grain_dice = 3;
        else
            grain_dice = 3;
        end
...

        if iNumBiggestAreaTiles >= g_iNumTotalLandTiles * 0.1 then
...
        local continent_grain = args.continent_grain or 4;
Here are a couple of screenshots. Firstly, a river with floodplain going into a single tile lake. Notice that the river has no name displayed in the tooltip infobox:
Spoiler :
SJWt9ld.png

Here's a river with floodplain and no name going into ocean:
Spoiler :
d96bMPo.png
 
Last edited:
Wait, I'm confused about this.

I just tried the unaltered vanilla Fractal map and I have an unnamed floodplain river.

I started a game, revealed the map, and saw an unnamed river. I then spawned a unit next to it, in case it didn't have a name because it hadn't been discovered, and still no name. I moved the unit and progressed to the following turn to be sure, but still no name.

Spoiler :
n41hd4P.png


Shouldn't all rivers have names, especially floodplain rivers? What's going on here?
 
I had an idea.

How many river names are there? Could the reason that there are rivers without names appearing be because there are not enough names?

Presumably, the rivers have Civ-specific names. By revealing the map at the start of the game, that might use up all the river names for the player's Civ. So the rest of the rivers don't get names. Maybe other Civs can give them names from their own rivers list when they discover them.

So maybe these unnamed rivers still work as normal, and can get floodplain events, if on a floodplain.

If that's the case, then that just leaves the rivers flowing into tiny lakes issue. I'm a bit curious about whether this issue occurs on the standard maps. Has anyone experienced rivers flowing into tiny (e.g. single hex) lakes with the standard maps?

If it doesn't happen on the standard maps, I'm wondering what it could be that prevents it from being so, since it occurs when grain is raised or lowered on custom maps.
 
So far as I knew and tested:
A river is named once a unit from a major civ found a tile adjacent to it (actually, an edge of the river). Before having a name, the river does not flood.
River name can be "borrowed" from civ not in the game, I played a huge map and used cheat to give my scout unlimited movement point, visit all tiles, still did not run out of river name.
You should open WorldBuilder to check your map if possible, rivers have some sticky rules, including:
- No more than 1 flood plain "zone" on the same same river.
- The flood plain "zone" should be "continuous" (not separated by non-flood plain tiles) or the game may misunderstand they are more than 1 flood plain zone.
... many other rules I can't remember.
Hope it help.
 
So far as I knew and tested:
A river is named once a unit from a major civ found a tile adjacent to it (actually, an edge of the river). Before having a name, the river does not flood.
River name can be "borrowed" from civ not in the game, I played a huge map and used cheat to give my scout unlimited movement point, visit all tiles, still did not run out of river name.
You should open WorldBuilder to check your map if possible, rivers have some sticky rules, including:
- No more than 1 flood plain "zone" on the same same river.
- The flood plain "zone" should be "continuous" (not separated by non-flood plain tiles) or the game may misunderstand they are more than 1 flood plain zone.
... many other rules I can't remember.
Hope it help.
Thanks for the info.

Interesting that it kept giving river names with your scout. It's strange that revealing the map leads to rivers not being named, even if a unit is spawned next to the river. It's happening with the vanilla maps, though, so I no longer think it's a problem with my map script.

Since it's a random map script, I don't think WorldBuilder would be applicable.
 
Back
Top Bottom