 |
|  |
 |
|
alexman
|
 |
Hunt Valley, MD
Jan 1970 time: 00:18
|
|
This thread is somewhat difficult to follow if you are not already familiar with the concept of corruption. There is another, more user-friendly, FAQ in the general forum.
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]
Last edited by alexman on 11-09-2003 at 03:29
|
|
|  |
 |
|  |
 |
|
Dominae
|
|
Agreed, great post alexman. I have some questions though. Are you sure there was no Corruption decrease for Commercial civs? You were able to discover all these factors, but none for Commercial civs? Where then does the purported Commercial bonus to Corruption apply?
Dominae
|
|
|  |
 |
|  |
 |
|  |
 |
|
alexman
|
 |
Hunt Valley, MD
Jan 1970 time: 00:18
|
|
Yes, for commercial civs, I'm sure that there was no benefit in my tests, and I was not pleased by this at all. Already the fact that all civs get a bonus commerce in cities over size 6 reduces the value of commercial civs a lot. Maybe (even though I think it would be stupid to do it that way) their bonus comes into effect under conditions that I never tested. For example, I never tested commercial civs with a large number of cities. It was much easier to get the number-of-cities corruption results by setting the "optimal number of cities" value in the editor to something very low once I figured out the corruption model for non-commercial civs. I also never had a city population larger than 7. Who knows what Firaxis did, but I think it must be a bug.
I had seen Aeson's tests before doing this, and I really can't say why we don't get the same results for commercial civs. I tried to isolate the various causes of corruption as much as I could. For example, to test the effect of distance corruption, I did all my tests with optimal number of cities=1000. Then, once I figured out that aspect of it, I picked a city at a fixed distance from the capital and started adding cities (closer and farther from the capital) to see what number of cities did to their corruption. This part of my test was similar to Aeson's, so we should have gotten similar results. On the other hand, Aeson's tests for commercial and non-commercial civs show different amounts of base commerce (without corruption) for a size 2 city under the same government. Where is the extra commerce coming from?
Aeson, (or even Firaxis) what do you think of all this? 
|
|
|  |
 |
|  |
 |
|  |
 |
|
Franses
|
|
Alexman,
Great work. I love this kind of investigations. Planned to do it myself one day but did not think of the nice and relatively easy way you did it. However....
Tried to verify your formula on the tiny map I am playing at the moment, but did not succeed. It looks like the distance factor on a tiny map does not comply to the formula.
Do you know whether water has a special effect? I have this city on position (5,41) with the palace on position (16,46) but the city is on a different continent. The continents are separated by two tiles of water.
I am in republic on a tiny map and the city has a harbor. The geometrical distance is 12 (if I understood you correctly) meaning that the distance corruption according to your formula is expected to be 3.4*12=40.8%. The city has one or two (dependant on how you calculate the number of cities between it and the palace) cities between it and the palace. Being on emperor level the optimal number of cities is 12 * 0.8 = 10. This adds another 8.5% or 17% for a total of 49.3 or 57.8% maximum.
The city has a commerce of 11 (no marketplace etc.) so I would expect a corruption of about 5, maximum 6. In reality it is 8. Did I make a mistake here or have the water tiles a negative influence?
Also the cities on the "palace continent" seem to have a higher corruption as indicated by your fornula but it is a tiny continent so rounding factors may play a significant role here and I do not dear to draw final conclusions from it.
Last edited by Franses on 09-04-2002 at 15:28
|
|
|  |
 |
|
Aeson
|
 |
orangesoda
Nov 2001 time: 22:18
|
|
code:
| Corruption by Distance |
| Distance |
Despotism |
Monarchy |
Republic |
Democracy |
| 2 |
14 |
11 |
11 |
11 |
| 3 |
21 |
14 |
14 |
11 |
| 4 |
28 |
21 |
21 |
14 |
| 5 |
31 |
24 |
24 |
14 |
| 6 |
41 |
28 |
27 |
21 |
| 7 |
44 |
31 |
31 |
24 |
| 8 |
54 |
38 |
37 |
27 |
| 9 |
58 |
41 |
41 |
27 |
| 10 |
64 |
44 |
44 |
31 |
| 11 |
71 |
48 |
47 |
37 |
| 12 |
78 |
54 |
54 |
41 |
| 13 |
81 |
58 |
57 |
41 |
| 14 |
91 |
61 |
61 |
44 |
| 15 |
94 |
64 |
64 |
47 |
| 16 |
95 |
71 |
71 |
54 |
| 17 |
" |
74 |
74 |
54 |
| 18 |
" |
78 |
77 |
57 |
| 19 |
" |
81 |
81 |
61 |
| 20 |
" |
88 |
87 |
64 |
| 21 |
" |
91 |
91 |
64 |
| 22 |
" |
94 |
94 |
71 |
| 23 |
" |
95 |
95 |
74 |
| 24 |
" |
" |
" |
77 |
| 25 |
" |
" |
" |
77 |
| 26 |
" |
" |
" |
81 |
| 27 |
" |
" |
" |
87 |
| 28 |
" |
" |
" |
91 |
| 29 |
" |
" |
" |
91 |
| 30 |
" |
" |
" |
94 |
| 31 |
" |
" |
" |
95 |
Last edited by Aeson on 09-04-2002 at 16:33
|
|
|  |
 |
