yairm210 / Unciv

Open-source Android/Desktop remake of Civ V

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

City tile yield calculation

krijnsent opened this issue · comments

Version
4.1.8 + last version of the Civ 6 mod

Describe the bug
See screenshots: the tile yields calculation goes bananas sometimes when I play with this mod: the stated values in the city overview don't match the ones in the city map overview.
In this example, I have a city with a campus (tile improvement). That campus seems to be always worked (cannot unselect it), but that doesn't take a citizen in the overview. When I de-select all tiles (nr 1) the production tile yields seem to be off: that's 2 on the map, 1 in the list. If I select 1 tile (nr 2), nothing happens with the tile yields. And if I after that select 1 more tile (3a & 3b) the calculations go haywire. It might be that the mod changes default tile yields, but I expect the map overview and the list always to be equal. My suspect is that the campus tile improvement (like holy site, harbour, etc.) always gets worked but don't get deducted from the nr of citizens which causes some weird calculation errors in the city tile yields.

image

image
Bumped into this again with the latest version.
As an addition, I just spotted this: this city of mine has 4 population and a harbour district that is always worked. As you can see in the city tiles, there are 5 tiles selected, 4 of which with a citizen icon and one without. My hunch is that this is causing the miscalculation of yields. Note e.g. that the city shows 2 production, whereas the tiles show 5 production. Counting the "tile the city must work" as one citizen (so only 3 tiles to work show up) might solve this miscalculation (hunch).

So you should ave a game save that you can give, yes?

Sure, completely forgot that. I tried replicating that one, but couldn't as it seems to be a bit more random. I found a rather easy test case for the same problem though. This is the save file in my dropbox:
https://www.dropbox.com/s/h7o3d9w5p7q1mzq/UNCIV%20Poland%20-%20129%20turns%20BEFORE%20HARBOR?dl=0
Unciv6 mod & Tyretes Tileset & Barbarian XP farm used.

Focus on Wroclaw, that is about to finish a harbour next turn. I fixed the 4 worked tiles so they won't change. The issue is quite easy to spot, if you load the game, you'll see the population & nr of turns till next population growth, but that changes every time when you load the file. What I did: load file, click next and wrote down the pop & pop growth numbers:
4-7 -> 4-10 (so on load: pop 4, growth in 7, click next turn, pop 4, growth in 10)
4-7 -> 4-10
4-7 -> 4-4
4-7 -> 4-4
4-7 -> 4-4
4-11 -> 4-4
4-7 -> 4-10
4-7 -> 4-4
4-11 -> 4-10
There seems to be no consistency in the results, but the 4-11 is wrong, as is the 4-10. It is probably not random, but there is some external factor influencing this calculation it seems.

Here's the drilldown between them:

image

image

So we can see that despite there being 10 food yield in all tiles, sometimes the final result is a 9, which leads to everything else.

I'll see if I can see what's up with that.

Looks like on the ocean/reef tile the reef stats are overriding the ocean stats instead of getting added to them
Extremely odd, I'll see if I can debug this

This resulted from checking conditionals before caching uniques, instead of caching them all and checking conditionals on each tile - also solved other similar issues, will enter next version

Super! Thanks