AI Development Guide and M27AI v74 Devlog
-
@tyne141 Thanks for the replays, looking into further there's a bug with my logic on 'chokepoint' games (such as 2v2 eye of the storm) - will be fixed in v41 (I'm just working through a few adjustments before I release).
@splitice I'll have a look after the current release to see if there are any easy adjustments to help fix, but some of my logic's range is hardcoded which may cause issues if the mod is introducing very long range units. I'll double-check how it handles things when T4 arti is disabled though, as it's quite possible it is trying to build it, and when it fails due to the unit restriction it stops building any experimental, leading to poor use of resources. I'm just going through pre-release checks on my current release so it won't be until v42 for any changes re this though.
-
@maudlin27 Iterate the blueprints on start for unit ranges perhaps? Thats how unit stats are normally changed so it makes sense to do the same on first tick.
It didnt build zero experimentals (I saw a few galactic colossuses before taking the center) but they were limited. Towards the end of the game I would have expected to see waves of them.
-
v41 Update - Hives and Shield Disruptor
- Added new unit – Shield disruptor
- Added new unit – Hives
- Fixed various bugs/assumptions that meant M27 wouldn’t work with the survival map Final rush pro support (in preparation for an AI monthly tourney on this map)
- Fixed bug on some chokepoint maps (such as 2v2 Eye of the storm) with the chokepoint assignment
- 10 Other bug fixes
- 53 Misc changes, including various tweaks to late-game logic in high mass scenarios to try and build more land factories sooner, assist SML and SMD with fewer engineers if mass is overflowing, build more power, and adjustments to T3 arti targeting logic when the enemy has no T3 arti of their own. Also including various tweaks to the early game such as initial build order tweaks and slightly better use of early raiders so theyre less likely to die.
Acknowledgements:
- Tyne141 – Replays highlighting strange choice of destination for M27’s ACU when turtling
- Zlo – suggesting I ctrl-K obsolete radar rather than reclaiming it
- Relent0r –Querying whether M27 chooses not to upgrade mexes in range of enemy TML (prompting a tweak to incorporate such logic).
- Ice-IX – Bug where disbanded platoons would have their displayed name change even if the config settings said to not do this.
Benchmarking
As it's roughly 1 year since I first started working on M27, I thought I'd benchmark how well it was performing against several of the other AI (DilliDalli and RNG, as they're the 2 AI that during testing are most likely to beat M27), in part as one of my long term goals had been to create an AI capable of beating all other AI on the <700 rank map pool a majority of the time.While M27 just managed to reach this goal (after numerous small tweaks to its early-game logic), it was very close on several maps so this will be highly dependent on the map pool chosen. The devlog has more details on the results, but in summary (with 4 faction mirror matchups being played against each AI, and then another 4 in the case of a tie in results):
Maps with 100% win rate:
- Theta passage
- Auburn Canyon
Maps with a clear >50% win rate:
- Adaptive Hardshield Oasis (3 win 0 loss vs RNG, 4 win vs DilliDalli)
- Regor VI Highlands (4 win vs DilliDalli, 3 win 1 loss vs RNG)
Close fought maps:
- Loki - FAF version (3 win 1 loss vs DilliDalli, 2 win 2 loss vs RNG followed by 4 win 0 loss)
- Forbidden Pass – FAF version (7 win 1 loss vs RNG, 13 win 9 loss vs DilliDalli)
- Point of reach (4 win vs RNG, 2 win 2 loss vs DilliDalli followed by 4 win 0 loss)
In terms of the other map pool maps, Serenity Desert Small – FAF version currently has a bug that prevents RNG and DilliDalli working on it so the results aren't included
-
Great to see so many frequent updates.
If you want some more replays, here are a few more:- Four-Leaf Clover: https://replay.faforever.com/17387027
- We lost a few times because the T1 land skirmishing was quite effective but we ended up winning in this replay by turtleing and using tactical missiles - Flooded Strip Mine: https://replay.faforever.com/17432261
- This was just me playing with one ally M27 and two opponents; I was mainly just practising to see if I could beat it with T3 artillery; in this particular one I mostly beat the opponent opposite me but my ally lost its side so I lost in the end - 3 of us losing against 3 M27s on The Ditch: https://replay.faforever.com/17401339
- 2 of us on Fields of Isis: https://replay.faforever.com/17364957
- We lost quite a few times before we won but we found that a firebase with tactical missiles was quite effective against the AI as it only built so many missile defenses
Tactical missiles seem to be the biggest weakness we've found on land skirmish maps but on a map like Flooded Strip Mine that's larger the tactical missiles aren't so much of a weakness because of the range.
- Four-Leaf Clover: https://replay.faforever.com/17387027
-
@tyne141 Thanks, I’ll have a look ahead of the next release. I’m in the middle of tweaking M27’s tmd logic to handle massed tml and billy nukes so the replays highlighting tml issues are well timed!
-
So after trying to play with M27AI on DualGap Scale Adaptive around 2 min in the entire game freezes and I have to force kill it. This is the log I got from it game_17452319.log
-
@igneustempus Thanks, it looks like M27 will hard-crash on any maps that have mexes outside the playable area, I'll have it fixed for the next version
-
v42 Update
This update was almost entirely about fixing issues highlighted by replays people have sent me:- Various adjustments to Czar and Soul ripper logic to make them avoid large concentrations of enemy ground AA better
- Various adjustments to turtling logic so it's less likely to preemptively build T2 arti, large amounts of T2 PD, and/or mobile artillery
- Various adjustments to bomber defence logic, including expanding the cases where bombers will target enemy fixed AA buildings
- AiX Omni vision support - When a teammate/M27AI has map-wide omni vision then intel units shouldn't get built. If the enemy team has map-wide omni vision then stealth shouldn't be used.
- Multiple enemy TMLs and/or billy nukes should now be defended against
- Engineers should now be able to handle enemy cloaked selens blocking mexes
- 21 Other misc changes and 17 bug fixes, including fixing hard-crash caused by maps with mexes outside the playable area, and a bug that prevented backup logic for deciding what experimental to build from working (most relevant for unit restrictions and modded games)
Acknowledgements
- tyne141 – Replays highlighting M27’s vulnerability to massed TMLs
- Yung Dookie – mentioning they were practicing against M27, which meant I had a few replays I could check for flaws in M27’s approach
- Radde – A number of replays highlighting flaws in M27’s turtling approach
- Splitice – Highlighting M27’s issues with not building many experimentals (in a modded game) and units dying to long range units.
- IgneusTempus – Replay highlighting hard crash on dual gap
-
Great work! I think it can play at around 700 rating in 1v1. AI uses bombers quite well, its pain in ass to deal with them even with air control. All in all pretty solid.
I played some games with it, search "M27 testing" if you want to see them. What i noticed is: strange unit movement and questionable unit composition. For example it will build too many t1 maa while being at disadvantage. It will not contest huge concentations of reclaim (cadmium gree for example). It's pd logic is kinda bad too. Like it will build pds in base where it's not doing anything useful (regor highlands). Also its plateu logic working strange (on regor highlands it never dropped three mex expansions with civs but dropped 1 mex hills).
I think it ecoes too much maybe? On some maps it's ok but on some it snowballs quite bad. -
@tomma Thanks for the feedback and for labeling the replays, I'll have a look to see what adjustments can be made
-
Various mostly unrelated changes based on replays provided:
- Adjustments to experimentals, including adjustments to when to build, targeting/attack logic adjustments for land experimentals, improvements to Novax target prioritisation
- Improved response to T2 bomber snipe attempts
- On chokepoint maps reclaim should be factored into the decision of where to setup the chokepoint
- Basic support for games where there are no enemy players (e.g. survival maps)
- Sniperbot attack logic rework
- Optimisation of the logic for calculating rally points (now takes c.10% as long)
- 12 Bugfixes, 38 other Misc changes
Acknowledgements
- Radde – a number of replays highlighting flaws in teamgames particularly late-game scenarios
- Wingflier – replay highlighting M27’s vulnerability to a Corsair snipe
- Relent0r – Highlighting performance concerns on Ian’s Cross, and a replay highlighting some issues on Fields of Isis 2v2
- Tomma – Various 1v1 replays, highlighting a couple of points that could be improved on further (e.g. bomber dodging)
-
Could you add support for foreign engineering units (units sharing)? Now, as far as I understand, buildings and experimental units are built сonsidering of GetFactionIndex
-
@art-wiedzmin If you're talking about e.g. a Cybran teammate giving engineers to a Seraphim M27AI, and having the Seraphim M27AI build cybran experimentals, this is already supported. E.g. if you spawn in M27AI in sandbox, give it a paragon, and a bunch of T3 engineers from a different faction, it should build an experimental with that faction's engineers (so if you gave it Cybran T3 engineers and it had no other T3 engineers, I'd expect it to start on a monkeylord).
There are a couple of bits of logic that will be affected by the base faction (e.g. when deciding what type of experimental to build it will be assuming it has engineers of its base faction so its decision might be different to if its base faction aligned with those engineers, while some parts of the logic like building hives will also be faction index dependent) but this shouldnt prevent it from building any experimentals of the gifted faction.
-
V44 Update:
First part of planned improvements to teamwork (released early due to a hotfix for a rally point bug in v43):- Resources should be shared amongst the team
- Resource producing buildings should be gifted to allies in some (rare) cases
- Teammates overflowing resources should impact on other M27AI's calculation of their available resources
- Engineers should no longer try and claim a mex that an allied M27AI is already planning on claiming
- Teammate's air power should be disregarded to some extent if they are far away
- Units should now try and retreat from T2 PD that hits them but hasn't been revealed yet.
- Fixed bug that would cause M27 to think there was a safe rally point near the enemy base (leading to various unintended behaviour, such as ACUs 'retreating' into a heavily fortified position)
- 8 misc changes and one other bugfix
Acknowledgements:
Relent0r - highlighting error message
Radde - replays showing strange decisions by m27 which were caused by the rally point bug -
Latest changes (v45 summary)
This update's main focus was on teamwork although I also got sidetracked into improving PD placement logic.- M27 teams should coordinate which plateaus they will try and drop on so they dont all go to the same plateau
- Land scouts for mexes should be shared to avoid doubling up
- ACU kill targets are now coordinated even if the ACU isn't the closest one to other teammates
- Improvements to the decision on where to build PD on maps with cliffs near the start position where M27 isnt choosing to turtle
- Improvements to the strat bomber target selection to allow for a more seamless viewer-bombing experience
- 19 Bugfixes and 20 misc changes
Acknowledgements:
- Relent0r – Highlighting bug on Moonlight where M27 would incorrectly see there as being 1 chokepoint (when there were 2)
- Fearghal – Replay containing errors and crash
-
Greetings
I've tried playing several maps with the latest updated, however it keeps crashing around the 5 minute mark. I disabled all other mods , it still crashed , changed maps still crashed. If you need more infomation let me know. I've not familiar with how feedback is given here.
I did see someone else managed to upload their game log, how IDK. -
@savinguptobebrok Could you give me a couple of the replay IDs where the crash happens? (the earlier on the crash happens the better)
-
Here is the one with no mods (Uveso & m27 only)
https://replay.faforever.com/17705860
If you want the game log or crash log let me know.
-
Thanks, looking into it further for some reason v45 was only compatible with the FAF develop version of FAF (hence why my pre-release testing didnt pick up any issues as it was all using FAF develop). I've uploaded v46 that reverts it back to v44, and will either upload a new version if I figure out the cause of the incompatibility, or wait for the current FAF develop changes to be incorporated.
-
Latest changes (v47 summary)
The main focus of this update was on optimisation. Special thanks to Softles who wrote some work scheduler code that I was able to use to try and spread out some of my function calls to improve performance.- Fixed the bug from v45 that would cause every game on FAF standard (not FAF develop) to crash when an M27 bomber fired.
- Added in logic for doing a simple profiling of AI performance which can be run by any AI (even if no M27AI is in the game) - for use in place of a normal AI tourney
- Incorporating Softles' workflow scheduler to the majority of M27's loops
- Further optimisation of functions relating to recording the units in a platoon and calculating the threat of enemies
- Reduction in the amount of error messages displayed
- 3 other bugfixes and 3 other misc adjustments
Overall based on my '4v4 UEF Africa for 10m' benchmark, v47 is approximately 8.5% faster than v46.
Acknowledgements:
- Softles for providing work scheduling code
- Savinguptobebrok and Fearghal – highlighting crashes caused by M27 (in every game)
- Relent0r – Highlighting an issue where the ACU can build T1 power when in a vulnerable position (no change was made as it’d be too much effort for a niche scenario – essentially if all our power is destroyed, and we lack intel, then the ACU thinks there are no nearby mobile enemies and tries to build a pgen, but by that stage it will have lost anyway)