M28AI Devlog (v138)

@relentless I'd suggested 1.6 as the modifier I thought would beat Sladow on that map, and being a boss Sladow did 1.7 instead and crushed!

Although there were plenty of improvements from a BO perspective the ACU I didn't really change due to the likelihood of the benefits outweighing the costs in other situations - from its perspective, it had a better gun than the enemy ACU, was full health, the enemy ACU was damaged, M28's ACU was on its 'side' of the map, had friendly tanks and PD relatively nearby, the enemy only had access to T1 and no significant bomber/gunship threat, it recognised there was enough danger that it should try and run, and it picked a location that was both away from the enemy and would've ultimately brought it closer to friendly PD (although the latter is more by coincidence than by plan). I.e. one of those scenarios where a split second judgement from a human is likely to give a much better result than the AI since the issue was more having the ACU in a place where it could easily die due to being too far from potential support.

One of the changes I made though was to make tanks no longer abandon the ACU to its fate (the c.3 blazes that were nearby ran when they saw the enemy army instead of fighting to give the ACU more of a chance) but even with this change the ACU would've likely died (it ended up sub-100 health on the desynced replay).

However the BO stuff was embarassing for me with it all largely caused by the early air fac upgrade - the early upgrade meant it didn't have enough engineers (so had little power and didn't even get mexes near the base), and it quickly stalled energy and overflowed mass - I'd hoped for much better of M28 on that side of things!

v41 Update
Main new feature is laying the groundwork for M28 to take over campaign AI (i.e. allies and enemies), although this is still in the very early stages

  • 6 changes for replay 20937306, primarily relating to bugfixes/oversights, for example fixing an issue where TMD could be built far away from the intended location (and so be of no use), and where on very large starting areas the ACU would move a while before building its first land factory. Support also added for building underwater mass storage.
  • 11 misc changes and fixes, including having some MAA support a fatboy by staying under its shield to protect from air, reducing the frequency of a number of error messages that could arise with unit mods, and making M28's air force less likely to suicide into the enemy just to protect a friendly experimental
  • Introduced new option for allies and/or enemy campaign AI to make use of M28's logic for managing their units. This option can be set in the game settings on a campaign map. Note that it is in the very early stages so I expect on most campaign missions it could break the mission entirely. So far it's only been tested on SC Cybran mission 2 (although even in this case in some scenarios use of the cheat menu to ctrl-K off-map units may be necessary to progress the mission if it is stuck after a long period of time). I'll hopefully be working through other campaign missions over time to improve this option's compatibility.
  • 7 changes to campagin missions identified when testing the above, including fixing an issue where huge numbers of T1 engineers would be built by a T2 factory (if T2 engineers were restricted from being built), and fixing an issue where naval raiding units could end up idling at base.

Acknowledgements

  • Fertgyl – replay with a bug with TMD build locations, highlighting how mass storage can be built underwater (something I wasn’t aware of – it looks like it was a change introduced by FAF earlier this year), and a video showing a bad air engage by M28
  • Clyf – highlighting extracts of error messages in logs relating to unit mods
  • Zhanghm18 – replay and logs relating to issues that can arise when large numbers of unit mods are used with M28

v42 Update

Most changes related to improving M28 as a hostile AI for campaign missions.

  • UEF M1 - 4 fixes relating to error messages and the playable area
  • UEF M2 - 8 fixes, including improving compatibility if M28 is a teammate (as well as hostile AI), and an issue that prevented M28 dropping engineers by the research station to repair it
  • 4 fixes for replay 20973901 and 20969506 relating to building asfs, naval raiding, and rare cases where units could stay idle after trying to avoid a bomb

Acknowledgements

  • Fertgyl - Replay highlighting a bug where an engineer became stuck permanently after trying to dodge a bomb

v43 Update
21 fixes and adjustments based on replays, including:

  • Fixing a bug that could break M28 when trying to get units to shield
  • Fixed some issues with the teleport logic such as where the 'teleport away' order would be canceled so the ACU could try and dodge a bomb
  • Various adjustments to gunships to try and make them both less aggressive and more aggressive (hopefully in the right way - i.e. less likely to suicide into enemy asfs, but more likely to try and attack an area with weak ground based AA)
  • Various adjustments to reclaim, including fixing bugs that could lead to idle engineers, and improved tracking, along with making the ACU more likely to priotise areas with reclaim
  • Fixing some error messages relating to naval bombardment, and added in missing tracking that was meant to reduce M28's tendancy to allow mass stalling while trying to build an SMD or SML missile.

