M28AI Devlog (v130)

v76 Update
Very small update, essentially because I don't think I've got time for more substantial changes ahead of the Rainbow Cup and want this released a few days ahead just in case I've accidently broken something.

  • M28 should no longer reclaim teammates that are blocking where it wants to build it's late game arti-shield template (and instead just complain to them via a message)
  • Fixed a bug where units with shields could have them paused due to stalling E but not unpause them later
  • Added niche logic for units to be more aggressive if the enemy has nearby mexes and the unit's retreat is cut off

Acknowledgements

  • Melanol - Noting M28 can reclaim friendly units
  • Dr Dronken - posting a number of replays against M28Easy (one of which highlighted the paused shield bug)
  • !MarLo - suggestion about increasing aggressiveness when retreat is cut off

Hi maudlin, I have a question about the campaign function. Is it also possible to activate your easy version for the opponent? Also, a little info, I have created a mod for submarines that increases the diving depth, so that they can only be hit by projectiles with a damage range of over 2. This was more of a player's wish. Thank you for your work, M28 is great.

Hi Maudlin; we have another issue with a total simulation freeze while playing against the most recent M28AI. Here is a replay that reproduces the issue: https://replay.faforever.com/21934024

@sparky222b Thanks for the replay, it looks like the game ran out of memory based on the crash report - for future reference you can enable this in the settings (and then check the results in the log created by the game in C:\Users[username]\AppData\Roaming\Forged Alliance Forever\logs):
b226ccf1-ec04-4408-a19e-4daa5726d2e4-image.png
This can happen when the game goes over 2GB (which can be viewed via taskmanager). Some of the solutions I'd normally suggest (lower unit cap, only 1 AI to reduce unit variety) were already done so the only other suggestions would be to limit the unit mods used, pick a non-naval map, and/or pick a smaller map. Jip's also been looking at memory usage and IIRC may have uncovered an issue with how the game handles guard orders that has a higher memory footprint, so my hope is that in time (i.e. a number of months) the situation might improve slightly.

v77 Update (RC update)
Update based on the first weekend of the Rainbow Cup, featuring 43 fixes tweaks and new features. A full list of changes is included in the devlog, and I've summarised the potentially more impactful ones below.

A caveat for people taking part in the Rainbow cup - although I would hope that M28 reflects the below changes in-game, as with any update there's the risk of bugs and no guarantee M28's behaviour will work as expected.

Summary of changes

  • Fixed a bug that was preventing M28 building multiple T3 arti or game-enders on the Noro map; made it more likely to get a game-ender where an enemy base is outside the range of T3 arti
  • 9 adjustments to nuke targeting, including taking into account reclaim damage, fixing an issue that meant it would often cancel nuke launch orders, and increasing the damage required to launch a missile (so it should no longer target a single T3 mex with a nuke)
  • Introduced logic for the Aeon missile ship, and made some adjustments on how much navy is built on very small ponds (like Tabula Rasa)
  • Slight improvement in how MAA are prioritised for production if M28 has a land experimental without MAA support
  • Transports should drop early if under air attack
  • If a player loses mexes near their base (but still has production facilities intact) and M28 builds on them, M28 should gift the mexes back to the player
  • Added new logic for M28 engineers to assist a teammate's nearby T3 arti or gameender or battleship
  • M28 will occasionally consider gifting its asfs to a teammate (if that teammate has a significantly stronger air force)

Acknowledgements

  • Fearghal – Organising and funding the Rainbow cup (which provided the source for most of this version’s changes)
  • Farms – screenshot of replay where M28 wasn’t starting a T3 land fac upgrade despite having more than 200 mass income; Noting how M28 rebuilt Farms' mexes (presumably when they got destroyed) preventing Farms from making use of them.
  • FTX – suggestions on when to go gameender instead of T3 arti, and how much value to try and get from a nuke missile
  • sparky222b – Replay crash report

@maudlin27 good changes 👍

@maudlin27 Wow - I had no idea there was a hard 2GB memory limit. Is that a hard limit baked in to the FA executable? We'll try to reduce the scale of the fray to stay shy of it. Thanks for the info.

@sparky222b I think it used to be a hard limit, after changes made by Jip in theory it can support higher amounts (e.g. 4gb), but with AI it seems like as soon as it goes above 2gb the chance of a memory related error/crash is high even after that change.

