# Do you think you understand corruption (pre-C3C)?

Discussion in 'Civ3 Strategy Articles' started by alexman, Apr 9, 2002.

1. ### VeteranChieftain

Joined:
Feb 2, 2003
Messages:
57
Location:
Athens,Greece
-friend alexman or anyone else pls do write a few details of how we can use correctly the corruption calculator ...thanx indeed
-especially how we enter the values in distances!

2. ### alexmanKing

Joined:
Feb 28, 2002
Messages:
778
Location:
Maryland, USA
I'm not going to write a manual for such a simple program, but I would be glad to answer any specific questions.

To enter the distance, just count the tiles from the city in question to the capital (or to the FP, whichever is closer). The two numbers you enter are the components of the distance in the orthogonal directions Northwest-to-Southeast and Northeast-to-Southwest.

I recently updated the calculator to use DavidesJ's distance formula.

3. ### anarresanarchist revolutionary

Joined:
Apr 22, 2002
Messages:
6,069
Location:
www.civ3duelzone.com
alexman,

I should have posted here before since this thread taught me loads about corruption, I guess I am just a little lazy.

Thanks also goes to DavidesJ for his distance calculation. I guess the distance formula is the same for all Civ matters, and so I have updated my FlipCalc accordingly too.

Thanks guys!

4. ### DaviddesJDeity

Joined:
May 5, 2003
Messages:
4,349
Location:
Burlingame CA
I'm not sure this is true. For example, the number of your cities within a distance of 8 affect the choice of new capital when you lose your capital, but the "distance" used for that purpose is different than the distance used for corruption.

I'm not even absolutely sure that the distance used for number-of-cities corruption is the same as the distance used for distance-to-capital corruption. Although that seems likely, because I've never noticed two cities in the same ring having different corruption levels, even by a tiny amount.

I think different people implemented different parts of the Civ3 code, and they each used their own methodology, so there may not be much internal consistency.

Still, I agree that the corruption distance is probably the "best guess" for how to compute distance for flips. Perhaps it would be possible to set up some test games and test this hypothesis, but it would be quite a bit of work.

5. ### DaviddesJDeity

Joined:
May 5, 2003
Messages:
4,349
Location:
Burlingame CA
A detail about corruption that's not mentioned in the main article of this thread is how rounding works. It seems to be this: once the corruption percentage is computed, then multiply it by the shields/turn to compute waste, and round to the nearest integer.

E.g., if corruption is 10%, then there will be no waste if you produce 1-4 shields, 1 waste if you produce 5-14 shields, 2 waste if you produce 15-24 shields, etc. Thus, if you're producing 4 shields then adding a 5th gives you no benefit.
I call these values (at which adding another shield gives no benefit) breakpoints: 4, 14, 24, etc., in this example.

Notice that it's usually a long way from the 1st breakpoint to the 2nd breakpoint, if corruption is low, but after that they are evenly spaced.

P.S. This calculation seems very close, but not 100% exact. It gives about 98% correct results, but occasionally the corruption percentage appears to be 1-2% different from what's calculated using the formulas in this thread. I'm not sure what accounts for that.

6. ### anarresanarchist revolutionary

Joined:
Apr 22, 2002
Messages:
6,069
Location:
www.civ3duelzone.com
DaviddesJ,

I am going to set up some tests when I have time, although they will not be totally trivial to perform.

Until then I think is likely that distance to capital or FP is more likely to be the same as the distance used in corruption calcs, and I agree, it is likely that city rank is the same too.

I will let you know either way when I do the tests.

7. ### alexmanKing

Joined:
Feb 28, 2002
Messages:
778
Location:
Maryland, USA
Thanks for verifying that. I suspected that actual corruption was calculated that way, but most of my initial tests involved cities with 100 uncorrupted shields, so I never got to see for sure which way the rounding went. I'll update the initial post.

Joined:
Oct 5, 2001
Messages:
30,074
Daviddesj,

Bang-on!

However, it got me thinking: In-Game, all locations are measured in an (X,Y) co-ordinate system. Surely there must be some easy formula to relate the distance between (X1,Y1) & (X2,Y2).

In Civ II, the map locations were given to you in-game when you clicked on a square, and people had spent a lot of time analysing the resutls for such things as trade deliveries. On a hunch, I tried the Civ II formula, and the numbers agree with you observations.

The link that I stole the formula from is here, but the basic formula is as follows:

The important thing to note is that a move NW decreases both X & Y by 1, and a move SE increases both by 1.

A move NE increases X by 1 and decreases Y by 1.
A move SW decreases X by 1, and increases Y by 1.

The easy way to remember this: X increases with any move towards the right; Y increases with any move down.

9. ### alexmanKing

Joined:
Feb 28, 2002
Messages:
778
Location:
Maryland, USA
Thanks for digging that up. It's nice to know how Civ2 worked, but in Civ3 that distance formula is clearly not in agreement with what DaviddesJ has found.

