Firaxis: Corruption Breakdown

Tavis

Firaxian
Joined
Jun 2, 2003
Messages
146
This is the "official" announcement on Corruption:

FIRST: Save Games CAN be continued but it will take a turn or so for the corruption to recalculate.

WHY WAS CORRUPTION CHANGED?????!?!?!?!?!?!?!?!?!

The formula that calculated Corruption (calculateCorruptionandWaste()), which includes the Forbidden Palace (FP) adjustments, was changed in C3C for several reasons:

1) It was necessary to expand the "Reduce Corruption" Small Wonder flag to allow MULTIPLE instances with this flag. The original formula was designed for just 1 Small Wonder with this ability (THIS design limitation was the #1 cause for adjustments to the algorithm)

2) Addition of Specialists that could adjust Corruption.

It should be noted that no values have changed and that every part of the calculation algorithms are IDENTICAL to Civ3/PTW (NOTE: I'm Diffing the code with 1.27 PTW's source ) EXCEPT those areas where MULTIPLE FP's have to be accounted for and the Ranking System.

The bug with the Forbidden Palace only being useful when local to your palace is caused by this line of code:

vectorDist(pRealCapital->getX(), pRealCapital->getY(), pLoopCity->getX(), pLoopCity->getY())

This is determining cityrank based on JUST the location of your "RealCapital". With the multiple FP setup this line of code should be:

vectorDist(pClosestCapital->getX(), pClosestCapital->getY(), pLoopCity->getX(), pLoopCity->getY())


With this issue fixed (as well as some other bugs ie: SPHQ always giving the bonus) the corruption system will work as redesigned. I realize that the system acts different from Civ3 & PTW, but please give it a chance before making your final decision. This system will benefit the game on all sides, from Diff Balancing to AI. Your feedback (yes the vocal people are the ones who get heard most... you have to be more vocal if you want to be heard!!) will ultimately decide how it functions in the Release Patch.

I do want to get some clarification on the additional variables from Mike B. Once I have it I'll post the information and explanation on how the additional variables are affecting the ranking system. I will also make an effort to include detailed information in the pre-patch release posting.


EDIT: I will also include MODders information and set it up for easy switching between versions.


Thanks,

Jesse
 
Thank you very much Tavis !
It's great to have these informations, now discussions on corruption can be a bit more constructive ;)

It's FEEDBACK TIME :lol: :)
 
Looking good so far!

Just one question - How is the optimal city number affected by the addition of the Forbidden Palace or SPHQ? My expectation is that adding one of these buildings would double the optimal city number, and that adding both (in communism) would triple it.

EDIT: Other thoughts...

Wouldn't the line

vectorDist(pClosestCapital->getX(), pClosestCapital->getY(), pLoopCity->getX(), pLoopCity->getY())

be redundant?

I say this because you already have a variable "pClosestCapital" defined at this point, implying that at some point in the past, you calculated the city's distance from each "capital" and compared the distances to determine which "capital" was closest. Therefore you should already have the appropriate distance stashed away in some variable somewhere.
 
Thanks Tavis :goodjob: its the little things like this that make you guys the best :goodjob:
 
Thank you for your answer, please continue with providing us the service we've come to expect from you and yours.

Release date on the patch? (final version)
 
WOW.

I feel that developer interaction and communication is a major factor in the creation of good games and good gaming communities. And that was some excellent communication on a very heated topic. Thank you for setting us straight on the situation, your plans, and making it clear that you would continue to listen to everyone.

If I understand correctly, the ultimate goal (once everything is working correctly) is that corruption will work like this once it is all fixed:

- Start with a basis of "It should all work like in PTW 1.27 unless otherwise specified".

- Fix RCP (or break it depending upon your viewpoint. :p I liked RCP, but agree that it improves the game to fix it).

- Add the ability to have multiple FP type buildings.

- Add the ability to have corruption / waste modifying specialists.

As of C3C, it appears that all of this ha been achieved with one bug added: The FP (and SPHQ) is not being correctly seen as a palace for distance based corruption calculations.

Is that everyone else's understanding as well, or am I misinterpreting / understanding something? It looks to me like the one remaining fix (post 1.12) is the line of code Tavis listed to base corruption off of the nearest Palace type structure instead of THE Palace.

This is good news indeed, and while it obviously should have happened pre-release, will finally make C3C not just fun because of the new elements and additions, but fully playable.
 
Thanks Tavis!

Yeti - in fact the bug is that the rank corruption is calculated from the Palace, instead of the nearest Palace-like structure (this is going to be 'fixed'). The distance corruption is currently (correctly) being calculted from the nearest Palace-like structure.
 
Assuming this works as it seems at a first glance, it will make the FP much closer to the good old familiar one from before C3C (i.e. it will actually be an effective corruption-fighting tool again).

This looks good to me. Thanks Tavis!
 
I have to repeat the many thanks. This level of understanding and interaction is what (IMHO) has given some relatively long legs to CivIII.

