Extra shields (and extra trade) (SOLVED)

Mize

Prince
Joined
Jun 17, 2011
Messages
415
I don't believe I've seen a thread around here about this, or anywhere for that matter, so... Has any of you also noticed that under a republic or democracy celebrating cities will generate an extra shield every turn?

I first noticed this years ago when my large trade cities would still manage to pop a caravan every 50 turns, even though they had low production and generated no extra shields after unit support.

This has the funny side effect of screwing up your city menu predictions. Let's say your city generates 9 shields and you're building a caravan. The menu will say it'll take 6 turns, but if the city is celebrating throughout, it will actually take 5 because every turn a shield will be added.
 
I'm necroing my 2-year-old thread to correct myself (and possibly generate an actual discussion). The extra shield phenomenon is apparently not due to cities celebrating, but rather due to trade overflow. With trade multipliers like markets, libraries, etc., AND with Civ's way of rounding fractions down, cities will effectively 'lose' halves of coins/bulbs/diamonds. I suspect that when the 'lost' trade derivatives reaches a certain per turn threshold, Civ turns that into a shield. What that threshold is, and whether it uses only coins or all trade derivatives, IDK. But the threshold should be either 1 or 2.
 
The thing is I'm not certain yet, but I'm pretty sure a simple test for it can be devised. You need to avoid foreign trade routes in the city you're using for the test so that fluctuations in the AI cities' trade don't affect your own arrow count. Then you need to establish trade routes with one or more of your own cities, which you can micromanage in order to raise or lower Testtown's trade output as much as you need to. Keep the production constant, do the math and see when the phenomenon pops up. Maybe I'll have time to test it this weekend and come back with proof or denial.
 
Yet another thread necro for the solution.
The answer was deceptively simple, and, of course, it had nothing to do with trade or celebrations.
It's the fortified units in the city.
The way civ sometimes kind of 'archives' units when they're fortified in a city apparently also makes the game forget that some of them need support shields.
The moment I unfortify the defenders of a city that experiences this phenomenon, it starts producing the amount of shields it should.
 
Yet another thread necro for the solution.
The answer was deceptively simple, and, of course, it had nothing to do with trade or celebrations.
It's the fortified units in the city.
The way civ sometimes kind of 'archives' units when they're fortified in a city apparently also makes the game forget that some of them need support shields.
The moment I unfortify the defenders of a city that experiences this phenomenon, it starts producing the amount of shields it should.

Game does calculate units in 'archive' fields for "total units supported by a city" variable, so game should calculate shield consumption for them correctly.

I tested game with 2 militias in "archive fields" + 1 normal militia (3 total). City has size 2 under despotism and produce 1 shield per turn. Game indeed properly counts militias in "archive fields", so +1-1 = 0 shields, as expected, no any production forever...

Also game moves units from 'archive' state into normal state every time when city screen is open, game can't even draw units in 'archive fields' properly on the city screen, but game doesn't need to do this because they already was moved. But game returns units back into 'archive state' after city screen is closed, if no any enemy units are around.

What version do you play? My investigation and tests are for .05. Maybe in .01 game does not count archived units for city unit counter (and because of that, for used shields)?
 
Last edited:
I also play v.05. What I describe only happens sometimes and I still can't put my finger on it. But apparently it is the units. Here's a save.
OCC, Emperor. Shanghigh produces 27 shields and supports a chariot and a phalanx. It should and would add 25 shields to the production box... until I fortified the chariot in the city a couple of turns ago (it was only sentried before). Now I get 26. Simply ending the turn should give you 26 instead of the proper 25 shields. Unfortifying should give you 25.
 

Attachments

  • CIVIL3.MAP
    13.1 KB · Views: 27
  • CIVIL3.SVE
    37 KB · Views: 23
You are right and I'm wrong. Game does not calculate shield support for archived units correctly!

These units indeed increase "units supported by a city" variable, but normal rules for calculation of other variables (unhappy faces, consumed shields and supported settlers) do not apply to them! These rules are working only in a 128-units loop for normal units. There's only one pretty strange rule for "archived" units:
if (city_size < city_supported_units)
then consumed_shields = city_supported_units - city_size;

