Moderator Action: Note: This applies to vanilla Civ3 and Play th World.
Alexman has created a separate thread covering Conquests/C3C corruption here - AlanH
Well, after spending some time doing some experiments, I think I do.
I used the editor to make a series of maps (one for each size), that had only plains. I modified plains to give two food, 25 shields, and 25 commerce, and I removed all commerce bonuses from roads. I also modified the governments to never have tile penalties and bonuses, so we can see only the effect of corruption in the governments.
Here's what I found:
FIRST SOME GENERAL COMMENTS
1) Corruption can never exceed 95%, no matter what.
2) Corruption calculations do not use Euclidean geometry, nor unit movement points, to get distance. Instead, the distance is based on the shortest path, where each orthogonal move costs 1.0 and each diagonal move costs 1.5, and the total is rounded down to the nearest integer. Another way of writing the distance formula is Distance = floor(max(x,y) + 0.5*min(x,y)), where x and y are the distance in the NW/SE and NE/SW respectively. (Formula discovered by DaviddesJ, rounding discovered by Qitai)
3) Corruption is divided into corruption due to number of cities, and corruption due to distance. These two components are independent.
4) The following corruption calculations yield a percentage. To get the actual corruption/waste, multiply the percentage/100 by the total number of shields/commerce on tiles being worked, and round to the nearest integer (verified by DaviddesJ).
5) Factories, marketplaces, et cetera, multiply the city's shields/commerce after corruption. This means that the number of red (lost) shields/commerce remains unchanged in the city view after you add one of those buildings (but the uncorrupted shields/commerce increase). It does not mean, of course, that you actually reduce the corruption percentage when you build these improvements (but it seems like it does, just because the percentage of red shields/commerce out of the total is visually lower compared to before).
CORRUPTION DUE TO DISTANCE FROM CAPITAL
The corruption due to distance, depends on these parameters:
1) Distance factor, Fd
This is 3.6 times the distance, divided by the map size. The distance here is the minimum between the distance to the capital and the distance to the Forbidden Palace. So for a standard map size (100x100) this factor would be 0.36 for a city 10 tiles away from the capital (when the FP is more than 10 tiles away). For a tiny map (60x60), it would be 0.6. It looks like the capital is taken as a distance 1 tile (not zero) from itself, that's why there is some corruption there. Communism is a special case, because corruption does not depend on distance. For communism replace the distance factor by the value 1.0.
2) Government factor, Fg
The distance factor is multiplied by a factor that depends on government. Here are the values:
Despotism: 1.0
Monarchy: 2/3
Republic: 2/3
Democracy: 4/9
Communism: 0.3
3) Improvement factor, Fi
The above product is multiplied by 0.5 to the power of N, where N is the number of city improvements that reduce corruption (courthouse and police station). If there is a WLTK celebration, increase N by one for shield waste calculation (but not for commerce lost).
4) Connection factor, Ft
This is 0.85 if the city is connected to the capital through roads, harbors, or airports. It is equal to 1.0 if not connected.
CORRUPTION DUE TO NUMBER OF CITIES
(Seriously edited since first posted)
The corruption due to number of cities depends on these parameters:
1) Optimal number of cities, Nopt
This is an integer number that depends on map size, and is found in the editor.
2) OCN (Nopt) multiplier, Fn
This is a factor that multiplies Nopt, and depends on difficulty level, city improvements, government, WLTKD, FP, and the commercial trait.
Specifically:
Fn = d*(1 + g + fp + imp*N + c)/100
where
d : percentage of optimal cities for this difficulty level (found in editor)
fp: zero for no FP, otherwise 0.2 for Communism and 0.1 for other governments
g : 0.1 if Republic or Democracy, 0.2 if in Communism, 0.0 otherwise
N : the number of improvements (including WLTKD for waste) as for distance corruption
imp: 0.1 for Communism, 0.25 otherwise
c : 0.25 for Commercial civs, 0.0 otherwise
3) Rank of the city, Ncity
This is equal to the number of cities that are closer to the capital than this city (including the capital). So Ncity is equal to 0 at the capital, 1 at the closest city to the capital, et cetera.
The above parameters are combined to get corruption due to number of cities, Fc, in this way:
Again, this is different for Communism than it is for the rest of the governments. For communism Fc is 0.1 times the ratio of ALL cities to (Fn*Nopt).
The FP gets a whole new set of cities where the number-of-cities factor starts at zero. So placing a FP never increases corruption at mid-range cities, even though there are now more cities closer to a center of your empire (capital or FP) than there were before). Edit: Qitai discovered that there is a bug in the rank calculations for cities closer to the Forbidden Palace than the Capital. In short, for such a city, the rank is given by the number of cities that are closer to the Capital than that city is to the Forbidden Palace.
So, if you want to write down the formula for corruption, it will be something like this:
Corruption% = 100 * (Fd*Fg*Fi*Ft + Fc)
DONE!
This formula worked for my test cases. It might not be 100% accurate, but it's pretty close. I think most of my discrepancies were rounding errors. But the real value of this analysis is that it gives an insight of how all these parameters affect corruption.
For example, you can see that difficulty level does not affect corruption due to distance.
Also, note that Communism continues to deteriorate as you add cities, up to the limit where all its cities are 95% corrupt!!
You can also see that Monarchy and Republic are exactly the same in terms of distance corruption, but differ in number-of-cities corruption. (Monarchy does not have the commerce bonus, but that's not corruption)
When you are well over the optimal number of cities, you can see that it makes no difference if you add a courthouse to a city at the outskirts of your empire, because the corruption due to number of cities can go over 100%. Even if you somehow manage to reduce the distance corruption to by adding buildings, WLTK, and Democracy, if the corruption due to number of cities is over 100% (i.e. you have 1.5 times the modified optimal number), you will have a maxed out corruption (95%) in that city anyway.
The above formula is implemented in a corruption calculator
[Edit: updated for PTW]
[Edit: updated for Nor Me's results]
[Edit: updated for DaviddesJ distance formula]
[Edit: updated for DaviddesJ rounding]
[Edit: updated for Qitai distance rounding]
[Edit: updated for Qitai's FP rank bug discovery]
Alexman has created a separate thread covering Conquests/C3C corruption here - AlanH
Well, after spending some time doing some experiments, I think I do.
I used the editor to make a series of maps (one for each size), that had only plains. I modified plains to give two food, 25 shields, and 25 commerce, and I removed all commerce bonuses from roads. I also modified the governments to never have tile penalties and bonuses, so we can see only the effect of corruption in the governments.
Here's what I found:
FIRST SOME GENERAL COMMENTS
1) Corruption can never exceed 95%, no matter what.
2) Corruption calculations do not use Euclidean geometry, nor unit movement points, to get distance. Instead, the distance is based on the shortest path, where each orthogonal move costs 1.0 and each diagonal move costs 1.5, and the total is rounded down to the nearest integer. Another way of writing the distance formula is Distance = floor(max(x,y) + 0.5*min(x,y)), where x and y are the distance in the NW/SE and NE/SW respectively. (Formula discovered by DaviddesJ, rounding discovered by Qitai)
3) Corruption is divided into corruption due to number of cities, and corruption due to distance. These two components are independent.
4) The following corruption calculations yield a percentage. To get the actual corruption/waste, multiply the percentage/100 by the total number of shields/commerce on tiles being worked, and round to the nearest integer (verified by DaviddesJ).
5) Factories, marketplaces, et cetera, multiply the city's shields/commerce after corruption. This means that the number of red (lost) shields/commerce remains unchanged in the city view after you add one of those buildings (but the uncorrupted shields/commerce increase). It does not mean, of course, that you actually reduce the corruption percentage when you build these improvements (but it seems like it does, just because the percentage of red shields/commerce out of the total is visually lower compared to before).
CORRUPTION DUE TO DISTANCE FROM CAPITAL
The corruption due to distance, depends on these parameters:
1) Distance factor, Fd
This is 3.6 times the distance, divided by the map size. The distance here is the minimum between the distance to the capital and the distance to the Forbidden Palace. So for a standard map size (100x100) this factor would be 0.36 for a city 10 tiles away from the capital (when the FP is more than 10 tiles away). For a tiny map (60x60), it would be 0.6. It looks like the capital is taken as a distance 1 tile (not zero) from itself, that's why there is some corruption there. Communism is a special case, because corruption does not depend on distance. For communism replace the distance factor by the value 1.0.
2) Government factor, Fg
The distance factor is multiplied by a factor that depends on government. Here are the values:
Despotism: 1.0
Monarchy: 2/3
Republic: 2/3
Democracy: 4/9
Communism: 0.3
3) Improvement factor, Fi
The above product is multiplied by 0.5 to the power of N, where N is the number of city improvements that reduce corruption (courthouse and police station). If there is a WLTK celebration, increase N by one for shield waste calculation (but not for commerce lost).
4) Connection factor, Ft
This is 0.85 if the city is connected to the capital through roads, harbors, or airports. It is equal to 1.0 if not connected.
CORRUPTION DUE TO NUMBER OF CITIES
(Seriously edited since first posted)
The corruption due to number of cities depends on these parameters:
1) Optimal number of cities, Nopt
This is an integer number that depends on map size, and is found in the editor.
2) OCN (Nopt) multiplier, Fn
This is a factor that multiplies Nopt, and depends on difficulty level, city improvements, government, WLTKD, FP, and the commercial trait.
Specifically:
Fn = d*(1 + g + fp + imp*N + c)/100
where
d : percentage of optimal cities for this difficulty level (found in editor)
fp: zero for no FP, otherwise 0.2 for Communism and 0.1 for other governments
g : 0.1 if Republic or Democracy, 0.2 if in Communism, 0.0 otherwise
N : the number of improvements (including WLTKD for waste) as for distance corruption
imp: 0.1 for Communism, 0.25 otherwise
c : 0.25 for Commercial civs, 0.0 otherwise
3) Rank of the city, Ncity
This is equal to the number of cities that are closer to the capital than this city (including the capital). So Ncity is equal to 0 at the capital, 1 at the closest city to the capital, et cetera.
The above parameters are combined to get corruption due to number of cities, Fc, in this way:
Code:
Ncity / (2*Fn*Nopt), if Ncity <= Fn*Nopt,
Fc =
Ncity / (Fn*Nopt) - 0.5, if Ncity > Fn*Nopt,
Again, this is different for Communism than it is for the rest of the governments. For communism Fc is 0.1 times the ratio of ALL cities to (Fn*Nopt).
The FP gets a whole new set of cities where the number-of-cities factor starts at zero. So placing a FP never increases corruption at mid-range cities, even though there are now more cities closer to a center of your empire (capital or FP) than there were before). Edit: Qitai discovered that there is a bug in the rank calculations for cities closer to the Forbidden Palace than the Capital. In short, for such a city, the rank is given by the number of cities that are closer to the Capital than that city is to the Forbidden Palace.
So, if you want to write down the formula for corruption, it will be something like this:
Corruption% = 100 * (Fd*Fg*Fi*Ft + Fc)
DONE!
This formula worked for my test cases. It might not be 100% accurate, but it's pretty close. I think most of my discrepancies were rounding errors. But the real value of this analysis is that it gives an insight of how all these parameters affect corruption.
For example, you can see that difficulty level does not affect corruption due to distance.
Also, note that Communism continues to deteriorate as you add cities, up to the limit where all its cities are 95% corrupt!!
You can also see that Monarchy and Republic are exactly the same in terms of distance corruption, but differ in number-of-cities corruption. (Monarchy does not have the commerce bonus, but that's not corruption)
When you are well over the optimal number of cities, you can see that it makes no difference if you add a courthouse to a city at the outskirts of your empire, because the corruption due to number of cities can go over 100%. Even if you somehow manage to reduce the distance corruption to by adding buildings, WLTK, and Democracy, if the corruption due to number of cities is over 100% (i.e. you have 1.5 times the modified optimal number), you will have a maxed out corruption (95%) in that city anyway.
The above formula is implemented in a corruption calculator
[Edit: updated for PTW]
[Edit: updated for Nor Me's results]
[Edit: updated for DaviddesJ distance formula]
[Edit: updated for DaviddesJ rounding]
[Edit: updated for Qitai distance rounding]
[Edit: updated for Qitai's FP rank bug discovery]