Open jwrober opened 11 months ago
Let me add to the mix the government help, that usually reads as:
- Each city can support up to 2 units for free; further units each cost 1 gold per turn.
Not all units have the same upkeep in the help.
Summarizing what is shown:
utype->upkeep
and utype->happy_cost
punit->upkeep
for food/shield/gold (unit_upkeep_astr
in common/unit.cpp
)When computing upkeep (city_units_upkeep
in server/citytools.cpp
), the cost of each unit is calculated in utype_upkeep_cost(utype, player, output_type)
. This works as follows:
utype->upkeep
EFT_FANATICS
is active, upkeep is zeroed outUTYF_SHIELD2GOLD
flag and the effect EFT_SHIELD2GOLD_FACTOR
is > 0:
EFT_SHIELD2GOLD_FACTOR
EFT_UPKEEP_FACTOR
Every city gets free support for a number of units. This is controlled by EFT_UNIT_UPKEEP_FREE_PER_CITY
.
Sim05 numbers for EFT_UNIT_UPKEEP_FREE_PER_CITY
:
Government | Gold | Shields | Food |
---|---|---|---|
Anarchy | 99 | 99 | 100 |
Tribal | 99 | 99 | 100 |
Despotism | 2 | 2 | 6 |
Fundamentalism | 2 | 1 | 6 |
Communism | 2 | 1 | 3 |
Monarchy | 2 | 1 | 5 |
Others | 0 | 0 | 3 |
Cities get one more free unit free of food support at even sizes between 2 and 30 except at size 10.
Sim05 has two effects with EFT_SHIELD2GOLD_FACTOR
, one for Raiders and one for Bowmen. They are irrelevant for the current case.
From the numbers above and the issue description, we are in the "Others" case with two units free of food upkeep, not costing any shields (even in the base upkeep) but costing one gold each. A similar logic must explain the lack of unhappy citizens.
:arrow_right: Unit upkeep is more complicated than can be represented in the unit type help summary :arrow_right: What is shown is (most likely) correct :arrow_right: Suggest to reclassify as a doc bug (documenting the above logic) or GUI feature request (for more detailed explanations)
@jwrober thoughts on the above analysis?
The challenge is that is really hard for a regular player to fully understand this when looking at units in the city dialog. What if we add some kind of extra text to the pop up when hovering over a unit? Something similar to what we do on the citizens tab in city dialog. The text would give upkeep information taking into account the varying effects from Government, Wonders, Improvements, etc.
Sounds like a good idea
Heck add UWT to the text while we are at it
Heck add UWT to the text while we are at it
Good catch. Yes I think that is it.
Describe the bug Client doesn't properly show unit upkeep in city dialog.
To Reproduce Steps to reproduce the behavior:
Expected behavior Upkeep icons and proper stats shown
Screenshots
Platform and version (please complete the following information):
Additional context None