BackArrowGreen Back to game concepts

This article presents some of the mathematics of Civilization V. It was originally published by alpaca at the CivFanatics forum. Notice that this article represents the state of the game before the December 2010 patch!

Updated on 6/13/2015: Unit Maintenance updated to reflect the actual formula in the DLL - monju125

Calculating CultureEdit

Border growthEdit

The cost of a border growth is, with t the number of tiles already claimed

$ 20 + (10 (t - 1))^{1.1} $

Formula for Social PoliciesEdit

The first thing we need to know when talking about anything culture-wise is how to calculate it. From the game core XML files and in-game observations, it works like this: You calculate a base cost that depends on the number of policies, then multiply with a factor that depends on your number of cities. As follows:

$ n $: The number of cities in your empire

$ p_{base} (k) $: The base cost of policy k. Depends only on the number of policies

$ p_{cities}(n) $: The cost factor depending on the number of cities in your empire

$ p(n,k) $: The total cost of policy k. Depends on both the number of cities and policies already unlocked

The policy cost has to be modified depending on your difficulty setting, game speed and map size. I took the numbers from a post by Yamian. Define these modifiers as:

$ m_t $: The game speed modifier (3 for marathon, 1.5 for epic, 1 for normal and 0.67 for quick)

$ m_d $: The difficulty coefficient (0.5 for settler, 0.67 for chieftain, 0.85 for warlord, 1 otherwise)

$ m_z $: The map size modifier (0.3 for normal size and below, 0.2 for large, 0.15 for huge)

$ p_{base}(k) = m_t m_d (25 + (6 k)^{1.7}) = m_t m_d (25 + 21.03k^{1.7}) $

$ p_{cities}(n) = 1 + m_z (n - 1) $

The policy cost scales linearly with the number of cities and something between linear and quadratic with the number of policies. These factors are combined by multiplication, so the total cost is simply:

$ p(n,k) = p_{base}(k) * p_{cities}(n) $ rounded to the next multiple of 5

Cost for each policy on standard settings

How fast do I acquire new policies?Edit

This is very simple, and I'll just list it here to introduce some variable names. It depends on the culture your empire yields. With

$ c $: The total culture yield of your empire

$ p $: The cost of your next social policy (I will omit the dependencies for readability)

$ t $: The time in turns to unlock the next policy

we get the simple formula

$ t = p/c $

if we assume we just unlocked a new policy. If we introduce

$ c_{acc} $: The culture already accumulated in the culture bucket

we get

$ t = (p - c_{acc})/c $

How do I calculate the total culture in my empire?Edit

This is shown in the UI but again to introduce some concepts. Let

$ {\bar c} = c/n $ : the average culture of each city in your empire

It makes sense to split c up into a part that depends on n and represents your "typical city culture", the culture each city you newly create will add to your empire, and a part that is constant in n and represents bonuses from wonders, landmarks and city states. This is exact if you immediately buy your typical culture buildings but normally it's an approximation (it represents an equilibrium you will not normally have reached)

$ c_t $: The typical culture per city

$ c_c $: The city state culture

$ c = n c_t + c_c = n {\bar c} $

Before I continue let's look at the policy speed for large numbers

$ \begin{align} t &= \frac{p_b(k) (1 + p_m (n - 1))}{n {\bar c}} \\ &= \frac{p_b(k)}{\bar c}\left(\frac{1 - pm}{n} + pm\right) \\ \end{align} $

$ \lim_{n \to \infty}t = \frac{p_m p_b}{\bar c} $

Also: $ \lim_{n \to \infty}{\bar c} = c_t $

So for large n, the average amount of culture per city is a good measure for the policy speed.

Will expanding increase or decrease policy speed?Edit

This is the question Paeanblack and I discussed in said thread. To analyse this, we have to calculate the number of turns to the next policy and see how it's affected by going from n->n+1.

When we do the city number increase, both p and c change. Let p and c be the policy cost and culture yield before founding the new city and p' and c' be the respective numbers after the founding.

$ p' = p_b(k) (1 + p_m n) = p + p_m p_b(k) $

$ c' = (n + 1) c_t + c_c = c + c_t $

Then calculate t' and check when it gets smaller than t (this would signify an increased policy speed)

$ t' = p'/c' = \frac{1 + p_m n}{c_t n + c_t + c_c} < \frac{1 + p_m n - p_m}{c_t n + c_c} $

