Unit and building maintenance discussion

saamohod

Deity
Joined
Jul 22, 2014
Messages
3,116
Location
Unoccupied Ukraine
Some time ago increased building maintenance cost was implemented to counter late game gold inflation. The solution seems to be a makeshift measure that arguably served its purpose to some extent. However the issue is still there. Gold is usually abundant in mid-late game. The gold inflation is still there
Spoiler :
(I turn off tech trading because if breaks the game balance as mid-late game gold is cheap and therefore techs can be obtained cheaply)

, and now we seem to have unit inflation.

Here are my expenses in the modern era with a hundred units:

20230528193320_1.jpg


The bulk of it is the building maintenance. The other expense categories are no longer relevant. The most "unfair" part is the unit maintenance which is negligible. I see no reason for it to be that way in modern era onwards. Army is expensive, modern army is very expensive. Making unit maintenance irrelevant at this stage of the game destroys an engaging gameplay aspect were we need to find a balance between our military power and our finances.
Me fielding a hundred military units (3/4 of my current supply cap) and paying for them only 10% of my per-turn expense isn't right.

Another reason is that some international projects that reward you with a couple of free of maintenance unit slots aren't appealing anymore because the saving they offer is negligible.

Here's an obvious suggestion that comes to mind, probably another makeshift solution: Why can't we incrementally increase unit cost scaling with era? In modern era it could easily be twice as the current cost, no problem with thrice either. Fielding a large army must be afforded only by very rich civilizations, it is both fair and realistic. Now the only limiting factor is the supply cap, and a human player's reluctance to micro-manage a carpet of units.
 
My suggestion is to increase later unit maintenance costs.
Because you can see the sharp difference between building maintenance cost and unit maintenance cost.

There's already a column for that called ExtraMaintenanceCost, and I'm planning to utilize that as a modmod.

Ancient & ClassicalNo extra maintenance cost
Medieval+1
Renaissance (& Enlightenment)+2
Industrial & Modern+3
Atomic & Information+4
 
Last edited:
My suggestion is to increase later unit maintenance costs.
Because you can see the sharp difference between building maintenance cost and unit maintenance cost.

There's already a column for that called ExtraMaintenanceCost, and I'm planning to utilize that as a modmod.

Ancient & ClassicalNo extra maintenance cost
Medieval+1
Renaissance (& Enlightenment)+2
Industrial & Modern+3
Atomic & Information+4
Can I modify it myself for the time being? What file is that?
 
The DLL's inflation formula for unit maintenance could be adjusted rather than charging a flat fee for units.
 
I have to disagree with a few points made here:

  • Building Maintenance was reverted as of the last congress, so that is no longer a factor.
  • When building maintenance was high, I saw plenty of games in the late game where I started running a GPT deficit. That was with full trade routes going, AND only half my supply in units on the board. god help me what the deficit would have been had I been full on supply.
  • A lot of other nerfs to gold have happened in recent congress, I don't see the gold glut in the same amount as I once did.

the final thing about this is....its variable game to game. Now even with the notes above, I did have one game where I was swimming in gold, due to policy and civ choices, religion, and just the way that game had gone. But again, I had several other games where I was in deficit by the end game. The other factor is, gold amounts very era to era. Gold is scarce early on, and then it tends to build up in medieval, renaissance, but then gets slashed again with the high price of industrial era buildings. And finally....to me the REAL problem with gold right now is the insane AI trades. When I had get +30 GPT from a lux in the late game....well yeah you do that a few times and suddenly you have this massive gold amount and you feel like Scrooge McDuck. But if you can't make deals for whatever reason, your a pauper.

I think the first (and only) order of business for gold rebalanace at the moment is AI deals. That will remove that variable as a major gold source, and then we can see where the gold lies.
 
The DLL's inflation formula for unit maintenance could be adjusted rather than charging a flat fee for units.
DLL is hard to adjust by other modders.
This column, on the other hand, is easy to adjust.
You can make exceptions to some units (Free Company, Foreign Legion, Mercenaries, UUs, etc.)
 
Can I modify it myself for the time being? What file is that?
You have to make it yourself. I still haven't made one at the moment.
I can just make an easy SQL script now, but it will have such balance repercussions.

Because I want to combine it with reduced building maintenance costs, making growth a bit more rewarding.
 
My proposal is...
Increase vassal maintenance from 10% to 25% (so you actually have to tax instead of just having to pay a tiny bit for a lot of exotic yields).
Unit maintenance actually scales with game turns but how hard should it scale per game turn?
 
This is a quick and dirty SQL code.
I dunno about the balance for this.
SQL:
UPDATE  Units SET
        ExtraMaintenanceCost = 1
        WHERE PrereqTech = (SELECT Type FROM Technologies WHERE Era = 'ERA_MEDIEVAL') AND Combat > 0;

UPDATE  Units SET
        ExtraMaintenanceCost = 2
        WHERE PrereqTech = (SELECT Type FROM Technologies WHERE Era IN ('ERA_RENAISSANCE', 'ERA_ENLIGHTENMENT')) AND Combat > 0;

UPDATE  Units SET
        ExtraMaintenanceCost = 3
        WHERE PrereqTech = (SELECT Type FROM Technologies WHERE Era IN ('ERA_INDUSTRIAL', 'ERA_MODERN')) AND Combat > 0;

UPDATE  Units SET
        ExtraMaintenanceCost = 3
        WHERE PrereqTech = (SELECT Type FROM Technologies WHERE Era IN ('ERA_INDUSTRIAL', 'ERA_MODERN')) AND CombatClass IN ('UNITCOMBAT_FIGHTER', 'UNITCOMBAT_BOMBER');

