It's true that the system compares the existing civic value with an alternative, but the key idea is that the evaluation of a civic still depends on whether you are actually using that civic or not.
For example, consider a civic which adds +3
, and you have a city which is currently at +1
. If you are considering switching
to the civic, then the happiness bonus will not be very valuable to you because your city is already happy. But if you are considering switching
away from the civic then the happiness bonus is very valuable - because without it you'd have 2
.
Here's an example of how `iS` is used in the code:
Code:
iValue += (iCities * 10 * iS * AI_getHappinessWeight(iS*kCivic.getExtraHappiness(), 0)) / 100;
Notice that `iS` is used twice here. When switching away from the civic, the coefficient at the start will be negative but the happiness coefficient will also be negative and so the final value will still be positive.
Interestingly, this to/from difference in the evaluation existed in some parts of the original AI for civics but it was removed by the author of the 'Better AI' mod because he thought it was a bug. The result of removing it was that the AI would sometimes switch back and forth between civics. For example, they'd switch to Representation for +
, but then once they had the
they'd switch back to Universal Suffrage because they thought they didn't need the
from Representation anymore.
Ideally it would probably be more accurate to evaluate civics by evaluating the effect differences between the current civic and the new civic individually rather than evaluating each entire civic independently. That's what I would do if I was writing the AI from scratch. But it would be quite a lot of work to change it now.