M28AI Devlog (v101)

@zhanghm18 It shouldn't be building fewer of them - to clarify, the change I mentioned in the summary was to reduce how threatening M28 thinks its Czars and soulrippers are when judging if it's got a strong enough air force to assault a heavily fortified position. I was finding that it would proceed with an assault (as a Czar in mass terms is c.26 broadswords), the czar would quickly lose its shield, and it would retreat before it had overwhelmed the shields, leading to a bunch of losses for no gain.

The reason it doesnt build them much though is both that it currently handles/uses them similarly to a normal gunship (M27's logic for czar in particular was highly specialised and would take some time to put in place) and I'm concerned that mass for mass T3 gunships (restorers/wailers) would be more cost effective since M28 is able to significantly reduce the downside of mass T3 gunships (that they die easily to aoe) while benefiting more from the upside (can be repaired at air staging).

hello maudlin,

I've used your AI with the new mobile factory features and I'm amazed your AI is already using them. WOW

@saver Unfortunately it's something I'll likely be disabling in the short term as it can lead to some errors (e.g. when aircraft carriers get near the shore or fatboys move from land to water) since M28 currently thinks these are immobile factory buildings. I'd been planning on adding specialised logic for the fatboy so will have a think if there's a simple change I can do so the feature isn't lost completely though.

You can differentiate them from 'normal' factories by using the EXTERNALFACTORYUNIT category

A work of art is never finished, merely abandoned

Hi @maudlin27

Just to let you know we found another map where M28 does nothing upon startup. M27 works fine. Do note the map is kinda buggy though (we had trouble building on some wrecked mexes), but I don't think it is related.

Here is the replay on the map (TriGap_alpha) that shows the issue: https://replay.faforever.com/20740907

Thank you!

Oh, btw, the telesnipe feature was a lot of fun, I lost a T3 artillery twice because of that 😄 Didn't expected the teleport, didn't even understood what happened after the first artillery loss.

Maybe an improvement would be that the AI teleports a support commander instead of the ACU, if possible. The second teleport of the AI was a failure (I had build T1 PDs) so he lost his ACU. Not a big deal as we were playing in Supremacy mode, but this would have possibly been a problem in case we were playing in Assassination mode. The teleport was indeed a suicide mission in that case, no way a commander would escape that amount of DPS with my PDs. Would have been a great suicide TP for a support commander though.

@v_k Thanks, it should be more cautious with the telesnipe in assassination mode, especially if it's the last ACU on M28's team (although it may still try as a last-ditch attempt)

Re 20740907, it works ok for me (as a desynced replay), so I'm hoping it's due due to the recent FAF exe changes (which means there's a difference in the underlying game exe between FAF develop and FAF) as I've had similar reports on other maps where M28 normally works fine. Prior to the next patch arriving (which I've heard mention might be in the next few days) one suggestion if this happens is to try hosting the game on FAF develop (if it's not working on FAF), or on FAF (if it's not working on FAF develop).

v27 Update
Assortment of different changes, ranging from improving the build order on one map, refining late-game logic, and optimising pathing for large maps

  • 10 mostly build order based changes to Verdant Valley
  • Fixed a bug with generating map pathing that caused Signalpoint team AI map to not work, along with fixing a bug during games on maps with underwater mexes
  • 15 changes based on a Xander6 Adaptive replay, including adjustments to decisions on what experimental should be built, more precise gunship targeting logic, fixing a bug that meant Czars and SoulRippers often wouldnt attack, and fixing a bug that meant telesnipe upgrades would take much longer to get
  • 2 changes based on Selkie Isle map (fixing a bug with overbuilding SMD against Seraphim battleships, and making M28's air force more likely to defend torpedo bombers)
  • 8 changes based on fields of isis, mostly around trying harder to shield friendly T2 arti
  • Units with mobile factories (e.g. aircraft carriers) should no longer be treated as factories (so shouldn't build anything). However, to compensate for this I've added support for using the fatboy as a mobile factory.
  • Significant reduction in the time taken to load frostmill ruins, to under a minute (for decent CPUs), from a previously unrecordable (due to how long it would take) time
  • 10 other changes, including adding a redundancy for when engineers get stuck trying to load into a transport, improvements to the unit cap logic and fixing a bug that would cause land factories to be overbuilt late-game


  • Saver – Highlighting error on Signal point map
  • Radde – 4 more replays, including one that featured M28’s first successful double-tele-snipe (which was great to see)
  • Babel, V_k, Anon, and Jip and Relent0r – Babel, V_K and another user highlighted maps where M28 didn’t appear to work. I got similar issues but with Jip and Relent0rs help I realised I was getting the error if I tried playing FAF after updating the FAF develop exe, or vice versa (trying to play FAF develop after having updated the FAF exe), so I expect this is the same point – i.e. it’s due to changes made to FAF which should hopefully align the two in a few days.
  • Sprouto – suggesting warping engineers that are stuck with a transport load order (but not actually loading) to be at the transport location (which solved the issue in one replay)

v28 Update
Smaller update focused on the 40km map Spiralarm Harbour:

  • Further pathing optimisation, reducing the time taken to load this map from 319s to 16s (at the cost of accuracy) - very large maps with large numbers of islands should make use of this optimisation, but for most maps the more accurate previous method should be used
    20 Other changes, including:
  • Improved transport rush build order (including use of multiple transports if there are lots of islands to drop and few players), and other initial build order tweaks
  • Fixed some issues with transports, particularly where there are multiple transports being managed, that could result in no engineers being loaded, or engineers being dropped at islands that already have factories
  • Expanded civilian capture logic to cover capturing civilian mexes, hydros, and other power, and factored in the unit to be captured's build time to the decision of how many engineers to send to capture it
  • Fixed some issues with the unit cap that could lead to the unit cap being reached, and that were preventing air staging or mexes being built

v29 Update
A quick update to reflect further pathing optimisation:

  • Optimised the initial pathing generation for land zones - very small zones should now be culled resulting in a significant speed increase on some maps (e.g. on the map being tested, which was a mapgen map, originally it took roughly 40s to load, after this change it was down to under 3s)
  • Adjusted retreat logic for units running away so they shouldnt run to the rally point if it's in a different direction to the main base (reducing instances where e.g. mongees, hoplites and mobile shields would suicide into an advancing enemy)
  • Added compatibility for mods that add unusually sized units (e.g. experimental units that are a different size to any existing FAF unit should be built sometimes now)
  • Fixed a couple of minor bugs


  • Relent0r - Replay showing 2vM28 which highlighted the long load time and issues with retreating units
  • (zhanghm18 - reminder of issue previously highlighted with mod units not being built)
  • Babel - replay with M27 and M28 where M28 didnt work (due to an issue with M27)

v30 Update

  • Aeon will now in some (rare) cases consider building a paragon
  • 6 Improvements to norush games, including fixing an issue where engineers would stop building units (due to them trying to build outside the norush radius)
  • Mobile stealth should be less likely to be used and built for areas covered by enemy omni
  • 5 bugfixes and other adjustments from a Strydxr replay, including preventing units being assigned special M28 debug names (from some testing code I forgot to disable), and having naval AA less likely to suicide into the middle of a group of gunships


  • Bart - Replay highlighting norush issues on open palms
  • Strydxr - Replay showing a name display bug and some other bugs

v31 update
15 adjustments and bugfixes:

  • Various tweaks to the decision on what experimental to build, including fixing an issue with working out how many experimentals are under construction (so M28 should no longer start constructing 3 nukes at once), and making it more likely for air experimentals to be built in some scenarios
  • Fixed some bugs where multiple transports are waiting for engineers and also added a workaround for maps with poorly designed plateaus (that cant be dropped)
  • Added additional retreat logic for MAA to consider just running in the opposite direction to the enemy
  • Fixed a bug that could break engineer construction logic (typically late-game)
  • Added special gunship retreat logic, so if the gunships try to retreat and would be going straight over a load of enemy SAMs, they should consider whether a detour would help them avoid some of the SAMs.
  • Fixed a bug where paragons weren't being counted as game-enders (meaning they wouldn't benefit from M28's special shielding logic)


  • Fertgl – Replay showing 2 M28 transports getting stuck in a loop alternating between each other for a drop zone.
  • EsaihSiX - for putting M28 in the title of the 6 (human) v 4 M28 replay (20778889) and posting it in discord, which was the source of most of the changes made this update

v32 update

  • 7 changes for FA Mission 3, the most noticeable of which should involve building fewer land units and not rushing an SMD just because the enemy has a seraphim battleship
  • Improved support for low mex maps (1-2 mexes in the starting zone and none or almost none in the rest of the map) - M28 should build far fewer factories initially and focus on upgrading its mex sooner. Note that its build order is in no way optimised, and an optimised human build order will still crush it at 1.0 modifier.
  • 10 changes mostly relating to improving M28's approach once it has a paragon (making it more likely to build air factories and experimentals, fixing an issue with building a second paragon, etc.)
  • Rewrote part of the pathing logic to fix a bug (most likely on 20km+ land maps) that could cause units to move in the opposite direction to where they were meant to go
  • 4 other changes, including fixing an issue with underwater start points, and fixing a bug I realised has been present since pre-v1 that caused too many engineers to be sent to other zones (the number of engineers a zone was requesting featured double-counting in some cases)


  • Retributer - highlighting issues with M28 building too many land units on M3 of the FA campaign
  • Bart - Replay highlighting issues with paragons and wierd pathing for a GC

Hi - I have a question aswell:

My friends an I are always playing against AI and since AIx isnt a challenge anymore once you figuerd out how they work, we tried M28. We were 2 and in the end we lost vs 1 M28. Next Game we won (still 2vs1 though .. ^^) and we analyzed the replay.
Now the question: Does M28 cheat like AIx? With shorter building times and do they get somehow more ressources?
We couldnt really figure it out, because somehow M28 seems to have alot of Units and almost never Mass or Energy Problems, it never seems to get like masslocked.
We think its just because M28 is so clever with pausing/unpausing updates, unit production etc. but we are not quiet sure because i bombed almost all his mass in that one game and (M28 had 2 Massextractors left, 1 T1 and 1 T2) and was still able to produce a sufficient supply of mass and units.
Well, as you can see, we are not Pros. But your AI gave us a great fight, very good work!

@calvalon M28 doesn’t receive any resource or build power bonus unless you’re playing against the AiX version.

I’d expect it to be very rare that it runs out of energy but quite common that it has low mass (ie 0 stored mass with negative mass income).

It should pause things to avoid running out of energy or if it’s mass stall becomes too severe.

It should also reclaim regularly so that might explain it having more units than expected (you could use 4z0t’s scoreboard and analyse a replay to see how much it is reclaiming and total mass generated to see how its gaining and spending its mass)

Ah ok thanks. I did not see any AIx version, thats why I asked. The only option I could choose from was just called AI: M28 so I guess its just the normal one then.
It did all the things you said, to perfection. Thats why we wondered. ^^

Thanks for the Scoreboard recommendatoin, I was anyway looking for a thing like that.

v33 Update

  • 6 changes made from a live replay I happend to come across where 3 new players tried to fight an AiX 1.5 M28, including additional backup logic for ships whose shots are blocked by cliffs, reducing the land factories built on small (in size) plateus (such as the setons' islands), and fixing a bug with the ACU's early build order where if it had no orders it would build too much power.
  • 8 changes based on a replay from Fertgl which highlighted a flaw with M28's MAA logic - in addition to a few fixed for this (hover-MAA should now support other islands, and MAA should no longer be massively overbuilt on small island bases) the transport drop logic is improved so they'll drop to multiple locations on very large other islands (to help with this replay where the start was a tiny island but most of the map was a separate island that both players had to fight over)
  • 7 changes based on a replay I did to test low mex maps for v32, the most impactful of which is a fix to what apppears to have been a very longstanding bug preventing M28 building and using mobile shields properly. Related to this I also fixed an issue where a fatboy would build mobile shields on repeat (despite having no use for them).
  • 2 Other changes, including having short range units ignore orders to retreat for a short period of time after being given an attack order (to try and reduce instances where e.g. a GC would move into enemy megalith range, then after a while turn around and retreat, having done no damage).


  • Fertgl – replay highlighting several bugs with MAA (infinite production and not moving outside of the core base when on a small island starting position)

v34 update
21 tweaks and fixes mostly to the early game logic, including:

  • Reducing the tendency to build defensive PD in response to nearby T1 PD, particularly against civilian PD (such as on Ambush pass)
  • Made seraphim combat scouts better at avoiding enemies, and more aggressive by having them attack non-combat scouts
  • Fixed an issue with updating the last known position of visible enemies (which could cause issues for example with units not retreating properly)
  • Fixed an issue that could happen late game with engineers having their orders constantly cleared (to try and move them away from factories so the factories can build units)
  • Added a workaround for an issue where the game incorrectly indicates MML missiles are being intercepted (which would cause M28 to overbuild MML)


  • Fertgl – Replay showing issue where M28 could get engineers idling at its base doing nothing

v35 update
This update was focused on reducing many of the error messages sent to the log that have built up over time, prompted in part by one of these highlighting an error on maps with mexes close to each other such as astro craters where available mexes weren’t always correctly tracked, involving 16 different bugfixes. This included:

  • Fixing issues with tracking unbuilt mex locations (which caused mexes on maps like astro craters rich to not be rebuilt after being destroyed)
  • Added some redundancies to decisions on where to build a mex in a zone if the only unbuilt location appears unavailable (fixing an issue where there could often be a significant delay until the last unbuilt mex in a zone got built)
  • Increased the cap on how many TMD can be built in a single zone, and fixed a bug with some units not getting TMD built to protect them from TML
  • Fixed various error messages that could appear (sometimes these were for minor issues, other times there was no issue but rather a valid explanation for why the unexpected scenario had arisen), including with the initial map generation, with trying to find the closest pathable location a land unit is on, etc.
  • Stealth boats should no longer be built if there are no main targets for them


  • Fertgl - Replay on astro craters rich where M28 failed to rebuild mexes that died to TML

v36 update

  • Removed debugging code I forgot to disable on release of v35 (that changes unit names)

v37 update

  • Fixed a bug introduced in v35 with tracking how many mexes of each tech level M28 has

v38 Update
16 changes, mostly bugfixes from testing against M27 on 3 maps (interestingly M28 won 2 of the 3 games upfront, and looked likely to win the 3rd after changes in then desynced replay, so maybe it is approaching the point where it has a c.50%+ win rate against M27 on larger maps - the maps were Nilfheim, Syrtis major and Open palms):

  • Fixed a bug where I forgot to disable debugging code in v37 which filled up logs with information about how many mexes M28 had
  • Various fixes to TMD, so that TMD should no longer be over-built in response to a TML threat, mobile TML shouldn't be double-counted, and upgrading mexes should properly reflect TMD coverage
  • Novax targeting fixes that could cause it to target underwater units or error out when consdering the ACU in some cases
  • Adjustments to T2 arti and radar builders and ctrl-K logic (for radars) to e.g. T2 arti should be built faster, and with radar coverage, when facing an enemy fatboy threat
  • Improved the open palms build order to use the hydro (this switched the replay from a heavy defeat by M27 to a likely defeat of M27)


  • zhanghm18 – Screenshot showing M28 attempting to build a modded naval experimental on land