Solving the mystery: Unit Maintenance

Status
Not open for further replies.
What? Older units cost more? So not only do you have to keep deleting workers to save cash, but you have to delete your oldest workers and save the newly conquered? Without a way to look up unit age, this is a horrible mechanic.
 
It would be far better for the 1/2 to happen at the end of the formula.

It would also be far better if unit costs were like buildings.. different units cost different amounts, and that cost was constant throughout the game. (maybe *2 if obsolete or something like that)

Agered, except I'm not sure why obsolete units should cost you MORE gold.

But it would be much better if a Mech Inf cost X maintenance, a Knight cost Y, and so forth.
 
Given that Civ5 was designed to encourage players to hang on to old units, it seems very weird for old units to drag your economy more. The coolness of a Spearman->Pikeman->Rifleman guarding a mountain pass for 3000 years is gone when I have to keep killing/rebuilding him to save gold.
 
Given that Civ5 was designed to encourage players to hang on to old units,
How so?
Its designed to encourage you to preserve units and upgrade them, not to hang on to old units.
 
Maybe rising age costs are a way of balancing just how uber units which have been continually promoted can get. The upgrade costs are far lower than in civ iv. Not saying I agree with the decision, but it would make sense.

As far as the supply thing goes, I would imagine there is an upkeep penalty if you go over the supply limit.
 
Preserving units and upgrading means you're keeping old units. Unless upgrading resets their age value.

A new rifleman shouldn't cost less than an early warrior turned spear>pike>rifle. If they wanted to mimic this in a much more reasonable manner, there should be a cost modifier for xp level (older units are likely to be more promoted), NOT unit age directly.
 
Maybe rising age costs are a way of balancing just how uber units which have been continually promoted can get.
Except that the AI isn't very good at preserving units, so it won't have such highly promoted units, but it will still suffer the maintenance.
It seems to depend on game turn, not unit age. A new unit produced on turn 200 has the same maintenance as an old unit that survives to turn 200.

The supply limit is so high relative to productive capacity and unit costs that I have never even come close.
 
It doesn't depend on the age of a particular unit. I've tested it and that's false.

The values of relevance are UNIT_MAINTENANCE_GAME_MULTIPLIER, set to 8 and UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR set to 7. I was wrong about the 1.01 exponent, that seems to apply to something else.

I played around with the values. I tried using a multiplier of 100000 and an exponent divisor of 1, disabled unit disbanding due to lack of gold and started a new game.

Even with a crazy multiplier I still only started with 0 unit cost in maintenance. Then on turn 1 I got 203 gold in unit maintenance cost. I tried with a multiplier of 10000 and it didn't give 1/10th the maintenance. Whatever that number is, it doesn't work that way.

Then I got 410, 624, 845, 1072, 1307, 1550... It increases each turn. The age of the unit doesn't matter. Deleting an old unit versus a new unit gave the same maintenance. It also doesn't increase by a set amount per turn. Rather, the cost accelerates slightly each turn.

Another interesting behavior: having 2 units doesn't cost 2x a single unit. It costs slightly more. It cost 2.02x in my case.

Now my "exponent divisor" was 1 so in a real game it wouldn't necessarily behave exactly the same way. But I think the general idea would stay the same: units cost slightly more every turn that passes in the game, and every additional unit increases the maintenance per unit slightly.

I think that's why the UI doesn't indicate a cost per unit. There isn't one if each additional unit costs a little bit more. The math behind unit maintenance is so obtuse you would need a calculator on hand to really figure out how much x units is going to cost you on a specific turn.
 
So, if i understand correctly, theres basically an inflation mechanic in place. Unit upkeep rises over time? I guess that would make sense as a way of preventing exponentially rising army sizes as gold per turn rises (in addition to supply)

By some accounts perhaps this still needs a little balancing though.

I guess they chose this instead of rising costs for more advanced units; a base per unit value increasing over time.
 
I think that's why the UI doesn't indicate a cost per unit. There isn't one if each additional unit costs a little bit more. The math behind unit maintenance is so obtuse you would need a calculator on hand to really figure out how much x units is going to cost you on a specific turn.

