dino_schoen
Chieftain
Good work!
You will get my postcard soon!

You will get my postcard soon!
for (iPass = 0; iPass < 3; iPass++)
{
for (iI = 0; iI < MAX_CIV_TEAMS; iI++)
{
if (GET_TEAM((TeamTypes)iI).isAlive())
{
if (iI != getID())
{
if (isHasMet((TeamTypes)iI))
{
if (canDeclareWar((TeamTypes)iI))
{
if (iNoWarRoll >= AI_noWarAttitudeProb(AI_getAttitude((TeamTypes)iI)))
{
int iDefensivePower = (GET_TEAM((TeamTypes)iI).getDefensivePower() * 2) / 3;
if (iDefensivePower < ((iOurPower * ((iPass > 1) ? AI_maxWarDistantPowerRatio() : AI_maxWarNearbyPowerRatio())) / 100))
Hi Anion,
I'll answer your pm publicly since I do have a code question and maybe someone does understand c++ better than I (I only learned it by reading the Civ4 code).
First the easy thing (since I know this from the AIAttitude stuff):
iWarmongerRespect can be 0,1 or 2 (can of course be modded to whatever but that is the original game). When two AI leaders meet this is a bonus on their relations - the smaller of both values for the two leaders is the modifer, i.e. if one has 2 and the other 0 it is o, if one has 2 and the other 1 it is +1 and if both have 2 it is +2. If you look through the xml you'll see that the aggressive AIs tend to have 2 and the non-aggressive once tend to have 0, this value ensures that the warmongers do not start to go after each other if they start near each other and have easier prey nearby.
iMaxWarXXXPowerRatio
describes the Power Ratio between the AI and its intended target in order to declare war. If the AI is not powerful enough it will not declare, IIRC "Nearby" means if both share borders and "Distant" means if they do not share borders - Note: this is true for Vanilla and Warlords but not necessarily so in BtS - see below.
iTargetNumCities
does only two things: it determines how many "largest cities" get the happiness bonus from Representation (and how much the AI values Representation) for each map size and how far apart the map generator tries to position start positions.
I have checked the Power Ratio stuff: Blake apparently deleted most of it and just commented it prevents conquest or Domination victories, the only remaining snipplet where it is relevant is:
I do believe I understand this code, but could someone tell me if they see any instance in which this will not return AI_maxWarNearbyPowerRatio()?, i.e. where iPass actually is >1?Code:for (iPass = 0; iPass < 3; iPass++) { for (iI = 0; iI < MAX_CIV_TEAMS; iI++) { if (GET_TEAM((TeamTypes)iI).isAlive()) { if (iI != getID()) { if (isHasMet((TeamTypes)iI)) { if (canDeclareWar((TeamTypes)iI)) { if (iNoWarRoll >= AI_noWarAttitudeProb(AI_getAttitude((TeamTypes)iI))) { int iDefensivePower = (GET_TEAM((TeamTypes)iI).getDefensivePower() * 2) / 3; if (iDefensivePower < ((iOurPower * ((iPass > 1) ? AI_maxWarDistantPowerRatio() : AI_maxWarNearbyPowerRatio())) / 100))
In any case maxWarNearbyPowerRatio and maxWarDistantPowerRatio determine how strong the AI has to feel in order to declare war on its target (the aggressive ones tend to need less than the non-aggressive ones).
The outermost for-loop sweeps from 0..3 using iPass. So the first 2 loops give maxWarNearbyPowerRatio and the last 2 give maxWarDistantPowerRatio.
yeah after some
and some more
I understood this as well and came back to edit my post, but you were faster
Basically what it does is loop through all those arguments and checks for a fight to pick up at NearbyPowerRatio then it goes back and rechecks then it checks twice for DistantPowerRatio and if it still does not find a fight to start it gives up - until next turnDistantPowerRatio therefore is now only a surrogate if NearbyPowerRatio is too high to find an opponent it will relax and start a fight with a stronger opponent (DistantPowerRatio is usually easier to achieve than Nearby).
How sad - 22,000 downloads so far and only 8 postcards.![]()
I noticed an undocumented change, all the buildings that used to generate EPs don't anymore. So Jail is +50% EPs, Security Bureau just gives the 50% defense, and Intelligence Agency just gives +50% EPs. It was a fairly significant (and IMO good) change, I'm not sure why it wasn't in the release notes.
Darrell
I noticed an undocumented change, all the buildings that used to generate EPs don't anymore. So Jail is +50% EPs, Security Bureau just gives the 50% defense, and Intelligence Agency just gives +50% EPs. It was a fairly significant (and IMO good) change, I'm not sure why it wasn't in the release notes.
Darrell