jdog5000
Revolutionary
There are two bugs that we've fixed in the Better BTS AI mod which would probably be appropriate for your efforts as well. First, the easy one:
In CvCityAI::AI_neededDefenders the AI will decide it doesn't need as many defenders if a recently captured city either does not have a wonder or is a holy city. Clearly this is meant to be no wonder and not a holy city.
The second bug is definitely a bug, but creating the right fix is not so simple. In CvPlayerAI::AI_playerCloseness the AI is meant to determine how close its cities are to another player's cities. Instead, it compares how close the other player's cities are to the other player's cities. This is essentially the self-closeness for the other player and is always > 0 if the player has a city, even if they're on the other side of the world.
Correcting that loop is easy enough, but it has serious ripple effects. Closeness is intended to have a very strong effect on war decisions in BTS as the code in CvTeamAI::AI_startWarVal attests. If closeness is zero, the value the AI assigns to that particular victim is / 4. Without the above fix, closeness is never zero since it's actually the other player's self-closeness so in effect this fix opens up new AI behavior which (until the last week or so) has never been tested. We've got several tweaks to adjust this behavior in the Better BTS AI mod ... if you choose to include this fix I would highly recommend adding the tweaks to CvTeamAI::AI_startWarVal as from our testing they produce good results.
We also have some changes in CvCityAI::AI_cachePlayerCloseness, a small one dealing with populations and larger ones which are still in progress to better handle coastal cities and cities on other nearby islands. Both of these fix some quirks in AI behavior which don't really make sense but could not be classified as bugs (as I mentioned, the second fix isn't complete yet). See the discussions here (called Fix C) and here for better descriptions.
There's also a change in CvCityAI::AI_chooseProduction to reduce galley/transport overproduction.
The full change list for Better BTS AI v 0.1:
_________
- Fixed bug in player closeness calculations causing the AI to be blind to its actual proximity to other players (CvPlayerAI::AI_playerCloseness, used Option A from Unofficial Patch discussion thread)
- Fixed bug with needed defenders where the AI would choose to defend a recently captured holy city less than a normal city
- Modified how closeness is used for determining who to attack, different settings for regular and Aggressive AI
- Modified city closeness calculations to use population from both cities, not just pop of the other city
- Created functions for determining when cities share the same water area (lake, ocean)
- Lowered demand for transports when either in a land war or when the civ can only build galleys
- Partial implementation of a new A* solver for determining closeness, does not yet affect calculations
- Modified debug mode output to show relevant information for these developments
Anyway, thanks for again spearheading the unofficial patch efforts! I'll let you know if we find any other real bugs in the AI code during our developments and will certainly fold your fixes in.
In CvCityAI::AI_neededDefenders the AI will decide it doesn't need as many defenders if a recently captured city either does not have a wonder or is a holy city. Clearly this is meant to be no wonder and not a holy city.
The second bug is definitely a bug, but creating the right fix is not so simple. In CvPlayerAI::AI_playerCloseness the AI is meant to determine how close its cities are to another player's cities. Instead, it compares how close the other player's cities are to the other player's cities. This is essentially the self-closeness for the other player and is always > 0 if the player has a city, even if they're on the other side of the world.
Correcting that loop is easy enough, but it has serious ripple effects. Closeness is intended to have a very strong effect on war decisions in BTS as the code in CvTeamAI::AI_startWarVal attests. If closeness is zero, the value the AI assigns to that particular victim is / 4. Without the above fix, closeness is never zero since it's actually the other player's self-closeness so in effect this fix opens up new AI behavior which (until the last week or so) has never been tested. We've got several tweaks to adjust this behavior in the Better BTS AI mod ... if you choose to include this fix I would highly recommend adding the tweaks to CvTeamAI::AI_startWarVal as from our testing they produce good results.
We also have some changes in CvCityAI::AI_cachePlayerCloseness, a small one dealing with populations and larger ones which are still in progress to better handle coastal cities and cities on other nearby islands. Both of these fix some quirks in AI behavior which don't really make sense but could not be classified as bugs (as I mentioned, the second fix isn't complete yet). See the discussions here (called Fix C) and here for better descriptions.
There's also a change in CvCityAI::AI_chooseProduction to reduce galley/transport overproduction.
The full change list for Better BTS AI v 0.1:
_________
- Fixed bug in player closeness calculations causing the AI to be blind to its actual proximity to other players (CvPlayerAI::AI_playerCloseness, used Option A from Unofficial Patch discussion thread)
- Fixed bug with needed defenders where the AI would choose to defend a recently captured holy city less than a normal city
- Modified how closeness is used for determining who to attack, different settings for regular and Aggressive AI
- Modified city closeness calculations to use population from both cities, not just pop of the other city
- Created functions for determining when cities share the same water area (lake, ocean)
- Lowered demand for transports when either in a land war or when the civ can only build galleys
- Partial implementation of a new A* solver for determining closeness, does not yet affect calculations
- Modified debug mode output to show relevant information for these developments
Anyway, thanks for again spearheading the unofficial patch efforts! I'll let you know if we find any other real bugs in the AI code during our developments and will certainly fold your fixes in.