Which is Really, Really Bad.
 
Actually I think I can get the actual real game curve by fiddling with INITIAL_GOLD_PER_UNIT_TIMES_100.

You start out turn 0 with a unit maintenance of 0.5 (rounded down).
Each turn after, that one unit will cost you about 0.009 more gold per turn (on standard speed). So i get 0.5, then 0.508, then 0.517, 0.527 and so forth. After 50ish turns that unit should no longer be free.

Every extra unit tacks on an extra 0.005 gold per unit added, roughly, on top of the doubling of unit maintenance for having 2 units.

I only did the first 15 turns, but early on that's how it behaves.
 
Which is Really, Really Bad.

Yeah, lack of transparency isn't good, but it seems to be a civ v theme.

I can't ever see us getting a detailed breakdown given this system. A rounded down figure based on category would be nice (and probably doable, hopefully?), if only to see your upkeep of workers versus real military units.
 
Set my terrain tiles to give 100 hammers each so I could test with more units. The cost penalty for having more units get worse as you add more units. So it's not 0.005 per additional unit added. More like a log curve.

This seems to fit pretty closely and matches a random savegame I pulled:

unit maintenance = (0.5 + turns * 0.009) * units * ( 1 + ln( units ) / 26 )

I know, it's incomprehensible. They might have a simpler version of this formula, but that roughly matches.

I think the general principles are more important than the exact computation.

* Inflation increases the cost of all units every turn
* Bigger armies are less efficient in cost per unit than small armies
* Some rounding error is causing every odd unit to not increase maintenance
 
Yeah, lack of transparency isn't good, but it seems to be a civ v theme.

I can't ever see us getting a detailed breakdown given this system. A rounded down figure based on category would be nice (and probably doable, hopefully?), if only to see your upkeep of workers versus real military units.

Of course Civ IV vanilla was very opaque, and got more transparent... hopefully they will do so with this as well.
(Although making this complex formula more transparent would probably require replacing it with a simpler one)

Straight (Hammer Cost of all units)/50 should work fine
 
I find it hilarious that this mechanic is so complicated when there are loads of threads about how everything in CiV has been dumbed down. It feels like they let their math major intern spend a month designing inflation models, but let the janitor come up with the trade route calculations after a night of drinking.

In the absence of a calculation that can be quickly worked out, are there a few general guidelines we can take away from what's been observed so far?

Unit cost rules of thumb:
1. If you have an even number of units, go ahead and build another one because it won't increase your monthly cost.
2. If you need to make cuts because you can't afford your army, cut down until you have an odd number of units.
3. If you're breaking even financially this turn, you'll inevitably fall into negative cash flow unless you decrease the size of your army, find a way to reduce costs, or increase your gold income. Either work towards a solid monthly income early or put that army to good use razing and pillaging to offset the eventual GPT decline.
 
This mechanic doesn't add to depth of the game and doesn't increase the complication of it so it can't be an argument in the discussion whether the game was dumbed down (religion would be a one better topic of such a discussion). It's just hidden from players ******ed bugged mathematics full of programming errors that makes people CONFUSED about it what causes all those threads to appear.

You can't really plan for your army cost in future, all you can do is build units and then maybe disband a few workers if you've overdone it. This removes a whole strategic aspect from army-building process making it more guesswork than anything. Which means this actually is an element of dumbing down the game more than element of making it more challenging - because it stops people from planning many turns ahead and thinking strategically and instead just has them guessing.
 
Poking around in the XML solved one part of the mystery.
The reason people keep reporting that every other unit deleted reduced their maintenance is this (I believe):
After applying some (unknown) formula based on game speed, number of turns elapsed, and number of units, the result is then rounded down to the nearest multiple of 7. This is the "exponent divisor value." Every other place that the word "divisor" is used in the XML, it's in this context (for example, the policy cost divisor is 5, they are based on a formula and then rounded down to the nearest 5).
So it seems that the reason that deleting 2 units tends to make it go down by exactly 7 some of the time but not always depends on the amount of maintenance. If your unrounded maintenence is 48 (rounds to 42) and you maintenance per unit is 5, you have to delete 2 units to see a change in maintenance, but deleting one more unit after that makes it change again! The number is inconsistent because 5 does not divide into 7.
I'm willing to guess that unit costs remain between 0 and 7 for most of the game, if not all of it, which explains why sometimes you can delete a unit and not have any change in maintenance.

