I've found a bug in Better AI that could explain why AI's tend to pick distant enemies far too often.
it's about this code:
that is added in Better AI to CvTeamAI::AI_calculateCapitalProximity which is used to determine the best victim for the next war. It's a score so higher values are better. It basically returns maximum distance minus capital distance in stock Warlords.
consider this map:
The results Isabella gets in Warlords 2.08:
Churchill: 74
Alexander: 72
Stalin: 57
Tokugawa: 64
Ragnar: 46
Bismarck: 34
Huayna Capac: 29
Player (Egypt): 19
Hannibal: 14
with Better AI rev. 368 everyone on her own continent gets vastly lower scores:
Churchill: 14
Alexander: 12
Stalin: 1
Tokugawa: 4
Ragnar: 46
Bismarck: 34
Huayna Capac: 29
Player (Egypt): 19
Hannibal: 14
with Better AI with iSameAreaCount > 0 changed to iSameAreaCount == 0 war on other landmasses is highly discouraged .
Churchill: 74
Alexander: 72
Stalin: 57
Tokugawa: 64
Ragnar: 1
Bismarck: 1
Huayna Capac: 1
Player (Egypt): 1
Hannibal: 1
it's about this code:
Code:
if (iCount > 0)
{
//cross up to the entire map to kill the only other foe
//be more picky if there are more foes...
int iTeamCount = GC.getGame().countCivTeamsAlive();
int iMaxDistance = GC.getMapINLINE().maxPlotDistance();
if (iSameAreaCount > 0) //preserve sanity on islands...
{
iMaxDistance *= 4;
iMaxDistance /= (2 + iTeamCount);
}
return max(1, (iMaxDistance - (iDistance / iCount)));
}
that is added in Better AI to CvTeamAI::AI_calculateCapitalProximity which is used to determine the best victim for the next war. It's a score so higher values are better. It basically returns maximum distance minus capital distance in stock Warlords.
consider this map:
The results Isabella gets in Warlords 2.08:
Churchill: 74
Alexander: 72
Stalin: 57
Tokugawa: 64
Ragnar: 46
Bismarck: 34
Huayna Capac: 29
Player (Egypt): 19
Hannibal: 14
with Better AI rev. 368 everyone on her own continent gets vastly lower scores:
Churchill: 14
Alexander: 12
Stalin: 1
Tokugawa: 4
Ragnar: 46
Bismarck: 34
Huayna Capac: 29
Player (Egypt): 19
Hannibal: 14
with Better AI with iSameAreaCount > 0 changed to iSameAreaCount == 0 war on other landmasses is highly discouraged .
Churchill: 74
Alexander: 72
Stalin: 57
Tokugawa: 64
Ragnar: 1
Bismarck: 1
Huayna Capac: 1
Player (Egypt): 1
Hannibal: 1