AI Development Guide and M27AI v74 Devlog

Latest changes (v67 summary)
No significant changes in this update, just a number of small tweaks and fixes.

13 bugfixes, including:

  • Certain SACUs being considered to have 0 threat
  • Improved build order on some maps that resulted in a power stall due to power and hydrocarbons being built at the same time

25 misc changes, including:

  • Mobile shield and stealth sharing (so cybrans can share the joy when they have non-cybran teammates)
  • Novax targeting adjustments to prioritise lower health instead of higher health units of the same type
  • Slight increase in navy aggressiveness (including a workaround for humans who would constantly dodge aeon destroyer shots with frigates when massively outnumbered)
  • Improved nomads compatibility by building T2 support factories and getting the gun upgrade
  • Increased likelihood of UEF and Seraphim building game-enders in team-game maps

Acknowledgements

  • Relent0r – highlighting an issue with M27’s build order on theta passage, and with M27’s ACU getting stuck on Air Wars
  • Radde – Numerous replays
  • SniperbotMeta (now Flordia Man) – Feedback on issues M27 has with nomads
  • Jip – Highlighting how using ForkedThreat on a function that returns a value will cause a ‘Yield()’ error message

V68 summary of changes:
Various small improvements to tml and tmd logic:

  • tmd can now be built on plateaus
  • predictive logic added to estimate if a tml shot will hit the cliff to help with target prioritisation
  • tml are less likely to be paused when stalling

14 other misc changes, including making unupgraded acu scared of all pd and improving plateau expansion speed

16 bugfixes, including:

  • t1 pd shouldnt be ignored by the threat response logic
  • pre-emptive fix for upcoming faf develop changes to veterancy
  • fixed various niche scenarios causing errors and reduced some of the error messages sent to the log

Acknowledgements:

  • Fearghal – Bug where M27 ignored civilian T1 PD
  • Relent0r – highlighting a dangerous upgrade decision by M27
  • Sprouto - sharing thoughts on TML missile trajectory that led me to trying to come up with the predictive missile logic

v69 Summary of changes
Mini update with 7 bugfixes and 12 misc changes, including:

  • Fixed an issue that could cause a major slowdown when M27 was power stalling late game
  • Better plateau selection in team games (previously sometimes two M27 would each go for the plateau furthest from them but closest to the other M27)
  • Improved SMD/anti-SML logic to handle large enemy AiX modifiers, large enemy nuke numbers, and attempts to edge-nuke M27's ACU
  • Adjustments to naval kiting logic so they take longer to turn around (and therefore less likely to abort a firing sequence after a single shot)

Acknowledgements:

  • Fearghal - Highlighting a significant slowdown in an M27 game that led me to discovering the flaw in M27’s power stall logic.
  • Thacon - Replay highlighting poor plateau selection by M27 on the same team

Hi @maudlin27, I've just been reading your development notes and really appreciate how thoroughly you've documented everything. As a programmer myself it's really interesting to see what you learned along the journey 🙂 I'm also enjoying your M28 blog - looking forward to seeing how that goes!

BTW, I'm still having issues opening the devlog (https://docs.google.com/document/d/1uQlEoN-kti7G2MnhwD60uaaHwVevPNYH/edit?usp=sharing&ouid=100973959280546778272&rtpof=true&sd=true) - maybe that's also grown too big for google drive to show?

@Sioloc Just keep the document tab open - It takes several minutes until the doc gets rendered, after that you can/need to download it and open it on your machine. Google Docs can not load more pages than the first one, for whatever reason. They really do not like the .docx format.

V70 summary of changes:
Update based primarily on issues spotted from the first weekend of the Rainbow Cup tournament:

  • Fixed a bug that caused MAA to stay way too far back from the ACU when there were nearby enemy tanks (i.e. the MAA would run away from the tanks even if they were needed to protect the ACU from gunships/bombers)
  • Significantly improved the speed at which the AI will try and get T2 PD if the enemy gets a guncom and attacks its base
  • Added new capture logic to capture certain civilian units on the map (e.g. titans on big bang dry) - while this ended up much more work than expected, fortunately the map was picked by the players and featured in the RC finals, meaning I got to see the results of the capture logic feature and have a noticeable impact on the game
  • 6 other bugfixes, and 12 misc changes, mostly relating to ground based anti-air logic, and being a bit more cautious with bombers (including an issue that would cause bombers to be overbuilt, which would then trigger backup logic to make use of the bombers on high risk targets due to there being so many of them, leading the AI to just waste/donate mass).