UPDATE  Units SET
        ExtraMaintenanceCost = 4
        WHERE PrereqTech = (SELECT Type FROM Technologies WHERE Era IN ('ERA_POSTMODERN', 'ERA_FUTURE')) AND Combat > 0;

UPDATE  Units SET
        ExtraMaintenanceCost = 4
        WHERE PrereqTech = (SELECT Type FROM Technologies WHERE Era IN ('ERA_POSTMODERN', 'ERA_FUTURE')) AND CombatClass IN ('UNITCOMBAT_FIGHTER', 'UNITCOMBAT_BOMBER');
 
Unit maintenance actually scales with game turns but how hard should it scale per game turn?
Remember, people are trying to play the shortest amount of turns possible, so this is not a good measure.
 
okay, I was just going through the DLL code because I wanted to understand the formula and explain it here. While doing this, I saw that there is a huge bug there which causes the exponential scaling of unit costs (increased costs especially late-game and for players with a large military) never to be applied.

I'll fix this for the next version, it will increase late-game unit costs considerably I think.
 
Last edited:
okay, I was just going through the DLL code because I wanted to understand the formula and explain it here. While doing this, I saw that there is a huge bug there which causes the exponential scaling of unit costs (increased costs especially late-game and for players with a large military) never to be applied.

I'll fix this for the next version, it will increase late-game unit costs considerably I think.
Could you post a hotfix when ready?
 
Could you post a hotfix when ready?
here you go, save game compatible. do you still have the save game from which you took the screenshot above? how high are the costs in the fixed version?
 

Attachments

  • CvGameCore_Expansion2.zip
    3.1 MB · Views: 13
@axatin

20230528232732_1.jpg


It's increased, yes. But still not enough imho. Unit maintenance now constitutes 19% of my total expenses.

Interestingly, my trade routes yield increased slightly as well. Intended?
 
Don't know why trade route yields are increased, the bug fix doesn't affect them directly. But I'm not familiar with the details of trade route yield calculation, maybe there's some indirect interaction.
 
The DLL's inflation formula for unit maintenance could be adjusted rather than charging a flat fee for units.
That's based on game turns, not unit tier. A turn 500 warrior shouldn't cost more than a turn 400 GDR. Also, civilians should scale less, if at all.
 
A turn 500 warrior shouldn't cost more than a turn 400 GDR
It's already strange enough that turn 500 warriors can exist in the game, there shouldn't be a further incentive for having them. Also the exponential scaling that punishes large armies is not applied when using ExtraMaintenanceCost values. Changing the general scaling for all units is the better approach in my opinion.

So, what I wanted to explain before: There are two constants used in the DLL that control unit cost scaling:
  • UNIT_MAINTENANCE_GAME_MULTIPLIER - increases cost per unit with game turn - the HIGHER this number the more is paid (current value: 8)
  • UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR - this one really punishes those with a HUGE military - the LOWER this number the more is paid (current value: 6)
They can be changed in (2) Vox Populi/Balance Changes/CoreDefines.sql. To change UNIT_MAINTENANCE_GAME_MULTIPLIER, use a statement like
SQL:
UPDATE Defines SET Value = '9' WHERE Name = 'UNIT_MAINTENANCE_GAME_MULTIPLIER';
For UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR there already is such an update-statement in the file, change the value there.
 
We don't want to punish the players that are behind by giving their low-tech units equal maintenance with the leader's high-tech ones. Turn 500 warrior is an exaggeration, but it's possible to have a scenario where 50 Industrial units fight 40 Modern units, and the Industrial player loses because of the higher maintenance.

Also there are a couple of random units with an ExtraMaintenanceCost in VP. It should probably be removed or expanded to more units.
 
We don't want to punish the players that are behind by giving their low-tech units equal maintenance with the leader's high-tech ones
Good point. I think a good solution would be to make the unit scaling not depending on elapsed game turns, but on the number of technologies the player has.

Here is the formula:
Spoiler :

int iBaseUnitCost = iPaidUnits * iCostPerUnit;
// [not shown: Discount for land/naval unit maintenance applied to iBaseUnitCost]

int iGameProgressFactor = (GC.getGame().getElapsedGameTurns() * 100) / GC.getGame().getDefaultEstimateEndTurn();

// Multiplicative increase - helps scale costs as game goes on - the HIGHER this number the more is paid
double fMultiplier = 0.0f;
fMultiplier += 1.0f + ((float)iGameProgressFactor * /*8*/ GD_INT_GET(UNIT_MAINTENANCE_GAME_MULTIPLIER) / 100);

// Exponential increase - this one really punishes those with a HUGE military - the LOWER this number the more is paid
double fExponent = 0.0f;
fExponent += 1.0f + ((float)iGameProgressFactor / /*7 in CP, 6 in VP*/ GD_INT_GET(UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR) / 100);

double dTempCost = 0.00f;
dTempCost += fMultiplier * iBaseUnitCost / 100;

double dFinalCost = 0.00f;
dFinalCost += pow(dTempCost, fExponent);

// [afterwards: cost modified by inflation level, ExtraCostMaintenance added, player-level cost reductions applied ...]
We can make iGameProgressFactor be the percentage of owned technologies instead of the percentage of elapsed game turns. This would also solve this:
Remember, people are trying to play the shortest amount of turns possible, so this is not a good measure.
 
Top Bottom