Acknowledgements

  • Azraeelian Angel – Several replays and detailed analysis – although desynced, some of the points and map specific issues led to a number of changes
  • Fearghal replay where M28 broke due to a bug with finding units to shield.
  • Zhangham log highlighting a bug with M28’s naval raiding logic
  • Fertgyl – replay highlighting idle engineers

Hello Maudlin,
your AI is really overwhelmingly good. Now the BUT ^^ During the course of the battle, the Sorian AI always hindered the build-up with various landing troops and surprised a careless player who only had the front in view. Could you maybe in your AI? also integrate more landing troops? Thanks for your great work so far.

I'm assuming you mean transport drops? It's down on my list as a possible longer term point but transport logic is very painful to code (just getting it to work for engineers has taken a lot of work) and it requires a lot of judgement so can be tough to get right (i.e. the main benefit of it would be scenarios where gunships or bombers wouldn't work (e.g. well defended with AA), ground units would work (no enemy ground units/PD), but which isn't on the front lines where ground units would be going anyway, and which has an AA free nearby location to drop at).

v44 Update

  • 12 changes to UEF Mission 3, both for M28 as a buddy, and as a hostile campaign AI, including making the campaign M28AI be more aggressive with units if it has no base to retreat to
  • Fixed a bug where M28 would build its first factory as far away as it could if there wasn't a location within range of a mex (e.g. williamson's bridge)
  • Expanded profiling related options, and significantly optimised late-game T3 arti logic (meaning in cases with very large numbers of units it should run roughly 10 times faster, reducing the tendency of M28 to stutter late-game)
  • Make gunships individually slightly less aggressive
  • Added wall reclaim logic to engineers

Acknowledgements

  • Azraeelian Angel – Mapgen Replay which included players using walls to disrupt the AI's movement
  • Zhanghm18 – Highlighting crashes taking place which appear to be due to using too much memory
  • Fertgl - Replay/screenshot showing M28's poor choice of its first factory location

v45 update
Continuing the trend of small (and therefore more frequent) updates, this update is based on two replays, fixing issues with where units retreat to, and some naval related changes

  • Decided to experiment by making ACUs retain their near-suicidal early game aggression much later on in full-share teamgames (but only if they are high on health)
  • Replay 21020574: 7 changes, including fixing an issue where Aeon T2 destroyers would be scared of T1 torp launchers, making torp bombers less suicidal the further away the enemy is, and adding a workaround for an issue where a T2 PD gets ignored
  • Replay 21026248: 2 changes, the main one being improving the logic for determining where land units should retreat to - previously they would retreat to expansion 'mini-bases', even after the base had been overrun by the enemy (resulting in ACUs charging into swarms of enemy units)

Acknowledgements

  • Mischievous – mentioning they fought against an AI and giving a replay (which identified some flaws with M28’s logic on when to press a naval advantage)
  • Azraeelian Angel – Replay showing M28 being crushed (in part due to its poor choice of locations to retreat to)

v46 update

  • Neutral non-combat civilians with a decent mass value should be reclaimed
  • Significantly increased amount of PD that can be built in some scenarios (previously it was capped at 2 T2 pd in a number of cases)
  • 5 changes from testing a nomads late game scenario, including adding specific logic for the Jericho to fire at enemies within its range (since attack-move triggers when very close), and target-leading logic so it is more likely to hit moving enemies, while also adding target-leading logic for T3 arti (e.g. when firing at an enemy land experimental)
  • 4 changes relating to UEF Campaign M4, including fixing an issue where land units would try and reinforce a land zone on another island.

Acknowledgements

  • Sprouto and Irontristonia – helping with how to adjust the attack-move logic for the Jericho (in the end I decided against it since it would affect all blueprints)
  • Relent0r - screenshot showing lots of part-complete factories (I adjusted the building logic to add a redundancy to hopefully prevent this happening in future)