v78 Hotfix
Hotfix for a couple of bugs I noticed (given the upcoming RC finals), the main one of impact relates to fixing an issue with UEF late-game:

  • UEF should now be able to build more late-game units (novax, T3 arti, Mavor) after they have built their first novax
  • Added a 'go slow' mode for when M28 has control of thousands of units, to try and improve cpu performance slightly (at the cost of 'competitive' performance) - normally M28 considers new orders for land and air units every second, when the slow mode is activated it will do this over a longer period of time (based on how many units it has).
  • When M28 is controlling large amounts of hover units it should only give them a new order every 6s (to mitigate issues where hover units such as blazes could get stuck for long periods of time).
  • 4 other minor adjustments/fixes, including adjusting whether M28 gets a second novax/T3 arti/mavor, and issues preventing M28 building in its designated 'late-game template' area.

@maudlin27

We still love your M28 more than any other MODS out there
The last two updates are very good, CPU performance was the last big issue for larger maps

Just want to thank you for your hard work ❤

v79 Update

Another Rainbow Cup focused update, with 25 fixes and other tweaks. More significant points include:

  • Improved plateau defence logic so e.g. a base on a plateau is better at trying to attack enemy mobile arti on an adjacent plateau (previously it would only focus on enemy buildings, and would move mobile arti meaning they wouldn't deploy to fire)
  • Various adjustments to the game-ender template logic, fixing a few bugs (some of which likely had a major negative cpu performance impact). Hoping this time it works as intended...
  • Added anti-stuck logic for when M28's units keep changing their minds about what zone to advance to due to an obstacle such as a cliff (e.g. see M28's experimentals in Zwaffel's game on Noro) - after a few attempts of alternating between the same 2 zones units should become more 'committed' to their last destination choice (meaning most of the time they advance)
  • Expanded naval assistance to cover experimental units and T3 subs
  • GCs should be more likely to suicide into enemy fatboys when they get relatively close
  • Non-M28 Teammate nuke targets should be taken into account when M28 chooses its own target (so it's unlikely to nuke the same place)
  • If engineers from a plateau drop die but the transport lives, it should no longer keep retrying the same plateau
  • Improved fatboy kiting to handle dangerous units just inside its range but 2+ zones away (previously it would only see units 1 zone away so often e.g. a megalith could get a head start before the fatboy would start retreating), while the fatboy should consider moving backwards when its shield is low (previously it'd only consider it when its shield was still high)

Acknowledgements

  • Zwaffel - mentioning that M28's experimentals didnt do much on the Noro Rainbow Cup replay

@maudlin27 2ae3607c-6477-43fc-9201-9ebfc3086193-game_22033773.7z Hi, today I was playing relaxed with a friend using your easy version. Unfortunately, at the end of the game your AI flooded the logs with data. Maybe. the log file helps 🙂

@saver Thanks, yes I'll be able to have that fixed for the next release

@maudlin27 A quick question. I tried playing 20x20km Voodoo castle with 5x M28's with all units enabled. For some reason the game was pausing every few seconds from like minute 2 onwards, F11 revealed i am behind in data. With air/nuke/t3 arty disabled the game will play normaly, though reduced sim speed from min 30 onwards (expected). Do you think the game should be able to handle this settings normaly or is the map to big ?

I kept playing 1 such game and after like 15 minutes, it crashes, with error message "warning: Error running lua script: out of memory". I attached the .log for you.

Thanks for your work, me and my friend play with M28 all the time and have great fun !

game_22066307.log

@goblinsly2 Normally I would expect M28 to handle a 20km map with 5 AIs (absent mods), but checking the map I suspect the reason is the large number of cliffs - whenever an air unit flies over them M28 tries to figure out the closest land area to it, which results in a significant strain where there aren't any nearby (both requiring more CPU resources, and more memory usage).

The crash was ultimately due to exceeding the memory, while the stuttering early on was primarily caused by its logic for calculating the zones near a particular air unit.

I'm doubtful I'll be able to make a significant improvement to how M28 handles that map but will have a think if there's anything. Other suggestions which I would expect to help would include:

  • Reducing the factions used (which should reduce memory usage)
  • Using unit restrictions to ban all air units (which should improve both CPU performance and memory usage)
  • Playing an edited version of the map that cuts out most of the unpathable cliffs on either side (this would only work for personal use though as you wouldn't be able to upload such a map to the vault without permission of the original author)
  • Disabling other SIM mods (you had RNG and M27 also enabled - there's the possibility this could increase the memory or cpu usage)

v80 Update
Some (but not all) of the planned changes from the Rainbow Cup finals. Since a number of these changes affect core parts of the land and air unit functionality there's a greater risk of unintended consequences or bugs.

  • 7 changes from the final game (on huge adaptive wonder), including having fatboys move instead of attack-move when faced with negligible enemy threats (so they cant be held up by land scouts on repeat), and various adjustments to asf targeting logic so they'll commit to nearby targets, prioritise closer targets, and include air units betwen their main target and the current rally position.
  • 3 more changes from an earlier RC game on Norro that I'd missed from a first pass, including fixing a bug that would cause the ACU to not consider the proper units when deciding whether to attack or retreat, and some refinements to land scouts so they are less likely to retreat when friendly units are near.
  • Reworked how land combat units are managed to try and stop M28's entire army chasing after a lone enemy scout/low threat unit. Where M28 significantly outnumbers the enemy it should only send some of its army to deal with the enemy, and the remainder should search for a larger enemy force to attack.
  • 3 Optimisations for maps with lots of cliffs so that M28's land based logic gets run less frequently for small plateaus; the plateaus get ignored for most of the air based logic; and are also ignored when determining what zones are between the start and end position.

Acknowledgements

  • Fearghal - for funding and organising the rainbow cup tournament (which provided various valuable replays and ideas for improvements)
  • TheWheelie, Tryth, and likely others (apologies if I've not mentioned you here) - various discussions in the rainbow cup discord thread following the end of the tournament with suggestions on AI improvements (some of which are planned for an upcoming version)
  • Saver (and Relent0r) - Error message relating to part of M28's land logic that would sometimes occur.
  • goblinsly2 - Replay highlighting performance issues on the map Voodoo Castle (as a result of the large amounts of unpathable locations).

@maudlin27 I just played a game on Voodoo Castle with 3x M28's and 2x M27's, accidently not setting any restrictions. Im glad to report the game went through without a single problem, staying at 0 sim speed throughout. I didn't see a lot of air units on my team and was amazed that M28 donated some of them to me. Whether accidental or meant to reduce lag, i loved it, felt like a human player, but spoke english. So far works great.

@goblinsly2 Good to hear, thanks for letting me know.
I'd still suggest trying to only do M28 rather than a mix of M28 and M27 given the memory issues you were having before (i.e. while the v80 changes should have helped to some extent, I only confirmed the cpu performance impact on that map and I didn't measure how much of a beneficial impact they had on memory usage). However, following v80 it's hopefully no longer necessary to apply unit restrictions on that map.

Giving air units is an intented feature for M28 - if it sees you as the more dominant air player compared to itself then it's meant to gift over some of its asfs.

@maudlin27 I have a problem that happened to me before on this map. I started a game with only M28 and Uveso selected, i used a saved preset for unit restrictions. When the game starts i get an alert that M27 can be disabled since its not detected. And the M28's dont start building (neither does the game stop when they usualy start collecting map data). Is this a problem on my part ? Attached 2 logs when this happened.

Second thing, you mentioned its normal that M28's donate units. But i dont have the same capability. I cant donate units to AI's, i cant convert them and i cant share resources with them. Which is a bummer if i build paragon for instance. Can i change those settings somehow ?game_22089600.log game_22089573.log

@goblinsly2 There's a bug with how the game lobby handles presets that makes it incompatible with AI so that's likely the cause of the first issue - where I've seen it before it appears to have the selected AI (e.g. M28) in the game, but it's using the default AI. My suggestion is to start a fresh lobby/game and not use pre-sets to see if it works.

The second issue would need a change to the game I expect for it to work via the normal interface, if it's even possible. However, one workaround is to use 4z0t's scoreboard UI mod (along with the associated UI tools mod), then if you select the units you want to gift, then do Ctrl+L Click on the faction icon on the scoreboard for your teammate it should gift the units to them.