Take x greater than y.

Then DaviddesJ's formula gives:
Distance = x + y/2

And Samson's formula for civ2 gives:
Distance = (x+y)/2 + (x-y)/4 = 3x/4 + y/4

These two are clearly not the same for all x > y

As for that round map business, it is already implied in DaviddesJ's formula by the way he defines x and y.

Joined:
Oct 5, 2001
Messages:
30,074
That's because Daviddesj's X & Y are not the Samson / Civ internal X & Y.

Daviddesj's X & Y are the number of squares moved in a given direction; the Civ one is a location reference.

Eg:

Consider a move 3 squares SE and 1 square NE. Daviddesj's formula gives the distance = (Max(3,1) + 0.5 * Min(3,1)) = 3.5.

For the Samson formula, assume you start at (X,Y) = (0,0). This move would take you to (4,2).

Y Distance = (2-0) = 2
X Distance = min(4 and 100-4) = 4

Thus distance = (4 + 2) / 2 + abs(4-2)/4
= 3 + 0.5 = 3.5

11. ### DaviddesJDeity

Joined:
May 5, 2003
Messages:
4,349
Location:
Burlingame CA
Sure, the formulas are equivalent. Maybe I shouldn't have used "X" and "Y" as the variables, when I described the calculation. (I wasn't aware that the game uses them internally in a different way. Are X and Y ever displayed in the game, or only stored internally?)

Anyway, the most useful thing to remember is the underlying explanation of how to determine the distance: take the shortest path, where NW/NE/SW/SE moves count 1.0 and N/E/S/W moves count 1.5. Both formulas are both just different ways of expressing that rule mathematically.

Joined:
Oct 5, 2001
Messages:
30,074
They are used extensively internally. However, the only real way to see them (easily) is via the editor. Open the editor, move the mouse around the screen and you will see the x,y locations.

13. ### DianthusSmall but hardy

Joined:
Mar 26, 2003
Messages:
5,814
Location:
Woking, UK
You can also show them in the editor via the View->Grid Coordinates menu item (or Ctrl+Shift+G for you keyboard freaks).

14. ### alexmanKing

Joined:
Feb 28, 2002
Messages:
778
Location:
Maryland, USA
Oops, my bad. I didn't realize how the civ coordinate system was set up. I was assuming it was aligned with the NE/SW, NW/SE directions.

15. ### benspottoChieftain

Joined:
Jul 30, 2003
Messages:
1
Hi, in the latter stages of the game when I have loads of cities spread over a large area, I move my capital city around gradually. This kills corruption in the cities nearby and corruption doesnt seem to increase that much in the cities that used to be around the capital, maybe because they have become large with extensive improvements.

16. ### BamspeedyWe'll dig up the road!

Joined:
Dec 18, 2001
Messages:
7,795
Location:
Amish Country, Wisconsin, USA
Well, of course the courthouses would reduce corruption, but the libraries/marketplaces would also make it 'appear' that you have better corruption, because those improvements are multiplying the uncorrupted gold. So when you moved the palace all those cities will get a little more corruption (and the increased corruption doesn't get multiplied by the buildings, so you really are losing more commerce).

Yes, moving the palace around may help you build up areas faster, so your complete civ gets built up with all the improvements (eventually). But most times it just is not worth the shields/time to keep moving the palace several times. You don't need every one of your cities in the world to have all the improvements to win the game. Just 2 solid good cores (palace/forbidden palace) is all you need.

17. ### DianthusSmall but hardy

Joined:
Mar 26, 2003
Messages:
5,814
Location:
Woking, UK
Another way, unless your empire is excessively large, is to change governments to Communism while you build your Courthouses/Police Stations, then change back to your preferred government when they are built. Obviously this works best on a Religious Civ, but it would probably be preferable to moving the Palace around for a non-religious civ.

18. ### YndyEmperor

Joined:
Jun 29, 2002
Messages:
1,415
Location:
Romania
ACtually when I get two leaders per turn and use them to build Tanks or Modern Armor I would move the Palace around to build those marketplaces sooner. I would actually lose some money with this move but it would be OK for milking purposes

19. ### BamspeedyWe'll dig up the road!

Joined:
Dec 18, 2001
Messages:
7,795
Location:
Amish Country, Wisconsin, USA
By the time I'm building marketplaces in all those high-corrupt cities, I have all of that area irrigated, so having those cities produce just a few more shields isn't worth all the increased corruption from your core cities that already have marketplace/bank/etc.

Dianthus, that may work with some play styles. But when you have 400+ cities, the best city in communism produces only about 6 shields/turn no matter how big it is, or how heavy it is mined.

20. ### DianthusSmall but hardy

Joined:
Mar 26, 2003
Messages:
5,814
Location:
Woking, UK
Hence my "unless your empire is excessively large" at the start of the post