1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Everything about Corruption: C3C edition

Discussion in 'Civ3 Strategy Articles' started by alexman, Jan 25, 2004.

  1. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    This is a guide about how corruption works in Conquests. It's slightly different than how it used to work in PTW and vanilla Civ3.

    The information that follows was discovered by extensive testing and contributions by numerous members of the Civ3 community, including Aeson, DaviddesJ, Nor Me, and Qitai. We also recently got some inside information (a look at some of the actual corruption code), which helped find the last few missing pieces of the corruption puzzle.

    DEFINITIONS

    Corruption in Civilization 3 is commerce from city tiles that cannot be used by the empire. Corrupted commerce is indicated graphically in the city screen by stacks of red coins. There are numerous factors that influence corruption, all of which are addressed in this article.

    Waste is the loss of production as opposed to commerce, and is governed by almost the same rules as corruption. Everything in this article that applies to corruption, also applies to waste, unless otherwise mentioned.

    CORRUPTION BASICS

    The total corruption in each city is equal to the sum of two independent components: distance corruption, and rank corruption.

    For non-communal government types, distance corruption depends on the distance of each city from its closest palace. Rank corruption in a city depends on how many other cities are closer than that city to the palace.

    For communal government types, distance corruption does not actually depend on distance. Each city is considered to be the same distance from the Palace. Rank corruption depends on the total number of cities in the empire.

    You can reduce corruption in your cities by building appropriate city improvements and Wonders, changing to a more efficient government, choosing a Commercial civilization, and connecting your cities to the trade network of your empire. In addition, you can reduce waste by bringing your cities into a WLTKD celebration.

    You can determine the total number of ‘red’ commerce in a city by multiplying its total corruption by the number of raw commerce produced by citizens working the land, rounded to the closest integer.


    DISTANCE CORRUPTION

    For all non-communal government types, the distance corruption component is proportional to the distance of a given city from its closest Palace. For communal governments, the distance to the closest Palace is considered to be the same for all cities on a given map. The “closest palace” to a city can be the Palace, the Forbidden Palace, or any other Wonder with the “reduces corruption” ability.

    For corruption purposes, distance is always an integer number, and is given by:
    Code:
         d = max(x,y) + min(x,y)/2
    where
         max(x,y) denotes the maximum between x and y,
         min(x,y) denotes the minimum between x and y,
         x is the distance in the NW/SE direction,
         y is the distance in the NE/SW direction,
    and the integer division is rounded down.
    
    In the special case of communal governments, the distance for all cities is taken as:
    Code:
         d = (MaxD) / 4
    
    where MaxD = (MapW+MapH)/4, MapW is the width of the map, and MapH is the height of the map, as given in the editor.

    The distance, d, is used to get the adjusted distance, da, as follows:
    Code:
          da = 0.5^Ni * min(Gd * t * d, MaxD)
    where
         Ni is the number of anti-corruption buildings,
          t = 1 if the city is on the trade network
              5/4 otherwise
         Gd = 3/2 for Rampant corruption (Despotism)
              3/4 for Minimal corruption (Democracy)
              1 otherwise
    
    For waste calculations only, when the city is in a WLTKD celebration, divide da by 2.

    So each anti-corruption building, which is a city improvement with the “reduces corruption” ability in the editor (Courthouse and Police Station), divides distance corruption by 2.

    Finally, the exact value of the distance corruption component is given by:
    Code:
         Cd = da /MaxD
    
    RANK CORRUPTION

    The rank corruption component depends on the rank (R) and optimal city number (Nopt) of each city.

    In a non-communal type of government all cities of an empire are ranked in order of distance to the capital, starting at zero for the capital itself. If several cities have the same distance to the capital, they are ranked in order of founding, and if they also have the same date of founding, they are ranked by their order in the database. In a communal form of government, all cities have the same rank, which is half the total number of cities in the empire, rounded down.

    Each city also has its own optimal city number, Nopt, given by:
    Code:
         Nopt = max(OCN * (L/100 * (1 + c + Gr + Gp*Nwe) + 0.25*Ni), 1)
    where
         OCN  is the optimal number of cities for the map size,
              as found in the editor
         L    is the percentage of optimal cities for the current
              difficulty level, as given in the editor
         Nwe  is the number of active Wonders in the empire with
              the “reduces corruption” ability
              (Forbidden Palace, SPHQ)
         c =  0.25 for a commercial civilization,
              0 otherwise
         Gr = 0.1 for minimal or nuisance corruption
              2 for communal corruption
              0 otherwise
         Gp = 3/8 non-communal corruption   
              3 for communal corruption
    
    For waste calculations only, when the city is in a WLTKD celebration, add OCN/4 to Nopt.

    The rank corruption for a city is then given by:
    Code:
         Cr = R / (2 * Nopt), if R < Nopt
             (2 * R –- Nopt) / (2 * Nopt) otherwise
    
    MAXIMUM CORRUPTION

    The sum of the distance and rank components of corruption can be greater than 100%. The game sets an upper limit for the total corruption in a city to be equal to 90% minus 10% for each city improvement and minus 70% for each Wonder in the city with the “reduces corruption” ability:
    Code:
         Cmax = max(0.9 – (0.1 * Ni + 0.7 * Nwc), 0)
    
    POLICEMAN SPECIALISTS

    By assigning one of your citizens to be a policeman, you can cause one corrupted commerce and one wasted shield to become uncorrupted. This reduction in corruption comes before applying the maximum corruption limit described in the previous section, so the city may not show any reduction if was already taking advantage of that limit.

    SUMMARY

    To summarize the above, distance corruption depends on the distance of the city from the closest palace (or a constant number for communal governments), multiplied by a factor that depends on the government type, and another factor if the city is not connected to your capital by road, harbor, or airport. Each corruption-reducing building in the city halves distance corruption.

    Rank corruption depends on the ratio of the city rank to the adjusted optimal city number. The city rank is equal to the number of cities closer to the capital (or half the total number of cities for Communism). The rate of increase of this corruption with rank doubles after rank exceeds the optimal city number. The optimal city number of the map gets modified by the difficulty level, the commercial trait, the current government, and the number of improvements and Wonders with the “reduces corruption” ability.

    Courthouses and Police Stations decrease distance corruption and increase the optimal number of cities. They also each decrease the maximum corruption limit.

    The Forbidden Palace acts as a second Palace for distance corruption calculations, but not for rank calculations. The Forbidden Palace itself will have low corruption, but if there are many cities closer to the Palace than the Forbidden Palace, the cities around the Forbidden Palace will have high rank corruption. However, even though it doesn’t provide a new set of city ranks, the Forbidden Palace reduces rank corruption throughout the empire by increasing the optimal number of cities.
     
  2. Qitai

    Qitai .

    Joined:
    Jan 22, 2002
    Messages:
    1,177
    Location:
    SG.MY.TW.US
    :goodjob:

    Once again, a BIG THANK YOU for uncovering all the details and posting it for all of us.
     
  3. Darkness

    Darkness Shadow creature

    Joined:
    Jul 18, 2002
    Messages:
    6,755
    Location:
    Rotterdam, the Netherlands
    :goodjob:

    Very good and comprehensive article. This should help the rest of us, who don't have the slightest clue on how to figure this out ourselves, very much. Thanks!
     
  4. smphang

    smphang Chieftain

    Joined:
    Aug 6, 2002
    Messages:
    68
    :goodjob:
    This is much appreciated! I have been waiting for this for ages now... BIG THANK YOU!!!
     
  5. T-hawk

    T-hawk Transcend

    Joined:
    Feb 14, 2002
    Messages:
    2,579
    Location:
    Hoboken NJ / NYC
    What does this mean?

    Two different numbers for communal corruption?

    Also, I'd like to point out that the maximum corruption formula means that the Forbidden Palace (or SPHQ) city gets all corruption eliminated with a courthouse and police station (0.9 - 0.7 - 0.1 - 0.1 = 0.) I observed this effect in a game I'm playing, and was wondering why that happened...

    Finally, is the Palace city having zero corruption a special case? Tavis indicated that there is indeed a special-case check in the code for that.
     
  6. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    Thanks. :)
    The real value is 2.
     
  7. T-hawk

    T-hawk Transcend

    Joined:
    Feb 14, 2002
    Messages:
    2,579
    Location:
    Hoboken NJ / NYC
    OK, looking over the post again, here's a few things I want to address. Let me know if I get any of this wrong... :)

    ----------

    Nopt = max(OCN * (L/100 + c + Gr + Gp*Nwe + 0.25*Ni), 1)

    In English, the "max" in that formula just means that modified OCN is always at least 1. This is irrelevant unless you've modded the game such that OCN * the editor value for percentage of optimal cities can result in below 1.

    Rewriting the formula in a bit more English and ignoring Communism:

    Modified OCN = base OCN * (1 - 10% per difficulty over Regent + 25% if commercial + 10% if Republic/Democracy/Fascism + 37.5% per active FP/SPHQ + 25% per courthouse/police/WLKTD[shields only] )

    Note that the additive nature of those factors means that modifiers, particularly the Commercial trait, have more relative impact on higher difficulty levels. On Regent, the Commercial trait increases OCN from the base to 1.25 times the base, a 25% increase of course. On Sid, it bumps OCN from 0.5*base to 0.75*base, an increase of 50% over the original - relatively twice as much!

    ----------

    In Communism:

    First, the distance formula when simplified into English says that distance corruption is always a flat 25% for Communism, and can be halved twice by improvements. alexman, you may want to note this.

    Modified OCN = base OCN * (1 - 10% per difficulty over Regent + 25% if commercial + 200% + 300% per FP/SPHQ + 25% per courthouse/ police/WLKTD)

    This means that with FP and SPHQ, OCN in Communism goes up to at least EIGHT TIMES the base OCN. 160 on a standard map! This might be a wee bit overpowered. Even with 60 cities which is a LOT (usually close to domination), rank corruption is only 8.5%. Add the distance corruption and you get 33.5% with no courthouse-type improvements, 21% with one, and 15% with both.

    Basically, in Communism as compared to a palace-centric government, your second-ring of cities extends forever, and every city can be improved to first-ring status.

    ----------

    You should often build a courthouse in the city before building the Forbidden Palace now, because it continues to provide benefits even after the FP is built. If the city's corruption (entirely due to rank, of course) is greater than 10% even after the FP, the courthouse will cap the max corruption at 10%. On a standard map (OCN=20) on Emperor, applying the adjustments of OCN*0.1 for Republic and OCN*0.375 for having the FP built, rank corruption exceeds 10% at the 6th city from the Palace.

    So on a standard map, if you build the FP in second-ring or farther, definitely build or rush a courthouse there first. If you build the FP right next to the capital, a courthouse isn't necessary. And once police stations are available, you should always build both that and a courthouse in the FP city as doing so will reduce the city's corruption to 0.

    ----------

    alexman may have missed it when I edited my last post, but there appears to be a special-case check that corruption for the Palace city itself is always 0, and this applies even in Communism.
     
  8. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    The Palace always has zero corruption, but it's not a special case as far as the above is concerned. The distance of the palace to itself as well as its rank is always zero.
     
  9. CIVPhilzilla

    CIVPhilzilla Reagan Republican

    Joined:
    Aug 24, 2003
    Messages:
    4,714
    Location:
    Pennsylvania
    Big thanks. Never had the patience to find the whole algorithims associated with corruption.

    :goodjob::thanx::goodjob::thanx::goodjob::thanx::goodjob:
     
  10. akots

    akots Poet

    Joined:
    Aug 5, 2003
    Messages:
    3,981
    Location:
    Moscow-Houston, Russia-USA
    I have a question about distance calculations. Since the search is disabled, I could not find the answer which is probably in some earlier studies. We have city A with coordinates (x1,y1) and city B with coordinates (x2,y2) with coordinates as found in the editor N/S and E/W coordinate system. What is distance between A and B in the corruption equation? As I understand, for distance calculations, another coordinate system is used with x in NW/SE and y in NE/SW.

    Another question is the rank in case of same date of founding is the order in the database. Which is sequence in which they were founded? Or something else (Nopt) or random?

    Another stupid question. I have run some tests with C3C 1.12-1.13 and it looked like rank corruption does not depend on map size substantially which might be true if c=0, Gr=0, Gp=const, Ni=0, and hence making the whole Nopt value constant. Is this an intended feature? Is that true for 1.15? It might make the game extremely difficult on higher levels and large maps.

    And the last. Just curious why the MaxD is (MapW+MapH)/4 as given in the editor and how this agrees with distance calculations as asked in first question. Logical assumption would be sqrt((MapW/2)^2+(MapH/2)^2)). If it might be something to determine maximal distance, how does the map x wrapping (round/cylinder world with no actualy y-wrapping) work in this case cutting MaxD by at leat 20-25%? Or this is just disregarded?
     
  11. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    It's the same distance calculation in a different coordinate system. In the editor coordinate system the distance would be given by:
    d = (X + Y) / 2 + |X - Y|/4
    where Y = |y1-y2| and X = |x1-x2|
    see ainwood's post in the original corruption thread.

    The database order is the order in which cities appear when you navigate using the arrow buttons. It's often the same as the founding order, but if a city gets razed, the next founded city takes the spot of the city that was razed.

    Rank corruption always depends on map size because the OCN is different for each map size.

    MaxD is not intended to be the maximum possible distance on a map. It's just an arbitrary number, and it's called MaxD because the distance for corruption purposes of any city farther than MaxD from its closest palace is taken to be equal to MaxD.
     
  12. akots

    akots Poet

    Joined:
    Aug 5, 2003
    Messages:
    3,981
    Location:
    Moscow-Houston, Russia-USA
    Thanks very much for clarification. Then I have another question. Lets consider a cylinder map 60x60. In this case capitol in x1=1, y1=1 will be located at considerable distance from a city located at x2=59, y2=1. However they are 2 tiles apart from each other. Is that correct?

    It seems that I have run the test when OCN multiplier in the Nopt equation is very close to 1 (it was 0.975) making Nopt equal OCN for all cities. I have determined Cr as total corruption minus Cd determined in a separate test. Since Cd is already a function of MaxD which is the function of map size and rank of a city is based on distance, this means that distance is included in Cd and Cr twice for total corruption calculations. Apparently, I had all distance-function components pooled under Cd and Cr being some residual component which indeed did not depend on map size. Well, now this error is more or less clear. It looks like both Cd and Cr depend on distance in a linear fashion with more or less reasonable city placement which is extremely confusing. Apparently, initial intention was to separate these components. However, it looks like they are not separate but are essentially the same and are just influenced by different things, i.e., different ways to fight these two component during the games. Why not use da for rank calculations, for example? Because this would lead to Palace jump exploit or da-Palace has to be calculated separately (why not?). Why Ni is included in both da and Nopt equations? Because it would not make sense otherwise.

    In other words, the two components of corruption are indeed functions of fractional distance with Cd considering da from FP/closest capital and Cr includes only distance from Palace. From practical point of view, this is too complicated to analyze and can be split in two parts: distance-dependent and city rank/number-dependent. And these components (what is observed and not how it is calculated) can be clearly separated.
     
  13. smphang

    smphang Chieftain

    Joined:
    Aug 6, 2002
    Messages:
    68
    Just notice this (i know... i am slow reader...)

    "If several cities have the same distance to the capital, they are ranked in order of founding, and if they also have the same date of founding, they are ranked by their order in the database."

    Does this mean RCP is now invalid?
     
  14. Svar

    Svar Chieftain

    Joined:
    Jun 10, 2003
    Messages:
    615
    Location:
    China Lake, Ca
    RCP and the FP/Palace bug are dead in C3C.
     
  15. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    The expression for distance on a cylindrical map where you cross the "dateline" can be found easily once you know the expression for a flat map (above), so it is left as an excercise for the reader. ;)

    You are getting confused because you are varying rank as well as distance. To prove that Cr doesn't depend on distance, set OCN=1000 and build just two cities. The corruption in the second city (not the palace, call it A) will be (more or less) equal to Cd. Then, set OCN back to the normal value for that map, and build several cities between the palace and city A. Find Cr in A by subtracting Cd from its total corruption. Repeat the same experiment with A at a greater distance from the palace and all the other cities in the same locations as before, and you will find that Cr will be the same as in the first experiment, even though city A is at a different distance. You will find the same Cr even if you repeat the experiment on a different size map, provided that you use the same OCN in both cases.
     
  16. akots

    akots Poet

    Joined:
    Aug 5, 2003
    Messages:
    3,981
    Location:
    Moscow-Houston, Russia-USA
    Uh, what I wanted to ask actually is that on a cylindrical map, corruption would be lower than on a flat map. If the Palace and surrounding cities are located in the corner or a cylindrical map (e.g., SW) and then have choice of spreading further W to the eastern half of the map or E, then obvious choice would be to spread W. On a flat map, spreading further W is not possible, so the player is forced to spread E which eventually results in higher corruption. Is that correct?

    Regarding the other Cr,Cd test, I did it almost exactly like you describe but using RCP instead to simplify calculations: here and here. It was done with 1.12/1.13. I will try to repeat exactly what you suggested in 1.15.

    The problem is that for a reasonably placed cities (even with RCP), rank is a function of distance (independent on map size!) but dependent on area (also independent on map size), whereas OCN multiplier in this case is essentially constant, i.e., increasing proportionally to dimensions. Obviously, that on a larger map, the number of surplus cities you can put in is proportional to increase in area. Thus, apparently, Cr depends on distance.

    I tried to negate this by investigating what is going on in RCP system where all cities have equal Cd and different Cr. However, when I measured Cd with 2 cities, the OCN was not set to 1000 but remained default. On the other hand, plots are linear anyhow, so it might be the contribution of this error in the final data is relatively small.

    Can you please tell me what is wrong...
     
  17. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    I have not tested flat maps, but I would hope that what you're saying is correct, otherwise it would be a bug.

    There must be something wrong with your tests, because I have never seen evidence that rank corruption depends on distance. Post a save of a situation that you think does not agree with the corruption model in the initial post, and maybe I can help.
     
  18. akots

    akots Poet

    Joined:
    Aug 5, 2003
    Messages:
    3,981
    Location:
    Moscow-Houston, Russia-USA
    I want to re-check everything in 1.15beta first and double-check the OCN settings in the editor and then I'll post the results.

    Edited:
    To illustrate the absurd notion about the fact that rank corruption apparently depends on distance, the following equations can be used.

    Ct(total corruption)=Cd+Cr
    Cd=da/MaxD, or to simplify Cd=d*constant1/MaxD
    Cr=R/(2*Nopt) for simplicity assuming R<Nopt
    In general, R is function of dp (distance from Palace) or total number of cities (TCN) within a given dp. TCN=constant2*area, where constant2 is density of city placement. Therefore R is proportional to constant2*dp^2. In the system without FP or SPHQ, d=dp. OCN in Nopt equation and in the editor is roughly proportional to map size but not map area. OCN=constant4*MaxD. Assuming (L/100+c+Gr+Gp*New+0.25*Ni) OCN multiplier in Nopt equation is close to 1, then Nopt=OCN and Cr=constant2*dp^2/(2*OCN). Approximating OCN as above, Cr=constant2*dp^2/(2*constant4*MaxD).

    This results in Ct=d*constant1/MaxD+constant5*d^2/MaxD, where constant5=constant2/(2*constant4).

    Ct=d/MaxD(constant1+constant5*d)

    Hence, both components of corruption depend on distance. If OCN would depend on map area, then everything would be OK and balanced indeed between various map sizes. Assuming OCN for a tiny map is still 14, then OCN for small map can be 25, for standard map - 39, for large map 66 and for huge map - 100. It is probably too much but if OCN for tiny map is 10 instead of 14, the numbers become more reasonable: small - 18, standard - 28, large - 47, and huge - 71. Same pertains to TechRate. Now, corruption on a huge map is about 3 times higher than it should be and TechRate is about 3 times higher also. These are default tabulated values which might be easily changed. No wonder people who play on huge maps are complaining a lot. However, it is hard to evaluate the tech rate. The changes would really slow down ancient era tech research pace (making 50-turn gambits work) and have little effect on later advancement because civilizations would reach considerable size and corruption is lower.

    Edited again: Is this a bug/misunderstanding of basic principles or intended feature? Certainly FP/improvements/government and Communism/SPHQ change a lot but still Cr depends on distance and not on map size.
     
  19. Qitai

    Qitai .

    Joined:
    Jan 22, 2002
    Messages:
    1,177
    Location:
    SG.MY.TW.US
    akot>

    Rank corruption is not affected by distance. However, the rank of a city itself is dependent on distance since the cities are ranked by distance. This means for a fixed rank, the distance do not affect rank corruption.

    OCN can be found in the editor. Map size affects the OCN and thus indirectly corruption. If you start playing around with the OCN, then it will look to you as if that the map size does not matter. But for a normal game, since OCN changes with map size, corruption level will change with map size. So, to a casual player who plays only epic game, bigger map do mean lower corruption.

    Tech cost is also map size dependent. Again, this can be found in the editor. This is the reason why it takes longer to research on huge map, not the corruption level.
     
  20. alexman

    alexman Chieftain

    Joined:
    Feb 28, 2002
    Messages:
    778
    Location:
    Maryland, USA
    This is true only if you enforce the additional restriction of constant city density. In genaral, if A and B are independent, but you say that you will choose A only if it's the same as B, then of course they will no longer be independent!

    Except that there are a different number of civilizations for each map size, so the number of tiles available to each player is proportional to the area of the map divided by the number of players. If you take that into account, the ratio of the map OCN to the tiles available to each player (for the default number of civs) is actually higher for a tiny map and lower on a huge map. :)
     

Share This Page