|
alexman
|
 |
Hunt Valley, MD
Jan 1970 time: 00:18
|
|
Frances: From your example it does look like cities on another continent have an additional penalty. I'll look into it tonight.
Aeson: Our results aren't that far apart. Rounding (probably at some intermediate step in the Civ3 engine) is definitely an issue. Look at your results by distance for Democracy. They go in steps! I'm still confused about what's going on with commercial civs... I will do a couple more tests tonight.
Like I said, the formula is not 100% accurate. But it gives a very good idea on how the various parameters (except commercial trait!!!) affect corruption.
Anyway, here are the values that my formula gives for your test conditions:
code:
Corruption by Distance
Distance Despotism Monarchy Republic Democracy
2 17 13 13 10
3 23 17 17 13
4 29 21 21 15
5 35 25 25 18
6 41 29 29 21
7 47 33 33 23
8 53 37 37 26
9 59 41 41 29
10 65 45 45 31
11 71 49 49 34
12 77 53 53 37
13 83 57 57 39
14 89 61 61 42
15 95 65 65 45
16 95 69 69 47
Corruption by Number of Cities
(excluding capital)
Cities Despotism Monarchy Republic Democracy
1 65 45 45 31
2 69 49 49 35
3 73 53 53 40
4 77 57 57 44
5 81 61 61 48
6 85 65 65 52
7 90 70 70 56
8 94 74 74 60
9 95 78 78 65
Last edited by alexman on 09-04-2002 at 20:08
|
|
|  |
 |
|
Franses
|
|
I think I made a mistake. I thought that Fc was:
0.5 x nrofcitiesbetweenthisoneandthecapital/optimalnumber
I reread your first post (perhaps you edited it??) and now understand that it should be:
0.5 x cityrank (in closeness to the capital)/optimalnumber
This does explain the difference I measured since there were 5 cities on the small continent that of course were all closer to the capital than the one I calculated the corruption for.
|
|
|  |
 |
|
PerpetualNewbie
|
|
Aeson, would you mind checking just one or two data points at Monarch or higher? Or if you would rather post the test map you are using, I would try it. Back in the dim recesses of my memory, it seems I once read that the corruption model changes slightly between Regent and Monarch, I think.
|
|
|  |
 |
|
Aeson
|
 |
orangesoda
Nov 2001 time: 22:18
|
|
quote: would you mind checking just one or two data points at Monarch or higher? Or if you would rather post the test map you are using, I would try it. Back in the dim recesses of my memory, it seems I once read that the corruption model changes slightly between Regent and Monarch, I think. |
One (or a combination) of the changes I made in the .bic was causing it to crash quite a bit. Not exactly sure what. It seems to have stopped loading for me at all. I would have done more testing last night otherwise. The changes I made in the .bic were just in areas to speed up testing, and shouldn't have affected the corruption numbers.
- Warriors, Spearmen, Archers not available to build. Speeds things up by not having to set new cities to wealth, or deal with units being completed.
- Courthouses, Police Stations, Airports, Aqueducts, and Hospitals with no tech requirements and cost 1 to build. Wasn't able to get to the tests I had planned for these.
- Settlers take no population to build, cost 1, added offense, defense, and movement rates.
- Desert (terrain that filled the map) with 25 commerce, food, and production.
I think that was it, not sure what caused the crashes.
The only difference between corruption by difficulty level seems to be in the Number of Optimum cities. These values can be found in the editor, and Alexman included them in his formula.
quote: 2) Difficulty level, Fv
This is a percentage that multiplies the number of cities factor. 1.0 for chieftain to 0.7 for deity. |
The steps are by .05 per difficulty level, with the exeption being Emperor to Deity, which takes two steps. I was just using Chieftain because a modifier of 1 gives the cleanest numbers. I'll do some other difficulty testing once I get a stable .bic 
Chieftain: 1.00
Warlord: 0.95
Regent: 0.90
Monarch: 0.85
Emperor: 0.80
Deity: 0.70
|
|
|  |
 |
|
chiefpaco
|
|
Canada
Feb 2002 time: 00:18
|
|
I just did a minitest and found pretty much no difference between commercial & non-comercial civs for the corruption by distance. Same test as CivFanatics' Bamspeedy did.
I'll post it up here. I haven't gone through your calculations for it yet, I wish to try it soon as I get a chance. Also, I have to find out why my non-commercial numbers don't match Bamspeedy's.
Edit: Test done on Chieftan level.
Attachment: corruption study3.zip
This has been downloaded 13 time(s).
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:18. Apolyton Time is 00:18. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|