44

Question says it all. I know vaguely what is going on, but want something specific.

Edit: Here's some "interesting" values in the GlobalDefines.xml file. No idea at this point what they mean.

  • INITIAL_GOLD_PER_UNIT_TIMES_100 50
  • INITIAL_FREE_OUTSIDE_UNITS 3
  • INITIAL_OUTSIDE_UNIT_GOLD_PERCENT 0
  • UNIT_MAINTENANCE_GAME_MULTIPLIER 8
  • UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR 7
2
  • Time to earn my Investor badge, I know someone here can come up with a good explanation of how this works before the Civ Fanatics guys can...
    – bwarner
    Commented Oct 6, 2010 at 20:09
  • 1
    I think the upcoming patch is supposed to make this clearer as well. If nothing else the "Economy - Fixed bug where players could disband a single unit, and not see the economic return until disbanding 1 more." bug they listed. Commented Oct 18, 2010 at 5:40

6 Answers 6

37
+100

Short answer: Maintenance is a function of the turn and the number of units. The function resembles a third degree polynomial for both variables.

Advice for keeping maintenance low: Don't keep a lot of units, as each new unit costs more than the last. If you are going to have a lot of units, have them early in the game, where the costs are still bearable.

Maintenance, with 3rd degree polynomial trend line

Analysis: I tried to edit the global settings as bwarner suggested. Here is what I found:

Turn  Units   MULTI   DIVISOR Maintenance cost
46    10      0       0       0
46    10      1       1       6
46    10      20      0       0
46    10      20      1       18
46    10      20      2       16
46    10      20      3       15
46    10      20      20      14
46    10      100     1       73
46    10      10000   1       10005
46    10      100000  1       123533
46    10      1000000 1       1526640
46    10      1000    1       818
47    10      1000    1       847
48    10      1000    1       878
49    10      1000    1       909
50    10      1000    1       941
51    10      1000    1       973
52    10      1000    1       1007
53    10      1000    1       1041
54    10      1000    1       1076
46    10      10000   1       10005
47    10      10000   1       10417
48    10      10000   1       10842
49    10      10000   1       11280
50    10      10000   1       11731
51    10      10000   1       12195
52    10      10000   1       12674
53    10      10000   1       13167
54    10      10000   1       13675
55    10      10000   1       14198
56    10      10000   1       14737

It takes some time to reload the game between trials. Apparently setting either of these settings to zero reduces the cost to zero. We can also conclude that raising the multiplier increases cost, and raising the divisor lowers it.

While this is obviously not an answer, I posted it anyway as I don't have enough reputation to add a comment. Maybe if we work together on solving this problem we might discover the answer. By the way I did some regression analysis on the numbers, but I wasn't able to find anything useful.

EDIT: I tried to change the INITIAL_GOLD_PER_UNIT_TIMES_100 value as well, but that didn't seem to have any effect on maintenance cost.

EDIT 14th of oct: I've updated with some more data that seems to shed a little more light on the issue. Increasing the multiplier to a large number has two advantages:

  • It clears the shroud of rounding (maintenance can apparently only be an integer).
  • It puts focus on the particular product of the equation that is supposedly multiplied

A couple of observations can be made about the formula:

  • Each spin of the turn counter increases maintenance cost
  • Increasing the multiplier increases the cost by more than a proportional amount
  • Each spin of the turn counter increases maintenance cost more than the last, in absolute terms
  • Each spin of the turn counter increases maintenance cost less than the last in relative terms
  • Polynomials share those two last properties

Feel free to chime in with any considerations you might have.

Here is some more data:

EDIT 22nd of October: The patch that has come out changes the formula. I will take a further look and then report back. What is obvious already is that the only-every-second-unit-counts rule is gone. I have updated the advice in the top to reflect that.

6
  • This is an interesting start. It might be helpful to let 10-20 few turns pass on each setting (other than the 0s) to see what is happening over time.
    – bwarner
    Commented Oct 12, 2010 at 22:39
  • OK, I've been plugging in your data. The per turn increase is DEFINITELY parabolic, or at least more parabolic than any other other combination I've tried (linear, exponential, etc.). Unfortunately, my earlier assumption that upkeep increases linearly with number of units is challenged by your second set of data. So, I am still clueless trying to piece this stuff together.
    – Damon
    Commented Oct 15, 2010 at 6:00
  • A cubic function seems to match the data better than a parabolic function. At least for the turn counter. The unit variable could be either parabolic or cubic. Based on the naming of the constants I suspect a non-integer polynomial is the best guess for both variables. In any case I think we are close enough to the answer to be able to adjust our strategy with regard to the formula. Further effort toward finding the formula will primarily serve to gratify our curiosity.
    – pius
    Commented Oct 16, 2010 at 23:00
  • Pius, the only way to truly see if you are on to something is to test the formula. Start a new game, or just continue the game you are playing to reach higher turns. If the formula does a reasonable job in predicting maintenance values, you are onto something. However, I cannot imagine any reasonable explanation for a cubic formula. They are nigh on impossible to balance. Instead, I suspect your equation fits the data points so well because of the number of coefficients allowing regression analysis to get a lot closer than a one or two coefficient equation could.
    – Damon
    Commented Oct 17, 2010 at 5:05
  • If you look at the data with default multiplier/divisor (8/7) it looks almost linear. I suspect changing the rating between multiplier and divisor greatly exaggerates the cubix/parabolic nature of the actually used equation. Commented Oct 17, 2010 at 9:43
