Page 1 of 1

AI behavior observations and ideas

Posted: Sat Nov 10, 2012 7:51 pm
by Bianary
The root issue I see with the AI's behavior is that it moves units individually with no concept of a united force or future expectations. This leads to a lot of little issues:
  • Meatgrinders itself against my cities because it doesn't ensure it has forces to successfully take the city. This both levels my units and provides breathing space for them to heal up before its next unit arrives. (I use 2-3 units in a city to allow them to trade off taking hits)
  • Gets crippled by large hives near it since even if it wins the first attack it throws away that unit on the second with no guarantee of being able to finish it and destroy the hive. This is almost universal, an AI with a large hive next to it ends up very weak compared to the other AIs.
  • Allows its units to be destroyed en route by the player picking advantageous terrain to assault each in, since they're split up.
  • Allows the enemy units destroying its units en route to retreat since it never has units moving up together (Nobody's available to counterattack in time). This allows the enemy to repair, costing the AI units for no material gains.
  • Makes enemy caravans (Escorted formers/colonizers/transports) extremely effective since they can push forward safely with no significant worry of overwhelming force wiping out their escorts unexpectedly.
  • Takes cities but then leaves them with only the claiming unit to hold them.
  • Immediately attacks out of cities it's holding when it gets a second unit in it, even to its disadvantage.
Behavior changes I'd recommend (If possible. I don't know what is reasonable or not based on the current implementation)
  • AI assigns units to move only after all pre-assigned units have moved. So if I assign my trooper to retreat adjacent to an enemy trying to kill it, that enemy should NOT immediately move into the tile the trooper had been on but should wait until the trooper has moved then assault it in its new tile. This will also make the AI's moves more relevant with the immediate situation after my pre-assigned units move.
    • Bugs could be left with the current "Assign moves before pre-set moves" so they not only behave differently from AI players but also dumber.
  • AI should only assault a city/hive with a single unit if it is very likely to win. Bonus if it can do a risk/reward calculation to determine if the unit it will destroy is higher value than the attacking unit, to make it worth leaving a weakened unit (That can be counterattacked and killed) to get that kill.
  • AI should be less willing to attack barricaded cities/hives/forts. See previous point for the cost calculation it should use against hardened targets.
  • The AI should be willing to simply contain a city/hive/fort if it doesn't have proper resources to meet the risk/reward calculation. For hives this means holding units in advantageous terrain and defending against bugs (While holding until healed in between), for cities/forts this means attempting to destroy incoming reinforcements and blowing up any formers in the area.
    • This is especially relevant due to the bonus defenses in the cities/forts/hives, unless they have SMS Headhunters or Long Toms in there the AI only benefits from not attacking against the defenses.
    • Related, the AI should recognize when a city has an SMS Headhunter unit or Long Tom and should either be willing to attack to destroy it (If its attack would target it -- let the AI be able to determine who it would actually hit, and give SMS Headhunter/Long Tom a very high value to kill) and or move outside its range of attack for its containment action.
  • The AI should be able to pool all possible attacks it can make against a city/hive/fort into one clump of resources, to calculate if it has enough forces available to destroy all defending units or not. Bonus if it can then calculate whether it is likely to have one unit left that can still move in and claim the resource. This calculation should take place after reinforcements are made.
  • The AI should be able to assign a unit to be fleeing, ie it will queue a move (So that activates at the same time as player pre-queued moves) away from enemy units in its best guess safe direction.
  • The AI should move its units in mixed squads, so that it has at least one bio/machine and one anti-bio/anti-machine when possible. If the player is only using units of one type the AI shouldn't be producing many units of the wrong type so it would simply create mixed squads of bio/machine. If it can't produce a mixed squad it should simply move with a squad.
  • When its units aren't actively threatened, the AI should be willing to hold until healed. When a friendly city is nearby it should move into it to heal (It can calculate "turns to heal in the field", vs "turns to move + turns to heal in the city + turns to move back" and use that to determine where it should do its repairs.
  • The AI should be able to identify choke points and build/hold forts at them. If not, it should simply build forts "near" (Along its path) hot spots. One former could be assigned with any squad of at least 3 units and could be moved with that squad and build forts whenever that squad needs to heal/hold position for a few turns.
  • The AI should hold at least 500 credits (Can scale as the game goes on, starting lower and going higher) in reserve and be willing to use these on newly captured cities to build an adaptive barricade (If the city doesn't have one) or to buy a beefy unit (Tank or higher) immediately into the new city to hold it.
  • The AI should perform risk/reward calculations on enemies threatening its city vs its city's holding power before attacking an enemy unit outside the city. I've seen it holding a city effectively with the adaptive barricade bonus, attack one of my units adjacent to the city (No barricade bonus for attacking), and that weakened it enough for me to take the city next turn with units I had nearby.
  • The AI should reinforce cities it holds that are under siege with outside units, and by prioritizing direct buying into those cities.
  • The AI should prioritize front line cities for buying units with credits.
  • The AI should be willing to stockpile credits (Even into the 2000+ levels) if it has no front line cities. It should be willing to utilize this pool immediately only to satisfy immediate high priority needs: Colonizer (If it has spotted a valuable resource field that is unclaimed and it would take too many turns to produce a colonizer and claim it), Former (If pollution is an issue or a large squad needs a former -- though this probably falls under a combat-push squad completion)), or a building (Such as food/mineral production buildings if its empire is starving) but it should not simply blow its stockpile producing units on the back line that it doesn't need. Since units build 1 turn after being bought, it can sit on these credits until it's in a combat-push situation where it needs to build up a city's defenses in a hurry or rapidly deploy a mixed squad to assault with.
  • Stockpiles operations for devastating combos. Such as a scanner sweep on a city, nuking the forces in it, then dropping troopers straight in to claim it. This can be achieved just by having it run risk/rewards on its ops and only using them when it sees a gain from it -- scanner sweep would obviously need something it considered a reward from to trigger it to use it, but the nukes/drops would both have those options available (Potential for destroying enough units, calculated chance of taking the city, etc.) Might be too mean to have an AI execute an unstoppable city claim like that, but players can do it to the AI so it's only fair if the AI can do it back.
