jdog5000
Revolutionary
Welcome to the forum for discussions of the Better BTS AI mod!
Better BTS AI is the BTS follow-up to the great work by Blake and Iustus on the Warlords' AI. This project started with discussions on how to fix a bug in the calculation of the "closeness" between empires which is used by the AI in determining which enemy to attack. From that humble beginning the rest of this effort was spawned, we have learned quite a lot and had many good discussions since then!
Goals of the project
The main goal of this project is to make BTS more enjoyable for players looking for a challenging strategy game experience. We have a fantastic base to work with, as BTS is already quite good, particularly through the Middle Ages. There is, however, more work to be done to craft an AI which can "stand the test of time."
This simple goal has a lot of elements to it which fall under the broad category of "Better AI." Here are the main specific ways this project can make BTS more fun as I see them:
There are a lot of different aspects to the game which can fit under these headings. To give a better idea of how we are pursuing these different avenues, I'll describe what we've done so far and what is on the horizon for the Better BTS AI project.
A sample of what we've done so far
Here are some broad descriptions of some of the more important changes we have made so far, in roughly chronological order:
As mentioned, this is not an exhaustive list but the more important pieces done so far. To see a list of all the changes made to date, check out the thread for the most recent version or see the change log in the download.
Better BTS AI is the BTS follow-up to the great work by Blake and Iustus on the Warlords' AI. This project started with discussions on how to fix a bug in the calculation of the "closeness" between empires which is used by the AI in determining which enemy to attack. From that humble beginning the rest of this effort was spawned, we have learned quite a lot and had many good discussions since then!
Goals of the project
The main goal of this project is to make BTS more enjoyable for players looking for a challenging strategy game experience. We have a fantastic base to work with, as BTS is already quite good, particularly through the Middle Ages. There is, however, more work to be done to craft an AI which can "stand the test of time."
This simple goal has a lot of elements to it which fall under the broad category of "Better AI." Here are the main specific ways this project can make BTS more fun as I see them:
- Fixing bugs or unintended behavior
- Fixing other illogical AI behavior which breaks immersion
- Increasing the AI's ability to perform coordinated actions
- Improving the AI's handling of its economy and production
- Enabling the AI to better play for the win within the bounds of role playing
There are a lot of different aspects to the game which can fit under these headings. To give a better idea of how we are pursuing these different avenues, I'll describe what we've done so far and what is on the horizon for the Better BTS AI project.
A sample of what we've done so far
Here are some broad descriptions of some of the more important changes we have made so far, in roughly chronological order:
- Closeness bug: Fixed AI calculations of the closeness or proximity of another empire to its borders. Previously, player A actually calculated how close enemy B's cities were to enemy B's cities, not to its own cities. This kind of subtle logic bug is difficult to track down, but can have wide ranging effects on how the AI makes decisions. The AI now appropriately calculates the proximity of enemy cities to its cities and the calculations of which enemy to attack had to be tweaked to balance the corrected numerical values returned by closeness calculations.
- Retreating of sea/air units: This new behavior was started by Solver in the unofficial patch and has been adapted and repeatedly tweaked in this mod. Basically, the AI will now move ships and air units out of threatened cities so they are less likely to be lost. Air units in lightly threatened cities now run defensive bombard missions to attack the threat, only pulling out when the city is highly threatened (some fighters will stay behind to help defend the city).
- Air defences: In vanilla BTS once a fighter decides to air patrol in a city, it will remain air patrolling their indefinitely unless the city is attacked from the air. We have modified this behavior so that the AI is more flexible and will shift its fighters to cities which need them. This required designing a consistent rule so that fighters would stick in threatened cities and run the needed air patrol missions, as each time a fighter rebases is a lost turn of air patrol. In addition, when the AI has extra fighters it will now use them to clear out enemy defensive fighters so its bombers survive longer.
- Bomber basing: The BTS AI used bombers which happened to be nearby to support its stacks in enemy territory. Now, it also chooses where to base its bombers according to where it have land troops attacking. This is a one example of improving the coordination of actions between different pieces of the AI to make it far more potent in war.
- Air combat mechanics: This is the one change we have made so far which really changed the mechanics of the game, not just the AI's choices. Air combat now works a bit more like land combat, making veteran air units more valuable and longer lived. This makes air combat behave more in line with the player's expectations based on the importance of experience in land combat. This change can also be disabled in GlobalDefinesAlt.xml.
- Naval invasion logic: Successfully launching naval invasions requires coordination between city production, transport and escort motion, and loading of groups of land troops. Reworking the AI's invasion system has been one of the primary pushes in this project so far. The biggest addition is the ability of the AI to reinforce its initial invasion fleet with subsequent waves, previously it basically waited to build up a brand new full invasion while its initial invasion force was whittled away. When the AI does build up enough troops to launch a second invasion (instead of just a reinforcement), it now sends the second wave near the first wave instead of often spreading out to two distinct fronts. The AI can also now time multiple invasion flotillas to show up at nearly the same time. If the AI has no land path to its enemy, it will now use the invasion production logic and load its troops into transports, previously the enemy would see at most one initial invasion wave. A related important new behavior for the AI is the ability to pickup troops which get stranded on islands or on other places around the map, something which previously could break immersion. Also, a bug where AI transports would loiter trying to pick up the units they already had onboard has been fixed, this previously could cause partially full transport flotillas to get stuck indefinitely on small islands.
- Voting for peace: The AI's voting on AP/UN resolutions for peace has been improved to better take into account how the AI is doing in war. Other new considerations for AIs that are third parties to the war are whether they want the war to continue for selfish reasons, because they share a war with one side or are about to join the war.
- Privateer production bug: Fixed a bug blocking the main AI logic for producing Privateers. Previously a check for whether privateers were obsolete was made using unit class type where unit type was intended. As a consequence, the function never actually checked any naval units and always blocked the logic to produce privateers. The AI now builds Privateers but since they haven't really done it before, more work remains in making sure they get value from these units.
- Attack stack tactics: AI attack stacks will now minimize the number of turns they spend in enemy territory or along enemy borders. This increases the surprise factor for the assault and reduces losses from counter attacks. Attack stacks with overwhelming odds will now skip bombarding and attack directly, sacrificing perhaps a couple of units for keeping the enemy from having time to reinforce the city.
- Vassals prepare for war: Vassals of AI players will now begin their own preparations for war when their master does, meaning they'll have troops available both to defend themselves and contribute offensively when war breaks out. Vassals of human players will default to building more offensive units generally and you can also signal to the AI your war plans by pressing SHIFT+ALT and clicking on enemies in the scoreboard. This toggles your warplan state against enemies so you can get the same benefits during war from your vassals as the AI does. Vassals will now even be able to participate in naval invasions which require a fair amount of buildup, don't be surprised to see them send their troops to the cities you've captured on another continent and set out to make conquests of their own.
- Settler bug: In vanilla BTS, if there were sites where the AI wanted to settle cities available on the same continent as the settler unit, the AI would never load the settler into a transport. Since AI settlers will not move through other player's territory even with open borders (fixing an annoyance from Civ3), this would stunt the AIs growth if it was cutoff from those potential city sites by another player's territory or mountains. The AI now properly loads settlers into transports if they cannot reach the target location over land.
- Capitulation decisions: Tweaks and adjustments to both sides of the capitulation decision making process, so that war mongers will sometimes annihilate enemies instead of seeming to always accept capitulation. AI will, however, still always accept capitulation when there's a danger of the enemy capitulating to someone else or of another player gaining valuable land from the mutual enemy. Fixed issue where small-size of previously capitulated civs would influence when a civ losing a war would capitulate.
- Empire defense: Added greater awareness of how wars are going for the AI. When the AI now feels it is losing, it will put an empire wide emphasis on defense and counter attackers to try to hold on.
- Cottage/Workshop cycling: Fixed some AI valuation bugs which led to a propensity to alternate tile improvements between cottages and workshops. These bugs would block some AI cities from getting to Towns, thus hindering the civ's tech rate.
As mentioned, this is not an exhaustive list but the more important pieces done so far. To see a list of all the changes made to date, check out the thread for the most recent version or see the change log in the download.