v47 Update
Support for UEF M5-6 and FAF M1, amongst other changes.

  • 21040509 - 6 changes, including fixing some issues with determining land zones on maps with loads of mexes near the start, and having the ACU alternate between power and mexes where there are loads of mexes in the start area
  • M5 UEF - 15 changes and fixes, including adjusting 'nuke overwhelm' logic to be more likely to fire nukes periodically with split targets instead of all at once at the same target, and various improvments to gunship logic to better cope where the enemy has threats in opposite locations to the start position and be more likely to ignore a lone MAA unit if there is a major threat that is vulnerable to air
  • M6 UEF - 9 changes and fixes, including delaying M28 logic from applying to various aspects (such as land and air units) until the initial cutscene has ended, and no longer treating Aiko's initial base as part of the same team (which would lead to 'invisible' cybran enemies since Aiko doesnt see them as an enemy)
  • 6 Misc changes, including adding reteat logic for czars and soulrippers
  • 7 changes based on Azraeelian Angel's replays, including fixing some issues with teleport and supporting the upgrading of mexes gifted over when a human teammate (such as Terarii) dies
  • 3 changes based on Radde's replays, including making units less likely to suicide into an enemy T2 PD

Acknowledgements

  • Jip - Spending several hours imparting wisdom on how to optimise memory, and trying to debug the source of high memory usage for FAF AI (M28 and non-M28)
  • Azraeelian Angel - several teamgame replays, and highlighting issues with FAF M1 campaign
  • Radde - A number of teamgame replays

v48 mini update

  • Added megalith micro (and hoping it doesn’t go horribly wrong - sometimes during testing giving a move order to the megalith would make it try and turn around instead of walking backwards)
  • Monkeylords should be more likely to attack if a nearby megalith is being killed instead of standing just out of range of the attacking unit
  • various twraks to some of the variables used by land units (increasing the cases where adjacent zone threats are taken into account)
  • added ‘exp focus’ attack logic for if there are 2+ experiments within range and one is injured so the injured one gets targeted first

Acknowledgments

  • Radde - replay where a megalith and monkeylord died to 2 gcs while doing almost no damage

v49 Update
41 changes and fixes mostly relating to support for FA campaign missions 2-4.

  • FA Mission 2 (Dawn): 8 fixes, including better handling for scenarios where a team changes part-way through the game (although this requires the code to be manually added for the particular mission, so it won't support Fletcher's betrayal in FA M6 yet), and support for completing an objective where the AI upgrades the target unit (to be killed)
  • FA Mission 3 (Red flag): 6 fixes, including support for the opening mission progressing (i.e. a temporary workaround for the current FAF issue with this map, pending a separate change fixing the mission itself being incorporated)
  • FA Mission 4 (Meltdown): 4 changes, including fixing an issue where a 'dead' M28 ally would make M28 think it had no mass or energy stored if the game was in sandbox
  • FA Mission 5: 6 changes/fixes, including support for an ACU spawning part-way through the game to have a designated base and use M28's ACU logic (i.e. so Fletcher should establish a base where he spawns).
    Note that FA M5 isn't fully compatible yet.
  • 17 other changes based on some AI vs AI games on twin rivers, including various adjustments and fixes to reclaim logic.

Acknowledgements

  • Jip - fixing various FAF lua errors and incorporating them into a patch with lightning speed
  • 4z0t - sharing a WIP version of a custom campaign mission where M28 wasn't working which meant I was able to fix a bug that occurred if brains were created at a different time to what M28 was previously expecting, and highlighting that FA M2 (dawn) didn't work