$ (1 + p_m n) (c_t n + c_c) < (1 + p_m n) (c_t n + c_c) + (1 + p_m n) c_t - p_m (c_t n + c_t + c_c) $

$ p_m c_t n + p_m c_t + p_m c_c < c_t + p_m n c_t $

$ p_m (c_t + c_c) < c_t $

$ r_c = \frac{c_c}{c_t} < \frac{1}{p_m} - 1 = \frac{1 - p_m}{p_m} $

For standard-sized maps, $ p_m = 3/10 $ so

$ r_c < \frac{7}{3} = 2.\hat3 $

So if the base culture from city states is less than 7/3 times larger than the typical city culture (let's call this the culture ratio r_c), you will get an increased policy speed from expanding. If it's exactly equal to this, the speed will stay the same, and if it's more, policy speed will slow. It should be noted that, no matter the value of r_c, for large numbers of cities the increase or decrease for founding an additional city will be very small.

For larger maps, this will be a little different.

  • Large: r_c < 4
  • Huge: r_c < 17/3 =5.\hat6


Now we can plug in some example numbers into our calculations. I will discuss the results only for the standard map size

  1. Let's assume you only build a monument in each of your cities. This is equivalent to a value of cT = 2. So if cC is five or greater, for example because you have at least one cultural city state as a friend, expansion will slow down your social policy speed.
    Standard: cC > 4, Large: cC > 8, Huge: cC > 11
  2. Now assume we build a monument and a temple, or cT = 5. Then, cC <= 11 will still yield an increase in your social policy speed. A cC of 10 is still pretty low, though. You normally still get it later on if you have at least one cultural city state ally.
    Standard: cC > 11, Large: cC > 20, Huge: cC > 28
  3. Looking at France, with a monument cT = 4 (true also for Egypt with Monument and Burial Tomb) and with both monument and temple, cT = 7. The corresponding cC values are 9 and 16. For 9 the same as above is true, but for the case with temples, you will actually gain an increase in policy speed if you don't have at least two city state allies or a city state and a few wonders.
    Standard: cC > 9 or 16, Large: cC > 16 or 28, Huge: cC > 28 or 40
  4. The Songhai have the excellent Mud Pyramid, so they share the cT = 7 case with France. The same goes for adding two artists in each city.

To sum up, expanding will in almost all cases slow down your social progress. The only cases where it will speed it up are if you either aren't interested in city states and wonders, or if you play a civ with a culture bonus. The only somewhat realistic scenario where expansion could speed up your policy gain is in my opinion if you play Songhai because you'll really want the Mud Pyramid and a Monument isn't that expensive.

I'm not sure if city state bonuses scale with the map size but if they don't, expansion increasing your policy speed is a lot more likely on larger maps, probably happening at some time if you just have a monument and a temple or are playing France. If you play Songhai, or France with temples it will even happen pretty often in fact. This is another case where the game doesn't scale well (well in the sense of preserving the same effects on gameplay as on standard size) with map size.


Food costEdit

The food cost for a city to grow is calculated as follows

$ n $: The number of citizens in the city

$ f $: Amount of food to grow to size n+1

$ f(n) = 15 + 6 (n - 1) + (n - 1)^{1.8} $

Comment: It is OUTDATED! Patch on Dec 2010. Now the formula is:

$ f(n) = 15 + 8 (n - 1) + (n - 1)^{1.5} $

Need to edit everything below.

Food required to grow to level n+1
n 12345678910111213141516171819202122232425262728293031323334353637383940
f 1522304051637690105121138155174194214235258280304329354380407435464493523554585617650684719754790826863901940979
Integrated food values (total amount food it takes to grow to size n)


n 234567891011121314151617181920212223242526272829303132333435363738394041
f 15376710715822129738749261375190610801274148817231981226125652894324836284035447049345427595065047089770683569040975910513113031212912992138931483315812

What this means is that growing from size 5 to 6 costs 51 food, while growing from size 10 to 11 already costs 122 food. I would like to present a few ways of looking at this problem from different angles in the following.

Constant Food SurplusEdit

This simplification assumes that each new citizen will work a tile that's worth 2 food and you therefore have a constant amount of food surplus that is put into growth. For a normal city without any bonuses, the amount of turns you need to grow is simply given by

$ t(n) = g(n)/f $

where n is the number of citizens, f the food surplus and t the number of turns until growth, assuming you start at 0 food. Let's look at the numbers for df = 8


n 12345678910111213141516171819202122232425262728293031323334353637383940
t 2345681011131517192224272932353841444851545862656973778186909499103108113118122

This kind of explains why growth feels so slow once you hit the teens: The number of turns cities need to grow becomes pretty large, even with a pretty decent food surplus. A city takes about the same time to grow from size 12 to 13 as from size 1 to 5.

Constant food per citizenEdit

Here, the assumption is that each citizen will yield a certain mean amount of food. To understand what happens there better, let's define another function, the average growth cost per citizen

$ ga(n) = g(n)/n = 9/n + 6 + (n - 1)^{1.8}/n $

(In blue the exact function, in red the rounded one the game uses)

The last term is approximately n^0.8 and dominates for large n. As you can see, this function has a minimum at size 4 (about 3.75 in the continuous case) and then constantly grows a little less than linearly - but linear growth is an excellent approximation.

As you can see below, the function 0.41 n + 8.18 fits the data over this range perfectly but is much simpler (the functions agree at all integer places).

So how do you interpret this function? What it tells you is that, with a constant amount of food produced per citizen, your city will grow more quickly than before until it hits size 4, and then starts slowing down again. Or, to put it more simple, this function tells you the amount of food each citizen has to produce to let the city grow.

An alternative, but equivalent, point of view is that, if you're aiming for a constant city growth speed, each citizen has to become more efficient as your city grows, in an approximately linear function.

You should note that the amount of food generated per citizen will usually be larger for small cities due to the city square itself (especially with maritime CS).

Slightly more realisticEdit

Cities start with a center square that yields some food (this catches granary, maritime city-states and water mill food, too). So the assumption that the amount of food per citizen will stay the same isn't really completely applicable. So let's introduce a new variable, f_csq, the city square food amount.

The assumption of an average amount of food per citizen now makes sense if you leave the city square food out. So let's call the amount of food each citizen generates f_c. The total food per turn, f, is then given by

$ F = f_c * n + f_{csq} $

More interesting for us is the food surplus. This is given by

$ f = F - 2*n = (f_c - 2)*n + f_{csq} $

The amount of surplus food produced per citizen is then

$ fa = f/n = f_{csq}/n + f_c - 2 $

To get the number of turns we need for growth, we need to combine this with the food growth cost and get

$ t = g/f $

Since this function doesn't read too pretty, I'll just plop in some numbers and give you a graphical representation. Let's say f_csq = 2, which is the case if you don't have city state allies. If the city is to grow in a reasonable amount of time, f_c should be greater than 2.5, as you can see below

Civ5 foodturns1

You will notice a local minimum evolving in the f_c = 4 case, which signifies the onset of the constant food per citizen approximation, which is the limiting case for f_csq = 0

Are granaries worth it?Edit

Ultimately, that's for you to decide. I can give you some information so you can make an educated decision, though. Granaries increase f_csq from 2 to 4, so let's look at what happens to t if we make that change. Dashed are the values without granary, the full lines are with a granary

Civ5 cs2

More useful to judge the granary's effects is looking at the difference between the case without a granary, and the case with a granary

Civ5 cs2diff

As you can see, the difference quickly becomes essentially constant at a city size of 10 or more for any case of f_c > 2. From this analysis, I'd say that for f_c values up to 3, a granary is generally worth it, because it saves you a turn or two per growth step. For f_c = 2.5 it's very much worth it, and this seems to be a more realistic case than the higher values because not every citizen will work a farm (the f_c = 4 case represents each citizen working a Civil Service/Fertilizer farm) and some won't produce any food at all, like specialists.

Other f_csq effectsEdit

We can continue this analysis by increasing f_csq in steps. For example, a maritime CS will yield 2 extra food, as will a water wheel. Let's see what happens if we go from f_csq = 4 to f_csq = 6. I will omit the more unrealistically high cases from now on for a better overview. Shown is again the total number of turns needed and the difference between 4 and 6. This time, f_csq = 4 is dashed

Civ5 csCiv5 csdiff

So getting the second city-state isn't as good as getting the first, and getting a granary when you already have a city-state isn't so great, either. It still shaves off a turn (or three in the f_c = 2.5 case), though.

The next increase step, from 6 to 8 (the "before" being dashed as usual)

Now things start becoming somewhat underwhelming. As I said, if things are worth it for you is up to you to decide, but I'd definitely not build that water mill if I already have a granary and a city-state ally because the difference will only be something like two turns in three growth steps or so, which isn't exactly a lot.

f_c values < 2Edit

After reading a comment from ehrgeix, I think it makes sense to extend the analysis to f_c values that are smaller than 2. The values greater than 2 are applicable if you want to let your city continue to grow for the rest of the game. Values smaller than 2 still make sense in transitionary periods, if you want a growth cap, or if you're fine with your growth speed slowing down even more than in the constant food surplus case discussed above.

Qualitatively, we can already see from looking at $ f = (f_c - 2)*n + f_{csq} $, which occurs as the denominator in the formula for t, that these functions will have a pole at a finite n, because f_c - 2 becomes negative. The locus of this singularity is given by $ n = f_{csq}/(2 - f_c) $. This singularity signifies the number of citizens where the city stops growing.

In the following are some graphs in the same way as above. First, f_csq = 2

Civ5 fc2

If you increase f_csq you shift the position of the pole to the right, so the difference between t(csq = 2) - t(csq = 4) has a singularity at the same points as t. See the f_csq = 4 case below. Dashed is the "previous", in this case f_csq = 2

Civ5 fc4Civ5 fc4diff

f_csq = 4 -> f_csq = 6

Civ5 fc6Civ5 fc6diff

f_csq = 6 -> f_csq = 8

Civ5 fc8Civ5 fc8diff

Unit maintenanceEdit

As of 6/2015, the formula for unit maintenance as defined in all versions CvGameCoreDLL is calculated as follows:

  • b = Base unit cost (INITIAL_GOLD_PER_UNIT_TIMES_100)
  • f = Free units from handicap (GoldFreeUnits), specific unit types, or policies
  • u = Total paid units
  • n = max(0, u-f) = Number of actual paid units (if u-f is less than 0 then n = 0)
  • t = Current turn
  • e = Estimated end turn (based on all entries for the current GameSpeed in GameSpeed_Turns)
  • g = t/e = Game progress factor
final cost = (n*b(1+g*m)/100)(1+(g/d))

Unit cost modifiers from traits are applied before the exponent. Unit cost modifiers from policies, handicap, and AI difficulty level are applied to the final cost.

Since there's no easy "each unit in turn t will cost this much" here's a table you can use as a rough reference. The first row is the number of turns, the first column the number of units

Total unit maintenance costs
Units 1 20 50 100 150 200 250 300 350 400
4 22357911141720
8 45711151924303643
12 681116233038475768
16 8101422314152647894
20 1013182839526682100121
24 12162234476380100122148
28 14182640567494118145176
32 162130466485109136168204
36 182434527396124155191232
40 2026375881108138174215261
44 2229416489119153193238291
48 2432457098131168212262321
52 26354976107142184231287350
56 28375382115154199251311381
60 30405788124166214270335411
64 32436194133177229290360442
68 344564100141189245310385473
72 364868106150201260330410504
76 385172112159213276349435535
80 405476118167225292370461567
84 425680124176237307390486598
88 445984130185249323410512630
92 466288137194260339430537662
96 486492143203273354451563694
100 506795149211285370471589727

Here's an equivalent table detailing the cost per unit

Maintenance cost per unit
Units 1 20 50 100 150 200 250 300 350 400
4 0.500.500.751.
8 0.500.630.881.
12 0.500.670.921.
16 0.500.630.881.
20 0.500.650.901.
24 0.500.670.921.
28 0.500.640.931.
32 0.500.660.941.
36 0.500.670.941.
40 0.500.650.931.
44 0.500.660.931.
48 0.500.670.941.
52 0.500.670.941.
56 0.500.660.951.
60 0.500.670.951.
64 0.500.670.951.
68 0.500.660.941.
72 0.500.670.941.
76 0.500.670.951.
80 0.500.680.951.
84 0.500.670.951.
88 0.500.670.951.
92 0.500.670.961.
96 0.500.670.961.
100 0.500.670.951.
Civilization V [edit]
Gods & KingsBrave New World

BuildingsCivsDLCImprovementsPromotionsResourcesScenariosSocial PoliciesTechnologiesTerrainUnique AbilitiesUnitsWonders (Natural)

AncientClassicalMedievalRenaissanceIndustrialModernFuture† • Atomic‡ • Information

City-StateCultureEspionage‡ • FoodGoldGreat PeopleHappinessProductionReligion‡ • ScienceTourism‡ • Victory

Guides etc.
AchievementsMathematicsModdingMajor PatchesSoundtrackCivilopedia

† Only in vanilla Civ5
‡ Only in Gods & Kings and Brave New World

Community content is available under CC-BY-SA unless otherwise noted.