8

While I am not about to count what I say as an answer to my question, I have been trying to figure out the answer on my own. I have been playing a Prince difficulty game at Standard speed on a Standard size map. Or, the most vanilla game type possible. Every so often I would record the number of units I had, the turn number, and my current unit maintenance. This created a data set for me. Now, it was obvious just by deleting units that maintenance was linear with number of (even) units. I plugged this data into various regression analysis crunchers, i.e. looking at different types of equations to see which one was the best fit for the data.

I thought it would be exponential, but linear appeared to be a better fit. Then I tried parabolic, and got the best fit yet. The equation below gave me maintenance to within one gold piece for all my data points.

2 × [Number of Units, if odd subtract 1] × [.00000619*T² + 0.00404478*T + 0.15814034]

R^2 was .999. "T" obviously stands for current Turn. Unfortunately, I am only on turn 384, so I have to see if this parabolic equation holds for the remainder of the game. If anyone can volunteer more data (Prince:Standard:Standard settings only right now), I can easily copy it into my data set and arrive at a more precise understanding. Just list Units, Turn, and Unit Maintenance.

If this equation is right, then I could see why Firaxis did not bother to publish it. However, I am stunned that Firaxis thought a Parabola was a good way to determine unit maintenance, especially when economies have no such way to grow in tandem.

Edit: Hmmm... I am going to withdraw this formula for now. It failed to predict upkeep costs as I finished that game. Certainly, throwing in the new points resulted in slightly different Parabolic equation still with an R2 of .999, but as finicky as this type of equation is, I need more data to determine if unit maintenance is indeed parabolic or something else entirely.

2
  • 1
    You might want to try playing with the values defined in the XML file. Set them to 0 and see what happens. Then set them to something really high and see what happens. Eventually you might be able figure out what affect they have.
    – bwarner
    Commented Oct 7, 2010 at 12:32
  • Damon, it might help others if you could publish the set of data you used.
    – Oak
    Commented Oct 10, 2010 at 13:13
6

I've collected some data and used the program Eureqa to find possible equations for the maintenance cost. I did not modify any XML values, I'm using vanilla Civ5 here.

Im using u for the number of units, t for the turn number and c for the maintenance cost.

Unit scaling

The dependence of the maintenance cost on the number of units (at turn 499) can be fitted to the equation

f(u) = 5.56 * u^1.14

always rounded down. I've calculated this from data at turn 499 with data from 0 to 452 units, only using even numbers of units.

maintenance per unit at turn 499

Turn scaling

The dependence on the turn number (with 100 units) can be fitted to the exponential equation

f(t) = 1.5011171*exp(5.1752067 + 0.0031669112*t) - 214.9911

This is based on data with 100 units for turn 0 to 500.

maintenance per turn for 100 units

I could not find a satisfactory equation that combines these two aspects of unit maintenance.

The unit supply limit does not have any effect on maintenance costs, it just reduces the production rate of your cities by 10% per unit over the limit up to a maximum reduction of 70%.

Map size and difficulty could also have an effect on maintenance, this still has to be determined.

I've put the data I collected into a Google Docs Spreadsheet (only valid for 24 hours, maybe someone can put it into a more permanent home).

2

The nearest answer I could find was this: http://forums.civfanatics.com/showthread.php?p=9666379

It seems to indicate it is proportionate to pairs of units, also that it scales with difficulty and time (due to inflation).

2
  • If Civ Fanatics came up with a Unit Maintenance Formula, I have not found it. Link or it did not happen, please.
    – Damon
    Commented Oct 7, 2010 at 5:54
  • They haven't come up with a formula either, there's just speculation and anecdotal evidence so far.
    – bwarner
    Commented Oct 10, 2010 at 14:16
2

At turn 285, I erased all my units one at a time. I had a reduction in maintenance costs of 8 or 9 golds every other turn. So it confirms what you say.

I'll try again around turn 400.

1
  • 6
    Seeing a change after two units are deleted might be caused by a bug fixed in the next patch: forums.2kgames.com/forums/showthread.php?t=94438: Economy - Fixed bug where players could disband a single unit, and not see the economic return until disbanding 1 more.
    – Pent
    Commented Oct 15, 2010 at 15:05
1

Maintenance is 0.5-1% of what the unit would cost if you bought it immediately, per turn. It will increase by 5% from the original unit cost every 50 turns if you do not upgrade the unit. This formula only applies to civilizations that have no abilities that provide maintenance cost benefits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.