AI Development Guide and M27AI v74 Devlog
-
v30 - Czar, Soul ripper and Defences
A bunch of new units unlocked/added this time, to varying degrees of depth. I'd originally hoped to have all the experimental air options added with this version, but I ended up getting sidetracked by some TMD building bugs which took far longer to resolve than I'd hoped (and included needing to rewrite parts of my engineer code), so Seraphim will have to wait.New units that the AI will build and use:
- Czar and Soul ripper
- Static AA defences
- Static PD and walls
Other changes:
- Improved anti-cybran cloaked laser com logic
- Improved fatboy logic
- Reworked reclaim approach (again!)
- ACU should run from experimentals much sooner
- 23 Other misc changes and 9 bugfixes (including an unintended feature where the AI would get a 4-5s headstart in every game, and various bugs with building TMD)
The PD and AA buildings aren't anything fancy at the moment as this isn't meant to be a turtle AI (yet...).
Thanks to Azraeel for providing a number of replays which flagged certain issues (making me accelerate planned fatboy changes, and also highlighting M27's vulnerability to a cloaked laser com) along with providing some very entertaining moments, Babel for highlighting the 5s benefit M27 was getting at the start, and Fearghal for highlighting the vulnerability of the ACU to experimentals.
-
v31 - Bombers and TML
The main focus of this update was a rewrite of most of my bomber targeting logic and use of the Ahwassa. This took a bit longer than other updates in part because I had a week away.- Ahwassa can be built by Seraphim
- Bomber targets are now determined based on the bomber tech level (previously the current Air factory HQ was used as a proxy with all bombers assumed to be the same tech level)
- New engi hunter targeting mode for early bombers
- Bombers should avoid targets protected by static AA ((previously they'd only avoid if the AA was near the target itself)
- Introduced hover-bombing, mostly for strats and Ahwassa
- Strats will launch co-ordinated attacks to try and take down more heavily defended targets
- TMLs can now be built
- 12 Bugfixes (including one causing massive over-production of engineers at the start of the game)
- 37 General misc changes
- 17 Further misc changes focused more on late-game (e.g. refining the logic for what experimental gets built, and how certain experimentals are used)
Some of the misc changes resulted from feedback/replays provided by people. In particular thanks to the following for this version:
- Chp2001 – I almost gave up on getting hover-bombing to work, but Chp2001 shared code they’d used that achieved hover-bombing. Although I couldn’t get that code to work, it gave me better motivation due to knowing it should be possible for an AI, and a better steer on some of the timings - even after this I had so many failed attempts I was going to give up on my last attempt (which ended up working), so had it not been for Chp2001, there'd be no hover-bombing in M27AI as I'd have given up far sooner and needed more attempts to get there.
- HintHunter – replays highlighting poor early-game performance including heavy mass stalling and engi-overproduction
- Relent0r – highlighting poor performance on Selkie Mirror vs Sorian Air (on running the map I realised one reason was a bug with the pathfinding I used that led to 2 mexes being ignored)
- Azraeel – Replays showing a number of late game flaws and issues when dealing with units on a plateau
- Babel – Notes on ACU being too aggressive, and M27's vulnerability to enemy air if it doesnt scout the air fac in time (M27 now gets a couple of inties preemptively to support its bombers while its ACU is far more likely to fall back when ahead on eco)
(apologies if I've missed anyone off - as it's been a longer update cycle I've lost track of the reasons for some of the changes)
-
v32 - Plateaus
The main focus of this update was introducing Plateau logic – on maps that have mexes that can’t be reached from the starting location, M27 should sometimes send engineers there with a transport. This effectively required the creation of a mini-M27AI to operate for these plateaus, with the following all being done:- Logic for identifying the plateaus, and deciding whether they’re safe to send a transport to
- Building the transport
- Loading engineers into the transport
- Sending the transport to the plateau to land the engineers
- Having the engineers decide on appropriate buildings to get (e.g. building mexes, land factories etc.)
- Having factories on plateau decide on appropriate units to get
- Disabling parts of the main M27AI logic that wouldn’t be very good on Plateaus (e.g. avoiding upgrading plateau factories to T2 unless there are no other options)
- Having specialist logic for any units build by factories on a Plateau, to only consider targets on the Plateau. This involved different platoon AI logic for scouts, MAA, indirect fire units, and direct fire units, along with disabling parts of the main M27AI logic (e.g. for scouts and MAA)
Given the extent of the Plateau changes there will likely still be a few bugs relating to this.
Other changes:
- 15 Bug fixes, including various issues with TML (they would rarely be built; get built in the opposite direction wanted; and could lead to a crash in the game), and a bug that could lead to 5+ experimentals being built simultaneously.
- 44 Misc changes, mostly relating to use of air units, with some relating to building engineers.
Thanks to:
- Relent0r – Replay highlighting bug that caused 5 fatboys to be built simultaneously and vulnerability of M27’s bomber defence to enemies building shielded flak near to M27’s base, along with general suggestion to have hover-bombing not apply if flak detected. Strategic flaw with having M27 ctrl-k all T1 factories at once when it thinks it doesn’t need them.
- !MarLo - Providing several screenshots and replay highlighting issues with M27 having >300 strats idling
-
v33 Hotfix
- Fixed a number of Plateau related bugs that resulted in issues where the Plateau had 3+ mexes
- Fixed bug causing bombers (in particular T1 bombers) to not work properly when in defence mode
- Various other bug fixes (23 in total including the above 2 points), including Czar targeting issues, MAA not being built for experimentals, and SMDs not building more than 2 missiles.
- 36 misc changes, including making it less likely M27 will overflow mass, and improvements to special T1 bomber engi and mex hunting logic.
- Misc changes included tweaks to the logic for building PD to make the AI build more of them (originally intended as part of a larger update to have the AI make firebases in some rare situations, but this part was postponed due to the number of bugs that needed fixing).
Thanks to:
- Pyrolol – Highlighting issues relating to Plateaus on Open Palms
- Relent0r – Highlighting a bug with the bomber defence logic and Plateau issues on Open Palms, along with replays showing a Czar targeting bug, and bug with sending MAA with experimental units
- Fearghal – Replay highlighting SMD not unpausing after firing its missile (when 2+ missiles had been built)
-
v34 - Dynamic firebases
-
This update introduces firebases, although the scenarios where they get built will be relatively rare. More extensive turtling logic is planned for a future update (specifically pre-planned firebases), but for now M27 has what I'm calling 'dynamic' firebases, which in practice are likely to be built if it faces a constant stream of progressively stronger enemy units. As part of this, it will now build T2 artillery for the first time.
-
Another related change is the introduction of shield assist logic to help with T3 arti wars, with M27 being significantly better at surviving against a T3 artillery.
-
15 Bug fixes, including an issue that stopped torpedo bombers working (they'd only attack enemies that got near them previously), and an error that would happen when building experimentals if the enemy had an experimental
-
33 misc changes, including improving ecoing ability slightly by trying to always have something upgrading (sometimes this can hurt it though)
Thanks to:
- Pyrolol for highlighting a bug with Plateaus on Twin Rivers
- Relent0r for a bug with the decision on what experimental should be built.
-
-
v35 - pre-planned firebases
Part 2 of my turtling logic - this time M27 will preemptively setup a firebase at map chokepoints. It only works on very simple chokepoints (e.g. Astro and Fields of Isis; there will be a number of other chokepoint maps which it doesnt detect/work on), and I'm not even sure if it is beneficial even on these maps (it has a slight boost in performance against AI but that's to be expected as most AI will suicide units into the firebase - for example it was sometimes able to beat DilliDalli AiX 2.0 on Astro Craters. It's eco performance suffers massively from spending so much on the firebase though)Other changes:
24 Bugfixes, including- Novax and T3 arti targeting (Novax would go to a unit's original position; T3 arti could sometimes error out when selecting a target)
- Fatboy run logic (that'd cause them to flee in terror from the slightest enemy threat)
- Issues with the power-stall manager, in particular a miscalculation of the energy usage of SMD and SMLs
22 Misc changes, including: - Air factory builder tweaks so air scouts are more likely to be built, and so the air factory and intie should be rushed if enemy air units are detected early in the game
- Making ACU more aggressive if the enemy doesn't have T3 units
Acknowledgements:
- Jip – Replay that resulted in an error relating to a land factory being built on a plateau where the pathfinding didn’t work.
- JantDarvus – replay highlighting M27’s vulnerability to early jesters
- Relent0r – highlighting issue with fatboys retreating, and issue with Ythotha’s attack-moving (I’ve decided to park the Ythotha point as a potential future change as I think I want experimentals to attack most of the time, except when there’s a Ythotha death-ball nearby)
- Spyro – Replay where M27 may have caused a hard-crash (It's not clear from analysing the replay if M27 caused the crash or if it was a separate occasional error that happens with FAF where M27 isnt active, but the replay highlighted a few errors/issues)
-
v36 - Skirmishers
Dedicated skirmisher logic introduced (as opposed to previous logic which would sometimes have some units kite):- Units well suited to skirmishing (hoplite, mongoose, sniperbots) should now be built
- Skirmisher units should be much harder to kill by retreating from enemies that get closer to them at a much earlier point, and maintaining good intel coverage
- 8 bugfixes and 9 misc changes, including a new emergency T2 arti builder as a last resort for when enemy naval units get close to base, and making pre-emptive SMD get built sooner than before
-
v37 - Late game and game-enders
- Added logic for building and using game-enders (Aeon will build rapid-fire arti instead of paragon since I expect building a poorly defended paragon in M27s base when it struggles to make use of all its mass without a paragon would do more harm than good)
- M27 should now sometimes build quantum gateways and RAS SACUs
- Tweaks and bugfixes relating to shields, so they're better at defending against enemy T3 arti (in particular Cybran)
- Adjustments to bomber logic so T1 bombers are less likely to suicide into SAMs and more likely to prioritise units threatening mexes
- Mass stall manager implemented
- 20 other misc changes and 12 bugfixes
Note that the game-ender logic is very niche, so in most games I wouldnt expect any to get built.
Acknowledgements
- Azraeel – Replay highlighting M27 suiciding bombers into SAMs, and M27 Cybrans failing to shield T3 artillery
- Fearghal – Noting M27 doesn’t work when its start position is underwater (for now M27 will just give a chat message warning about this, and I'll park this for if I ever introduce navy)
- Unknown – Note that M27’s experimentals can run from enemy experimentals (causing them to die without doing any damage)
Edit: V38 Hotfix:
- Fixed bug that would break M27 if any unit restrictions were enabled (thanks to Punzler for the replay highlighting this)
-
warning: Error running lua script: ...ed alliance\mods\m27ai\lua\ai\m27factoryoverseer.lua(524): attempt to perform arithmetic on field `?' (a nil value) stack traceback: ...ed alliance\mods\m27ai\lua\ai\m27factoryoverseer.lua(524): in function `DetermineWhatToBuild' ...ed alliance\mods\m27ai\lua\ai\m27factoryoverseer.lua(1219): in function <...ed alliance\mods\m27ai\lua\ai\m27factoryoverseer.lua:1107>
Finished in like 10 minutes flat after norush. AI did not build much.
-
@splitice Thanks for flagging, have you got a replay, and were you using the latest version at the time (v38)? I checked the line referred to in the log and couldn't see anything obvious, and the current WIP version (v39) works ok still on a test game with norush so I'd need a replay to narrow it down.
-
v39 Update - Niche units: Quantum Optics
The first update focusing on niche units - Aeon can now build the Quantum Optics Facility. Main changes this update:
- Quantum Optics will be used in some cases where intel is needed
- Various tweaks to the bomber defence logic to tone it down slightly/reduce its tendency to suicide bombers
- Various adjustments to the logic when losing air control
- New T1 PD hunter logic to help when civilians have a T1 PD near our base (engineers should also now avoid T1 PD - previously they'd ignore it)
- Unit cap logic to handle scenarios where the unit cap is reached
- 13 Bug fixes, the most noticeable are likely to be issues with skirmisher logic that would lead to them either running too early or not running at all, and a bug that caused M27 to stop building more land factories if it suffered from a powerstall in the past
- 37 other misc changes, including better support for multiple nukes, improved T3 arti targeting, and emergency T2 artillery builder enhancements
Acknowledgements:
- Azraeel – Lots of replays of M27 vs human matches, which highlighted yet more T1 bomber issues, M27’s vulnerabilities when losing air control and/or faced with mass restorers, and issues when multiple nukes fire at a similar time
- Jip – Highlighting error messages on open palms relating to identifying reclaim segments of interest.
-
@maudlin27 - I like the AI and have had some good games against it. I enjoy the blog too. I did notice a small bug on Setons where it air-dropped engineers on the plateau but never built on the mass extractors. The engineers just sat there for most of the game with untouched mass extractors right beside them.
-
@tyne141 Thanks, have you got a replay ID, as I've not been able to reproduce on either the FAF or non-FAF setons?
Also was this the latest version (as v39 fixed a couple of bugs that in some scenarios would cause Plateau engineers to not build mexes)
-
@maudlin27 It was a modded game. It would probably be a pain to replay https://replay.faforever.com/17253648
I saw there was an update since I last updated so I gave that a shot and got no where. On start:
warning: false\000M27ERROR Count=1: GameTime 4: sBlueprintToBuild is nil, could happen e.g. if try and get sparky to build sxomething it cant - refer to log for more details warning: stack traceback: warning: [C]: in function `assert' warning: [C]: in function `pcall' warning: ...nder forged alliance\mods\m27ai\lua\m27utilities.lua(74): in function `ErrorHandler' warning: ...d alliance\mods\m27ai\lua\ai\m27engineeroverseer.lua(3146): in function `BuildStructureAtLocation' warning: ...er forged alliance\mods\m27ai\lua\ai\m27overseer.lua(7173): in function <...er forged alliance\mods\m27ai\lua\ai\m27overseer.lua:7154> info: BuildStructureAtLocation: Had category to build. oEngineer=ual00011; UC=1; All blueprints that satisfy the category={ table: 27460820 info: "drlk005", info: "uab0101", info: "uab0201", info: "uab0301", info: "ueb0101", info: "ueb0201", info: "ueb0301", info: "urb0101", info: "urb0201", info: "urb0301", info: "xrl0002", info: "xrl0003", info: "xrl0004", info: "xrl0005", info: "xsb0101", info: "xsb0201", info: "xsb0301", info: "zab9501", info: "zab9601", info: "zeb9501", info: "zeb9601", info: "zrb9501", info: "zrb9601", info: "zsb9501", info: "zsb9601" info: }
(Ditto Mods)
https://replay.faforever.com/17253862 -
@splitice Thanks for the replays,
Re the second replay, the issue is compatibility with one of your mods. M27 will currently only apply engineer logic to land engineers, but after doing some debugging it looks like the mod combination you're using results in the normal engineer blueprint (e.g. uel0105 for UEF T1 engineer) being modified to contain the air category instead, which I'm presuming is the Flying Engineers mod. I'll add in a fix in the next version so M27 will try and build stuff/use the engineers where it detects this mod or can't identify any T1 land engineers that are buildable, but it's likely there will still be some unintended sideeffects/interactions.
Edit: Checking the first replay it's the same issue as the second (with the flying engineer mod causing issues) - this will be fixed when v40 releases
-
@maudlin27 said in AI Development Guide and M27AI v39 Devlog:
nks, have you got a replay ID, as I've not been able to reproduce on either the FAF or non-FAF setons?
Also was this the latest version (as v39 fixed a couple of bugs that in some scenarios would cause Plateau engineers to not build mexes)It wasn't on v39; I think it was on v37 or v38 as I played the game about 1 day before v39 released. The replay URL is: https://replay.faforever.com/17259833
It's a bit of a weird match as I was just testing M27 against Sorian out of curiosity so I was only human player in the match. I haven't seen the bug happen when I've used M27 with humans but I haven't played on many maps with plateaus with humans yet.
-
@tyne141 The issue might've been fixed in the last update but to be safe I've added some further logic to the (WIP) v40 to make sure that specific scenario shouldnt happen (the issue being the engineers were stuck assisting the land factory, and never had their orders reassessed once the land factory had finished building all the units wanted for the plateau)
-
Thanks for the quick feedback; it's really great to watch the AI develop as you add to it. I'll try running a similar setup again on v40.
One other thing that a friend and I noticed when we played 2 humans VS. 2 M27s on V39 last night was that one time a commander killed itself by standing in the channel on High Noon and getting hit by 3 x T1 torpedo launchers. The commander seemed to retreat most of the time when it was damaged a certain amount but it didn't seem to detect it this time. The other thing was that the AI didn't seem to respond very quickly to T2 UEF cruisers attacking base buildings; it was still very challenging to win but we managed in the end partly through weakening their economy through cruiser missiles. I think we played about 3 games in a row and eventually won the last game. I can find the links for the replays if they're useful; I assume it was on V39 as I think we updated last night before playing. It's still really challenging as the AI was very quick to hit us with nukes and/or experimentals if we let it grow for too long.
-
@tyne141 Yes replays of games between M27 and humans are always useful even if there’s no obvious issue/error.
The t1 torp launcher/acu point sounds like a bug (Edit: Reviewing the code for this there was a flaw that likely explains what you've described which will be fixed in v40) while the vulnerability to cruisers is more of a weakness with its current logic that I need to try and improve at some point (so a replay that highlights this would be helpful).
-
@maudlin27 thanks very much.
I thought it might be mod compatibility but I was thinking Auto Reclaim. I look forward to seeing what the next release can do.