Acknowledgements:

  • Fearghal - For funding and hosting the Rainbow Cup tournament, which provided valuable replays on AI performance as well as being very entertaining to see AIs pitted against the top FAF players, and having their profile raised.

@maudlin27 - I just thought I'd post about a bit of a vulnerability I noticed fairly frequently. I was just playing round with some AI vs AI out of curiosity; mainly because we've been getting a lot of enjoyment out of M27 and I was just curious to see whether any other AIs could be nearly as challenging.

I saw that in the recent AI vs AI tournaments that DilliDalli was one of the few that seemed to win relatively frequently. I tested it on 4 vs 4 Setons a couple of time with 4 x DilliDalli VS 4 x M27 (URLS:
https://replay.faforever.com/19777194 & https://replay.faforever.com/19776810 ) and the front most M27 ai-player twice in a row left its commander unnecessarily far forward where it got easily killed by moderately large swarms of T1 units. In one of the games the commander even managed to complete a T2 engineering upgrade but then it didn't move back far enough to build a T2 point defense despite there being plenty of land support available; it could've easily moved back a bit and built a T2 point defense but seemed to just wander fairly aimlessly amongst the incoming T1 tanks for long enough to get killed. I know that this is quite an isolated and specific scenario because DilliDalli seems to always T1 land rush and on Setons the front most player is instantly swamped by 4 teams worth of T1 land units, but it just didn't seem to adapt to a new strategy when it was clearly out numbered.

I should add that in both games I tested under those conditions that M27 still won because the remaining 3 teams had vastly superior economies after a few minutes, but it just seemed to me that the front player could've easily kept its commander alive if it'd just backed back a bit and defended its commander. M27 seems to build pretty good firebases slightly forward on Setons and if it builds those it's pretty hard to beat; however, when it seems to be prevented from doing that, its front playing commander seems pretty vulnerable. Recently with human players vs M27 I've also found that if you prevent M27 from getting the front fire base it often won't build too much defense back further which makes its front bases fairly vulnerable.

@tyne141 Thanks for flagging, at the moment I think this will be in the 'too much hard work to try and improve further' category - what's meant to happen is on maps like that it tries to setup a firebase, and only gives up on trying to establish a firebase if it thinks it is about to lose its ACU (but with adjusted thresholds as it is mostly a 'firebase or die' approach), at which point it defaults to the default (non-firebase approach) M27 logic.

I'll make a note to check vs 4 DD to make sure it's working as intended at some point but it sounds likely it is from your post - the main threshold I used was if it could get T2 PD up before a likely guncom got in range, but if 4 enemy players are going mass T1 spam then it's likely there's not much 1 M27 would be able to do to hold them off with its current approach, while the way the firebase logic works is the location is decided at the start of the game (with a bit of leeway to allow for it to be situated slightly closer to base than planned), so trying to adjust on the fly to move to a fallback position would be too much work.

Another issue on setons is having it build the firebase too far back potentially means forfeiting all the mid reclaim which could lose the game.

Hello Maudlin, I had a game with a buddy, which ended up crashing to a game speed of -17 after the M27 was destroyed. Here is the log excerpt.Gamelog M27.txt

you may find an error that explains the gamespeed. Nevertheless, again a big compliment to your two AI's. They're a lot of fun 🙂

@saver have you got the replay ID?

v71 Mini-update
8 minor bugfixes and tweaks mostly relating to points I noticed when doing a couple of checks following the recent FAF develop release to see if M27 still appeared to work as expected. Since they generally relate to very niche scenarios, unless I made an error with some of the code (as a couple of changes were for issues seen in a video of a game hence I had no replay to test) they're unlikely to have a noticeable impact on how M27 plays.

Hey, not sure if it has been reported already: M27AI breaks when you re-host a game. This is reproducible.

  1. Start a game with M27AI
  2. Watch AI do stuff (for example by observing points)
  3. Press menu button, click rehost
  4. Wait until game closes and reopens in Lobby, press Start
  5. Watch the AI do nothing, points stay at 0

That's probably due to AI names stacking up with every rehost.
After first start it's something like "Keiko (M27)", second one "Al-Zutov (Keiko (M27)", third one "MCB500 (Al-Zutov (Keiko (M27))" a.s.o.
Maybe the AI controller fails to recognize the players as AI?

Here's a replay: https://replay.faforever.com/20259077

Ah, I forgot to disable that when mods are enabled.

A work of art is never finished, merely abandoned

@chemo Also FYI never rehost with custom AI mods (or any sim mods for that matter). In the case of custom AI mods you'll end up playing against the default AI, but it will be described as the custom AI (so M27 in this case), due to a bug with FAF.

Similarly, don't click on the load presets option for game settings, as it causes a similar issue if you've got a custom AI selected in the game lobby.

I.e. if you want to play an AI game, always close down the current game and create a brand new game.

I am enjoying your AI very much, it is absolutely amazing ! I am playing the dark heart, 2v2v2 with all m27's, except 1 team has 2 dillidalis (they die fast, but gives me some time to prepare). Problem i am having though is that my team m8 commander seems to be very keen to do suicide. Almost 1/2 of games end this way. He goes next to enemys island and usualy gets killed by torp bomber. A game just ended where he kept reclaiming floating tanks while 3 or 4 torp bombers were killing him. Even when down to 2k, he didnt seem to mind.

Now i am guessing i should have done more to protect him but i would overspend to protect a fools errand. I tried yelling at him in chat to get back to base but clearly doesnt work. Is there any way, like signal or something, to tell him to not do suicide ? Its frustrating since when he dies, game is over for me as i have no chance to do anything against their mastery. Its interesting though that for some reason, the enemys commander almost never dies attacking our island. Obviously its because im not as good as M27 at multitasking. But i always feel like my M27 is the dumbest of the 3 🙂

ps: just 1 more thing i remembered. This sieging of enemys beach with commander sometimes goes on even when time passes 20 minute. I think by minute 20, commander should be in the base, otherwise its almost a sure way to get sniped. Again, wish there was a command to tell him to get to base. The amount of yelling and cursing this caused me 😕

Most of its logic on whether to run is based on its health so if it's low health it ought to be trying to retreat. My guess without seeing the replay is that it has conflicting decisions - it wants to retreat due to its low health, but it also sees enemy units nearby that it wants to kill (or else it thinks it would die to them). So my guess is if you could temporarily clear away the nearby enemies when the ACU is low health it should try and make its way home.

It should also be more cautious later into the game, on higher eco, and/or when the enemy has experimental level units or a strong air force.

@maudlin27 I played all my last games on FAF so if replays are actualy public, i can link them, or to save you time, i can just fast forward to the moments of death and send you a short recording/s. If that happens, please don't mind my cursing, i completely lose it everytime. Prolly because it reminds me of my friend, who, occasionaly when he knows he cant win a battle, instead of retreating, he will just stay still or even walk in the direction of enemy, even though i warn him soon enough to start running. He doesnt understand that in a balanced 3v3 game of noobs, him doing unnecesary suicide means basicaly game is ruined for the other 2 players since we cant use his mass/mex in time.

Anyway, the last time i think M27 team m8 died was like this, he was in water marked by yellow, we had AA on island but torp bombers shoot before AA kills them. The enemy M27 sent like 30 of them and it was over before i could even respond. Other times he dies in area marked with black, thats most cases. Right when game starts, he builds factory and marches to their island, reclaiming their units. Which is good but as soon as first torp bomber hits, he should run back because there is a long way home when he never brings any AA units, before i can respond, enemy M27's both start spamming torp bombers. Sadly the opposite M27 is very smart and snipes him with ease. Occasionaly i will see him try to upgrade something on com when he has full health, near their island in the water marked with black. And 1 torp bomber hits, he stops upgrade, and right away starts it again. Then another torp hits and same again. He kept at this same thing until he died. I cant fend off attacks on my island and protect him at the same time near enemy territory.

I really love this map and this setup, learning a lot of new things. But to save my frustration i think i will swap positions with my team m8. Because his part of the island is a lot closer to enemy island than my position is. Maybe being further away will make him less keen to go that far with his commander.

But even if not, maybe that will be my new training goal - keep my team m8 alive when hes doing suicide, whether AI or real player 🙂 Great work on the AI, its amazingly good and fun. If i didnt have soo much fun playing the game, i will be honest, i would be tempted to give it a go myself. Many years ago we did some custom AI's for age of empires 1 and then we had a mini tournament where we put AI's 1v1 against eachother to find out who can best all other AI's. But that was really simple scripts back then compared to SC.

The_Dark_Heart_preview.jpg

Could you send me replay IDs with timestamps, one for when it gets hit with the torp bomber, cancels the upgrade, then starts again, and the other for when it's in the yellow water?
No guarantees when I'll look at it as my focus at the moment is on M28 but if/when I do another update for M27 it'll be on my list to consider if there's an easy fix