We will have to reserve judgement on how this affects overall game balance, but at least it all makes sense now. One question that I have is how the code will differentiate between FP cities and capital cities for rank calculation. For example, if there is just one list of city ranks, then building the FP will cause cities nearer the capital (but further away from the capital than other cities near the FP) to have increased rank corruption. There is also the possibility of two (or more) rank lists--one for each palace-like structure.

EDIT (correction) @anarres--as Tavis describes it here, the rank calculation will fixed in the beta patch update.

Now if I can just tear myself away from another game that seems to have this level of customer support... :p
 
Originally posted by Arizona_Steve
EDIT: Other thoughts...

Wouldn't the line

vectorDist(pClosestCapital->getX(), pClosestCapital->getY(), pLoopCity->getX(), pLoopCity->getY())

be redundant?

I'm guessing that this line of code is really pseudo-code that hasn't actually been written yet. It gives the correct indication of how it would work, but as you've picked up on, some previous math would need to be done to determine what the closest capital is first, and once that's done, you'd already know the vector distance for your current (pLoopCity) city.

I guess I can take a break from coding to code :p

They probably need something like this (assuming the capitals are in a vector of pointers to capital classes / structures, and the true palace, which always exists, = 0):

int DistanceToClosestCapital = vectorDist(pCapitalArray[0]->getX(), pCapitalArray[0]->getY(), pLoopCity->getX(), pLoopCity->getY());

for (int i = 1; i < pCapital.size; i++)
{
int Distance = vectorDist(pCapitalArray->getX(), pCapitalArray->getY(), pLoopCity->getX(), pLoopCity->getY());

if (Distance < DistanceToClosestCapital)
{
DistanceToClostestCapital = Distance;
}
}
 
Bam-Bam, maybe I am being stupid, but how does this quote say that rank is how it is meant to be in the patch? :confused:
The bug with the Forbidden Palace only being useful when local to your palace is caused by this line of code:

vectorDist(pRealCapital->getX(), pRealCapital->getY(), pLoopCity->getX(), pLoopCity->getY())

This is determining cityrank based on JUST the location of your "RealCapital". With the multiple FP setup this line of code should be:

vectorDist(pClosestCapital->getX(), pClosestCapital->getY(), pLoopCity->getX(), pLoopCity->getY())
This clearly says that atm the rank is calculated from the Palace whereas it should be calculated from the nearest Palace-like struture. What am I missing?
 
Originally posted by anarres
Yeti - in fact the bug is that the rank corruption is calculated from the Palace, instead of the nearest Palace-like structure (this is going to be 'fixed'). The distance corruption is currently (correctly) being calculted from the nearest Palace-like structure.

Ahhh, so the fact that even in 1.12 the FP does not create a new hub of low-corruption cities was not because of an issue with distance calculation, but because of an issue with city ranking?

That makes sense based on the fact that city ranking code was played with (to fix RCP), but based on the code snippets Tavis showed, it looks like the distance was also not being calculated correctly (unless the distance is calculated in one place correctly for part of the corruption calculation, and then recalculated (incorrectly) to determine the distance used to generate city ranking for use in the city ranking vs OCN portion of the corruption calculation?)
 
Exactly right anarres, distance corruption is working correctly and is the primary reason that the bug wasn't found right away (not to mention the negative corruption bug hiding it as well!!)

Believe me when I say that I hate bugs just as much as you do!!!
 
Anarres, Bam-Bam - the more I think about it, the more I think you're both probably hitting on part of the issue :)

Most likely they only calculate distance once.

Therefore if the distance calculation is incorrect (always from palace, not nearest capital), then both the distance corruption and the city ranks would be messed up.
 
Tavis, I might be doing too much second guessing. But the line

"vectorDist(pClosestCapital->getX(), pClosestCapital->getY(), pLoopCity->getX(), pLoopCity->getY())"

seems to only calculate the distance of the LoopCity to the ClosestCapital. This line would, in no way be able to identify the ranking of the LoopCity. So, I think you may need to look at the code more carefully. I apologize if I am wrong.
 
This code is there but it is a few calls up - the code I showed was for the actual determination of the Corruption Rings. The distance has already been calculated.




Originally posted by Yeti


int DistanceToClosestCapital = vectorDist(pCapitalArray[0]->getX(), pCapitalArray[0]->getY(), pLoopCity->getX(), pLoopCity->getY());

for (int i = 1; i < pCapital.size; i++)
{
int Distance = vectorDist(pCapitalArray->getX(), pCapitalArray->getY(), pLoopCity->getX(), pLoopCity->getY());

if (Distance < DistanceToClosestCapital)
{
DistanceToClostestCapital = Distance;
}
}
 
I didn't include the entire code block, just the incorrect line. Fortunately this time you are wrong (just not fully informed)

Originally posted by Qitai
Tavis, I might be doing too much second guessing. But the line

"vectorDist(pClosestCapital->getX(), pClosestCapital->getY(), pLoopCity->getX(), pLoopCity->getY())"

seems to only calculate the distance of the LoopCity to the ClosestCapital. This line would, in no way be able to identify the ranking of the LoopCity. So, I think you may need to look at the code more carefully. I apologize if I am wrong.
 
Top Bottom