The purpose of this article is to analyse the maths behind production in Civ4, the multipliers involved, overflow, and what's called "correction"; further to explain the original bug and the not so great work-around introduced by Firaxis; finally to outline the exploit introduced by the work-around, and how to minimize the impact of the wrong math on your civilization's economy. The answer is micromanagement of your cities, which we all thought to be gone for good; and I do hope that Firaxis will fix their formulae as soon as possible.
Many thanks to everyone who contributed to this thread
Definitions:
BP:= Base production of a city (sum of hammers by worked tiles & specialists; also forest chops)
NP:= production needed to complete a project this turn (="costs-done")
P := total production
g := sum of generic bonus multipliers (e.g. 25% from forge)
s := sum of special bonus multipliers applicable to current project (e.g. 100% from stones for stonehenge)
TO:= total overflow (=P-NP)
C := overflow correction, hammers substracted from TO when an s-project finishes
O := actual overflow (=TO-C)
The actual production value shown in the city screen equals P-C. It's not really used or important for anything.
NP, TO and O can be calculated by substraction, all other values are displayed via pop-up menu in the city screen when you move the mouse over the hammer icon left of the production bar. Important: The value displayed there is essentially P-C. Keep in mind that ingame numbers are generally rounded, so the displayed values can be slightly different.
(A note to forests: Clearing forests will give you 30 BP for any tile within the 21-tile city radius, also 30 for the following ring, then 25 for the next, then 20, and so on, until 5. The production is added immediately, think of it as getting an additional turn with BP=30 (or 25...5).)
The variables are connected by the following formulae:
P = BP * (1+g+s)
TO = P-NP = C+O
(Note: more accurately, optional overflow from the previous project is also added to P; however for simplicity that's left out in further breakpoint etc. calculations. So in those cases where a new project will be comleted in one turn containing overflow, the formulae can be slightly off)
C is needed because any special bonus production should not carry over to a project that isn't allowed to use it.
The obvious, correct formula for calculating C is:
C = TO * s/(1+g+s)
Thus we get:
O = TO * (1+g)/(1+g+s) = TO-C
C/O = s/(1+g)
(In my opinion the overflow should be scaled up again in the next turn by the new s-bonus, but that isn't done at all. More on this issue at the end of this article.)
Unfortunately, Firaxis messed up procentual calculation, and uses the following formula:
C = TO * s/(1+s)
O = TO * 1/(1+s)
C/O = s/1
This seems fair at first glance, but it's plain wrong and introduces weird bugs when both s and g are not zero.
For example, it's possible to get less total production with an s-bonus than without. Using the above formulae, one can show that this happens exactly when NP < g*BP. In this case the loss due to (the bugged) overflow correction is larger than the added bonus production which normally should greatly increase the overflow. And we are not talking about a single incident here, in the late game g is often 100%, and the 25% from police state only marginally help to decrease the total loss during the turns when no overflow happens.
I believe that Firaxis experienced exactly this situation - but instead of looking for the bug and fixing the small formula, they created a bulky work-around, which (as we will see) kind of fixes the described problem, but introduces others.
Many thanks to everyone who contributed to this thread
Definitions:
BP:= Base production of a city (sum of hammers by worked tiles & specialists; also forest chops)
NP:= production needed to complete a project this turn (="costs-done")
P := total production
g := sum of generic bonus multipliers (e.g. 25% from forge)
s := sum of special bonus multipliers applicable to current project (e.g. 100% from stones for stonehenge)
TO:= total overflow (=P-NP)
C := overflow correction, hammers substracted from TO when an s-project finishes
O := actual overflow (=TO-C)
The actual production value shown in the city screen equals P-C. It's not really used or important for anything.
NP, TO and O can be calculated by substraction, all other values are displayed via pop-up menu in the city screen when you move the mouse over the hammer icon left of the production bar. Important: The value displayed there is essentially P-C. Keep in mind that ingame numbers are generally rounded, so the displayed values can be slightly different.
(A note to forests: Clearing forests will give you 30 BP for any tile within the 21-tile city radius, also 30 for the following ring, then 25 for the next, then 20, and so on, until 5. The production is added immediately, think of it as getting an additional turn with BP=30 (or 25...5).)
The variables are connected by the following formulae:
P = BP * (1+g+s)
TO = P-NP = C+O
(Note: more accurately, optional overflow from the previous project is also added to P; however for simplicity that's left out in further breakpoint etc. calculations. So in those cases where a new project will be comleted in one turn containing overflow, the formulae can be slightly off)
C is needed because any special bonus production should not carry over to a project that isn't allowed to use it.
The obvious, correct formula for calculating C is:
C = TO * s/(1+g+s)
Thus we get:
O = TO * (1+g)/(1+g+s) = TO-C
C/O = s/(1+g)
(In my opinion the overflow should be scaled up again in the next turn by the new s-bonus, but that isn't done at all. More on this issue at the end of this article.)
Unfortunately, Firaxis messed up procentual calculation, and uses the following formula:
C = TO * s/(1+s)
O = TO * 1/(1+s)
C/O = s/1
This seems fair at first glance, but it's plain wrong and introduces weird bugs when both s and g are not zero.
For example, it's possible to get less total production with an s-bonus than without. Using the above formulae, one can show that this happens exactly when NP < g*BP. In this case the loss due to (the bugged) overflow correction is larger than the added bonus production which normally should greatly increase the overflow. And we are not talking about a single incident here, in the late game g is often 100%, and the 25% from police state only marginally help to decrease the total loss during the turns when no overflow happens.
I believe that Firaxis experienced exactly this situation - but instead of looking for the bug and fixing the small formula, they created a bulky work-around, which (as we will see) kind of fixes the described problem, but introduces others.