While it sounds like this will delay the player's turn longer by making the AI do its move calculations after the player's pre-assigned moves, what it really means is that all units with pre-assigned moves get their positions updated (And combat calculated, as appropriate) before the AI does its thinking, then the AI assigns based on where units are going to be, THEN everything starts animating for the player. Hopefully that's reasonable.

I do recognize that this is a lot of work and involves aggregating a lot of information together (And then identifying what it means). I tried to clump things into straight power numbers/probabilities for all those group calculations to make them realistic. Hopefully this is actually useful and maybe even implementable, ideally all these calculations are done during the new-turn calculating and nothing needs saving between turns about intent (This leaves the AI flexible to rapidly changing situations, and greatly simplifies what it needs to figure out because it's not trying to predict things further ahead than the current turn, at only a small cost in tactical potential -- but players need that edge, anyway)

Of additional benefit: With smaller scale risk/reward calculations available the AI could run that on everything you control vs everything it controls (Obviously distance would mitigate both risks and rewards) and could use that to help it determine if it's afraid of you (Wants pacts but not trade/research that would make you stronger), neutral to you (Okay with trade/research, doesn't want peace alliances) or believes you're a prime prize to take (Declares war on you). With some additional "I want this land" calculations (Which would be entirely new and quite possibly very difficult) it could even decide to start migrating units towards your borders until the risk/reward calculation tipped towards prime prize, at which point it would declare war after having amassed an army -- without having to make it look 10+ turns ahead while doing so, only having it go "I want this land, I'm going to move some units towards it. Oh I have this unit, it's near land I want, I'll leave it there. Etc." -- complex behavior from simple motives) Add in some % modifiers that it would effectively roll dice on for close calls and you get an AI that's unpredictable but will tend to act in its best interests.