By the way, 2 units costing 2.02 times as much is likely just a rounding issue. If you have one unit that costs 7.6, it will round it DOWN to 7. If you have two units costing 7.6, it adds up to 15.2 and then rounds to 15. The ratio will not be exactly two because the fractions are dropped after all of the cost is added up.

To anyone wanting to figure out the formula, the easiest way would be to set the divisor to 1 so you can actually see it changing in amounts smaller than 7, use Tuner to give yourself a huge number of units, then record the amount of maintenance on each turn for a few dozen turns (please keep in mind the game speed makes a difference). If you want to, send me the results you obtain and I'll figure out the formula (I have a math background and love this kind of stuff, I just don't really know how to use Tuner and don't have much interest in pressing end turn 100 times to get a decent sample).
 
Poking around in the XML solved one part of the mystery.
The reason people keep reporting that every other unit deleted reduced their maintenance is this (I believe):
After applying some (unknown) formula based on game speed, number of turns elapsed, and number of units, the result is then rounded down to the nearest multiple of 7. This is the "exponent divisor value." Every other place that the word "divisor" is used in the XML, it's in this context (for example, the policy cost divisor is 5, they are based on a formula and then rounded down to the nearest 5).
So it seems that the reason that deleting 2 units tends to make it go down by exactly 7 some of the time but not always depends on the amount of maintenance. If your unrounded maintenence is 48 (rounds to 42) and you maintenance per unit is 5, you have to delete 2 units to see a change in maintenance, but deleting one more unit after that makes it change again! The number is inconsistent because 5 does not divide into 7.
I'm willing to guess that unit costs remain between 0 and 7 for most of the game, if not all of it, which explains why sometimes you can delete a unit and not have any change in maintenance.

By the way, 2 units costing 2.02 times as much is likely just a rounding issue. If you have one unit that costs 7.6, it will round it DOWN to 7. If you have two units costing 7.6, it adds up to 15.2 and then rounds to 15. The ratio will not be exactly two because the fractions are dropped after all of the cost is added up.

To anyone wanting to figure out the formula, the easiest way would be to set the divisor to 1 so you can actually see it changing in amounts smaller than 7, use Tuner to give yourself a huge number of units, then record the amount of maintenance on each turn for a few dozen turns (please keep in mind the game speed makes a difference). If you want to, send me the results you obtain and I'll figure out the formula (I have a math background and love this kind of stuff, I just don't really know how to use Tuner and don't have much interest in pressing end turn 100 times to get a decent sample).

In an epic speed game you have unit costs like this 0 -> 1 -> 1 -> 2 -> 2 -> 4 - so not even near multiples of 7.
 
Hmm.. yeah there's something else going on.
The things says exponent divisor which suggests that the divisor is only applied to the exponential part of the equation.

Quite a lot of the formulas I've run into are of the form:
A+(B*n)^C
n is usually something that varies through the game (number of policies, number of tiles, etc) so in this case it could be number of turns.
If there's a divisor just on the exponent part, that would suggest that you are adding the number A to some multiple of 7. But it really doesn't explain why deleting a unit sometimes causes no change in the amount.

Unless the n in the exponent is based on the number of units (which would probably make A a negative number that increases as the turns progress, else you'd have maintenance costs with no units at all).
It's possible that B is constant, n is the number of units, and A and C both vary with number of turns and game length.

Quick question, has anyone every had a their maintenance change by a factor other than 7 (but not to zero) when they deleted units? It seems that every tiem I delete a unit, the maintenance goes down by 7 or not at all, but the actual maintenance is not in units of 7 because of this A which may be negative.

Of course, this may be the wrong formula entirely.
 
Status
Not open for further replies.
Top Bottom