v50 Update
45 changes and fixes, including:

  • FA Mission 5 - 7 changes, this mission is now supported
  • FA Mission 6 - 2 changes, this mission is now supported
  • SC Aeon M1-M2 - 1 change made (M1 is now supported, I didn't get to the end of M2 in testing)
  • Kitoons replay - 1 change (increased the amount of battleships M28 can build when it has won navy)
  • Radde replays (various) - 10 changes, including a workaround for a rare issue where a novax satellite gets stuck; issues with power-stalling causing shields to stay down, experimenting with TMD being built in response to MMLs (this may well make M28 weaker), and fixes to some gunship movement logic
  • Bart replay - 20 changes, relating to various improvements when the game is in norush mode, and improved support for experimental shield and resource boosting mods
  • 4 other changes

Acknowledgements

  • Radde - various replays, which highlighted some bugs/issues and M28's weakness against MML
  • Bart - replay which highlighted various norush issues
  • Kitoons - Replay that showed 5 Cybran battleships aren't enough to break through a well shielded firebase

v51 Hotfix

  • Fixed a bug that would break M28's logic for the zone in question if M28 started building a T2 arti
  • Improved M28's approach to building spy planes to deal with cloaked laser ACUs so it should consider helping land experimentals near a cloaked ACU (previously it would just help gunships).

Acknowledgements

  • Radde - several 1v1 replays and highlighting M28 was bugged in one of them

Can I help you with something with m28? I'm interested in this project @maudlin27

@freemanitsnothe
Replays within a couple of days of an update showing M28 being beaten are usually useful, particularly if it's against an AiX version (since against 1.0 a decent player can just outplay it). Naval focused games are also likely to be more useful than land based since I get much fewer replays on naval based games (so M28 is likely to be worse at naval combat than it is at land combat).

If you've got coding experience then one issue I'm currently struggling with is figuring out the cause of the high memory usage for M28 and more generally for the default FAF AI - it's both higher than expected, and growing over time more than expected, and can cause the game to crash if it goes over 2GB (which is more likely on larger maps with lots of unit mods). More information is on the AI development discord if it was something you wanted to look at.

v52 Hotfix

  • Fixed a bug where M28 would stop using experimental bombers if it had 2+ (introduced in v50)
  • Fixed an oversight with M28's resource sharing logic which would only use absolute values, leading to some teammates overflowing mass while others didn't have lots (where their total capacity differed significantly).
  • Improved skirmisher enemy detection logic to include all direct fire enemies in adjacent zones (previously it would only include the closest enemy for performance reasons, but this would sometimes lead to e.g. hoplites running into an enemy guncom and dying)
  • Slight delaying in late game eco (mass fabs and quantum gateways) if the M28AI hasn't built an experimental in the zone in question yet.
  • Long range enemy threats such as T2 arti should be taken into account when deciding where units should retreat to (to reduce instances where units retreat to a location within range of enemy T2 arti)

Acknowledgements

  • Radde - 2 Replays beating 1.3 AiX resource M28 (due to the hotfix only some of my planned changes for this feature in v52)
  • Fertgl - Highlighting a bug with M28 not using experimental bombers

@gatorized Could you post the replay ID?

Trophies
Introducing a new 'feature' - trophies! The first person to send me a replay for a more recent version of M28 than the current trophy holder, where the replay meets the trophy requirements, will be acknowledged as the winner of the trophy in the next update notes. The two trophies are:

  • The Radde trophy - Named after Radde who has sent a large number of replays fighting 1.3 and 1.4 resource M28s in recent months - awarded to the first person or team to beat M28 on a 15km-20km size mapgen when M28 has a 1.4 AiX resource bonus (i.e. it can still have 1.0 build rate bonus), with no SIM mods other than M28AI. 1v1 or teamgame submissions accepted (teamgame must have mirrored start positions and equal M28 numbers to player numbers)
  • The Sladow trophy - named after Sladow, who beat 1.7 AiX M28 (v39) - this trophy is awarded to the first person to beat a default AiX M28 1v1 (i.e. 1.5 resource and 1.5 build rate cheat modifiers) - i.e. any map, any mod.

Note the requirements for the trophy are subject to change with each release of M28.

v53 Update
Kiting and anti-firebase improvements, including:

  • 7 Changes mostly relating to trying to have hoplites do better at surviving against an enemy guncom (although the changes should be relevant to mongoose and sniperbots as well)
  • Replay 21200371 - 5 improvements relating to enemies setting up T2 arti firebases near M28's base
  • Fixed M28 not building navy on the map Sludge (along with 2 other minor changes)
  • Replay 21193022 - 7 changes, including improving the speed with which the rear M28 position will get T3 air and fixing a bug that lead to loads of TMD being built
  • Replay 21206374 - 6 changes, including TMD being built against Seraphim cruisers+aircraft carriers, and T2 being built against nearby enemy naval threats
  • 2 other changes, including having hover/amphibious units in the water retreat back to base rather than to the middle of the water zone they're in

Acknowledgements

  • Zhanghm – doing some testing on high memory scenarios to confirm the theory that the variety of units built in a game is likely the biggest factor in memory usage.
  • Radde – Land and naval replays, both 1v1 and team games, which highlighted a number of improvements required.
  • Fertgl – Screenshot/replay showing a poor choice of rally point by M28 on water for hover units.
  • Gatorized – Image referring to M28 not building navy (fortunately I was able to recognise the map from the screenshot, but for future reference a replay ID would make it easier for me to identify the issue).
  • Jip - Fixing a bug with the navmesh, being quick to merge a pull request fixing a categorisation bug, and continuing to fix minor FAF lua error messages

v54 Hotfix

  • Fixed a bug that would break M28's logic in some cases when faced with a nearby enemy firebase.