AI Development Guide and M27AI v74 Devlog

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. m27bug.jpg

@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.

@maudlin27 - here are the replays:

From memory, we lost the first two games but it was in the second game that one of the commanders died early because it didn't move away from the torpedoes; the remaining team still beat us convincingly by teching up and hitting us with experimentals. I think we won in the third game mainly through long range naval.

For context, we haven't been playing too long but we're easily beating the standard AIs and Sorian etc; we don't really play against other humans much yet so we're not exactly great players but it's offered us more challenge than Sorian or LOUD which are the other AIs we've played against so far.

@tyne141 Thanks, the replays highlighted a number of flaws/tweaks to make so hopefully it can give a bit more of a challenge in the next release.

@maudlin27 - awesome, it's great to be playing against an AI as it is evolving so we know that we can't just learn how it behaves once and remember how to beat it.

Out of interest, is the intention to definitely add navy/sea eventually if there is time to do it well? Or is it potentially easier to make an AI difficult to beat if it concentrates its resources on land and air? I notice that some of the AIs that do build navy don't defend them too well so it is often easy to knock out naval factories in which case it is a massive waste of mass for the AI but I assume that an AI that can strategically use certain naval units could be quite tough to beat.

@tyne141 I've still not decided whether to get navy, and if so to what extent to do it - as you mention it's very easy to waste a lot of mass on navy if it's not implemented well, and it's further compounded by me not really knowing how to play navy well as a player.

V40 Update – Deceiver and naval defence

  • New unit unlocked: The deceiver
  • Various tweaks aimed at improving M27’s response to a nearby naval threat slightly
  • Added basic support for the flying engineers mod
  • 14 other misc changes and 11 bugfixes

Acknowledgements

  • tyne141 – Replays highlighting issues with torpedo defences and cruisers
  • splitice – Replay indicating incompatibility with flying engineers mod

@maudlin27 said in AI Development Guide and M27AI v40 Devlog:

Various tweaks aimed at improving M27’s response to a nearby naval threat slightly

Thanks for the acknowledgement; here's a couple more replays if you want:

It was 2 games of 2 humans VS 2 M27s on Eye of the Storm. We lost the first one but won the second. There didn't seem to be any major bugs but in the second match, the bottom right AI sent its commander diagonally across the whole map underwater which meant that it was completely vulnerable to torpedoes. So it almost got taken out by a lone T1 submarine. We lost the first match in a big part due to the M27 firebases being quite effective and me not defending against the T2 artillery quickly enough; however, in the second match it didn't really seem to build the firebases as effectively at the top or bottom so we just skirmished across gradually.

Played a heavily modded game (primarily fast build, increased storage, increased nuke defence build rate, defence expanded). 1x AIX vs 1x human.

@maudlin27 well done... took me over 2 hours (Uveso with the same settings would be sub 1hr typically).

Got forced to turtle up to the middle a bit the AI was very overwhelming with a constant stream of high tier units controlling the center.

I'm betting it would have had enough resources to build more experimentals however it didnt. Might have been able to win if it did. One area AIs can typically offer more challenge to human players (if resources permit) is by building experimentals as that requires extensive micro management as a human.

It never tried for a nuke win. T4 Arty was disabled in this match so there was no Arty win possible.

I won via area supression followed by brute force nuke win.

  1. Area for improvement.

Don't park within range of guns

  1. Area for improvement

In the above screenshot that was a fleet of T1 and T3 engineers primarily. Seems kind of useless?

Tried to invade with that engineer army multiple times. Cannon fodder strategy?

Overall - good game. Played well. Slowest point with large armies clashing -2, typically +2.

Also flying engineer strategy:

  • Fly in over land defences and take them 🙂

Might have been a good strategy for that engineer army.