Unit upkeep inflation currently affects manpower and metal upkeep, not just money — is this intended?
Posted: Sat Oct 24, 2026 1:15 am
Hi everyone,
I've been digging into the upkeep code (`Unit.BSF` and `Faction_Recruitment.CalcUpkeep`) and found something that looks like a mismatch between design intent and actual implementation. I'd like to check whether this is intended.
What the comment says it should do
The function's own comment is explicit:
So the intent is clearly money only.
What actually happens in `Faction_Recruitment_CalcUpkeep`
The result is added to a shared `localCoeff`:
Because `localCoeff` feeds all three coefficients, `Unit_UpkeepInflationCoeff` ends up affecting money, manpower, and metal upkeep.
Questions
I've been digging into the upkeep code (`Unit.BSF` and `Faction_Recruitment.CalcUpkeep`) and found something that looks like a mismatch between design intent and actual implementation. I'd like to check whether this is intended.
What the comment says it should do
The function's own comment is explicit:
Code: Select all
// UPKEEP INFLATION COST
// This does not apply in balanced or easy difficulty for human
// Some units are costlier ([b]in money only[/b]) for each unit on map beyond the first (buying and upkeeping)
// To avoid checking the index of the unit (to get a formula identical to the inflation cost from buying)
// We multiply inflation cost by total unit count, but we then divide the result by 5
// The breakpoint is at 20 units, before, this formula favors the faction, so it should be 'kind' enough most of the timeCode: Select all
extraPerc = GetUnitInt(unitID, $UNIT_MONEYINFLATIONCOST);
...
extraPerc = DivideAndRound(extraPerc * count, UPKEEP_INCMONEY_DIVIDER);The result is added to a shared `localCoeff`:
Code: Select all
localCoeff += Unit_UpkeepInflationCoeff(unitID);
...
moneyCoeff = localCoeff + CallFunctionInScenario(...TRUE, FALSE, FALSE);
manpwCoeff = localCoeff + CallFunctionInScenario(...FALSE, TRUE, FALSE);
metalCoeff = localCoeff + CallFunctionInScenario(...FALSE, FALSE, TRUE);
moneyCost = DivideAndRound(moneyCost * moneyCoeff, 100);
manpowerCost = DivideAndRound(manpowerCost * manpwCoeff, 100);
metalCost = DivideAndRound(metalCost * metalCoeff, 100);Questions
- Is it intended that same-template inflation affects manpower and metal upkeep in the actual upkeep settlement (`Faction_Recruitment_CalcUpkeep`)?
- If the intent is money-only, would the fix be to add `Unit_UpkeepInflationCoeff` only to `moneyCoeff` rather than to the shared `localCoeff`?