In my test, city size is 2 and city_supported_units at the moment is 2 (not 3, because archived units are counted before normal units). So, consumed_shields = 2-2 = 0 anyway! after this strange formula. But at least game already knows that city already supports 2 units, so game does increase shield support under despotism because of this rule in 128-units loop:
if (city_supported_units > city_size or govt > 1) -> then increase consumed_shields by 1;
That's why everything looks ok under despotism in my test. But under >= monarchy, consumed_shields will be 1 instead of 3! Same problem with your save file.

So archived units are... pretty profitable. And to archive unit, you should F it when no enemy units are around and city already has 1 fortified unit.

Interesting... Did anybody know this trick before? I usually S my chariots instead of F... From now on, I should F them.
 
Last edited:
I've been sounding the alarm on this for a few years, but I couldn't really find anyone else discussing it here, that's why I originally made the thread.

Fun fact: while fiddling about with the trade arrows before I discovered the units were causing it, I discovered that the game gives you extra trade arrows too, a whole new adventure!

In the save file I posted, Shanghigh, with the Colossus still active, generates a total of 102 trade arrows from 9 ocean squares (9*4=36), 3 railroaded grassland/plains squares (3*4=12), 8 grassland/plains squares with only a road (8*3=24) and 30 more arrows coming in from trade routes. That's 102. F1 screen, however, shows it makes 105. Now the question is: where do these arrows come from and are they used in the bonus calculations for markets, libraries, etc.? I have a theory, but I'll keep it to myself before I get some proof.
 
There's can be some discrepancy between real city logic and report screens. I know that in F5 screen you've got nothing from <DISORDER> cities, but actually cities in disorder still produce science, but not money. So there's can be wrong number of turns for discovery. Also F5 screen ignores +100% bulbs effect on Chieftain if some other civ already knows your current researching tech (but not +50% bulbs SETI effect). Maybe in F1 screen game calculates something different from actual city logic? EDIT: F1 report just calls "city calculate everything" function for every city, nothing more. Everything should be ok at first glance.
 
Last edited:
The extra trade arrows start appearing early enough in city development for me to be able to visually count them in the city screen. Unlike the ghost shields, they are properly displayed both in the city screen and in the F1 screen. Their count also matches the total count of diamonds+coins+lightbulbs without trade improvements. I believe the extra arrows start appearing when you have trade routes, but I cannot verify this yet.
 
Ah, so both city screen and F1 are correct, but it's not comply with manually counted arrows. Understand now. Well, this means game actually calculates arrows not exactly like you count them. Yes, I too believe that trade routes can be the reason for this.
EDIT: When game draws info about trade routes on the screen, it does NOT use real data again (it doesn't even save this data). Instead, it re-calculates profit from trade routes - just to show it, and apparently game does it not correctly this time and this info (shown on the screen) can be different from actual profit from trade routes.
 
Last edited:
We make a good team, even though I know next to nothing about coding and disassembly.
My initial theory was that it gave you an extra arrow for every route, but I quickly eliminated that option.
Maybe it has something to do with the separate calculations the game does before and after applying corruption? If the INFO tab shows trade after corruption, but the game actually uses trade before corruption in the RESOURCES box, additional trade makes sense.
Anyway, as long as the game is giving me shields and trade, and not taking them away, I don't mind.
 
Problem here:
addition of trade units for every trade route happens this way: total_trade = total_trade+(base_trade_of_other_city + total_trade+4)/8 (or /16, if other city is yours)
Instead of total_trade, logically, there's should be base_trade of your city here: total_trade = total_trade+(base_trade_of_other_city + base_trade_of_your_city+4)/8 (or /16).

But because we have total_trade here instead of base_trade, 1) its value increases with every trade route and 2) it's actually not affected by corruption! (only base_trade affected by corruption: your_city_base_trade = total_trade-corruption; at this stage, total_trade is only trade units from cultivated city squares).

And on the city screen you see info according formula: (base_trade_of_other_city + base_trade_of_your_city + 4)/8 (or /16). It's always same or lower than actual profit from this trade route.

Hex fix can be pretty simple (we need to replace total_trade with base_trade), but who in the right mind want to refuse these sweet undocumented bonus arrows. But fix other way around (same real logic, but also correct data on the screen) is not easy.
 
Last edited:
Top Bottom