Afforess
The White Wizard
The AD code is more correct this time. I added more functionality in the modcomp then I have/had in AND. 

if (bDanger && (iExistingWorkers == 0) && (isCapital() || (iNeededWorkers > 0) || (iNeededSeaWorkers > iExistingSeaWorkers)))
think the early warplans are just a byproduct of jdog's changes to CvTeamAI::AI_isLandTarget, and you can keep this from happening by adding a true to the argument list when using that function in doWar, that way you actually save cpu cycles.I agree. The AI seemed to try to start a war wayyy too early. I added some code to block it. Feel free to nitpick it
if ((iPass > 1) || AI_isLandTarget((TeamTypes)iI[B], true[/B]) || AI_isAnyCapitalAreaAlone() || GET_TEAM((TeamTypes)iI).AI_isAnyMemberDoVictoryStrategyLevel4())
{
if ((iPass > 0) || (AI_calculateAdjacentLandPlots((TeamTypes)iI) >= ((getTotalLand() * AI_maxWarMinAdjacentLandPercent()) / 100)) || GET_TEAM((TeamTypes)iI).AI_isAnyMemberDoVictoryStrategyLevel4())
{
iValue = AI_startWarVal((TeamTypes)iI);
if( iValue > 0 && gTeamLogLevel >= 2 )
{
logBBAI(" Team %d (%S) considering starting TOTAL warplan with team %d with value %d on pass %d with %d adjacent plots", getID(), GET_PLAYER(getLeaderID()).getCivilizationDescription(0), iI, iValue, iPass, AI_calculateAdjacentLandPlots((TeamTypes)iI) );
}
if (iValue > iBestValue)
{
iBestValue = iValue;
eBestTeam = ((TeamTypes)iI);
}
}
}
if (AI_isLandTarget((TeamTypes)iI[B], true[/B]) || (AI_isAnyCapitalAreaAlone() && GET_TEAM((TeamTypes)iI).AI_isAnyCapitalAreaAlone()))
{
if (GET_TEAM((TeamTypes)iI).getDefensivePower() < ((iOurPower * AI_limitedWarPowerRatio()) / 100))
{
iValue = AI_startWarVal((TeamTypes)iI);
if( iValue > 0 && gTeamLogLevel >= 2 )
{
logBBAI(" Team %d (%S) considering starting LIMITED warplan with team %d with value %d", getID(), GET_PLAYER(getLeaderID()).getCivilizationDescription(0), iI, iValue );
}
if (iValue > iBestValue)
{
FAssert(!AI_shareWar((TeamTypes)iI));
iBestValue = iValue;
eBestTeam = ((TeamTypes)iI);
}
}
}
What I think is right:
Code:int iHealth = goodHealth() - badHealth(); [COLOR="Green"]/********************************************************************************/ /* Better Evaluation 09.03.2010 Fuyu */ /********************************************************************************/[/COLOR] [COLOR="Gray"]int iHappyAdjust = 0;[/COLOR] [COLOR="Green"]// <-Don't redefine these variables where are already defined.[/COLOR] [COLOR="Gray"]int iHealthAdjust = 0;[/COLOR] [COLOR="Green"]// <-Don't redefine these variables where are already defined.[/COLOR] if (getProductionBuilding() != NO_BUILDING) { iHappyAdjust += getAdditionalHappinessByBuilding(getProductionBuilding()); iHealthAdjust += getAdditionalHealthByBuilding(getProductionBuilding()); } [COLOR="Green"]/********************************************************************************/ /* BE END */ /********************************************************************************/ /************************************************************************************************/ /* BETTER_BTS_AI_MOD 09/02/10 jdog5000 & Fuyu */ /* */ /* City AI */ /************************************************************************************************/[/COLOR] int iTargetSize = iGoodTileCount; [COLOR="Green"][s]//iTargetSize = std::min(iTargetSize, 2 + getPopulation() + goodHealth() - badHealth() + getEspionageHealthCounter() + std::max(0, iHealthAdjust));[/s][/COLOR] iTargetSize -= std::max(0, (iTargetSize - (1 + getPopulation() + goodHealth() - badHealth() + getEspionageHealthCounter() + std::max(0, iHealthAdjust))) / 2); if( iTargetSize < getPopulation() ) { iTargetSize = std::max(iTargetSize, getPopulation() - (AI_countWorkedPoorTiles()/2)); } [COLOR="Green"]// Target city size should not be perturbed by espionage, other short term effects[/COLOR] iTargetSize = std::min(iTargetSize, getPopulation() + (happyLevel() - unhappyLevel() + getEspionageHappinessCounter() + std::max(0, iHappyAdjust))); [COLOR="Green"]/************************************************************************************************/ /* BETTER_BTS_AI_MOD END */ /************************************************************************************************/[/COLOR]
Once again it was Afforess how noticed that the AI isn't focusing enough on city growth, I believe that might have been one reason.
I think I've found a bug with Better AI. I'm playing with v 1.01f, BUG 4.4 and my own mod which just adds new units/techs etc... In two consecutive games I discover a tech and am unable to trade it away, once with Theology and once with Education. When I press the F4 key it shows that the OTHER AIs "Can't Trade" even though they have the prereqs (I can check using Ctrl-Alt-L) - when I switch to the other AI it shows that my Civ "Can't Trade". It's like it's applying the Tech Monopoly AI code to the human player. I can supply a save game if needed.
Check in the xml if the tech has <bTrade>0</bTrade>.