AI Development Guide and M27AI v74 Devlog

@teralitha If you try playing against 4 M27 on a map like setons you should notice each AI perform a different role. I did contemplate different player selectable roles for the AI at one point but decided I'd rather focus on having the AI decide what role to try and do based on the map/scenario (it also makes it easier to maintain if I'm just dealing with one AI rather than different variants, and helps make the AI a bit more varied/less predictable when playing in different map/game setups).

FYI re your previous replay with grey sending engineers out it was due to a bug with M27's pathfinding for that map, it'll be fixed in the next version (although I expect the AI will still built lots of engineers)

@stlng Thanks for the feedback, glad you're enjoying it! If you see it do anything stupid feel free to send me a replay

Latest changes (v53 summary)

  • New unit unlocked - shield boats! Related logic for Aeon and Seraphim added to use mobile shields like shield boats.
  • 10 Bugfixes, including pathing bug on Battle Swamp map and stopping M27 from controlling non-M27 teammate's naval units
  • 10 Adjustments to navy, mostly relating to decisions on whether to attack and with what units
  • 6 other changes, including adjusting threat calculations so shielded undefended bases emit less threat, and making it less likely for T1 PGens to be gifted to a non-M27 teammate

Acknowledgements:

  • Teralitha – Replay highlighting bug with teammate’s navy, along with other more general feedback
  • Fearghal – Highlighting M27 breaking on maps with underwater start positions.

Im still seeing the AI take control of my naval units, but its not all the time now. They are occasionally grabbing a few of my ships to move in their naval groups.

@teralitha Thanks, spotted the issue in the code so hopefully will be fixed properly in the next version

I am still unable to use overcharge while using this AI in my game.

EDIT, correction, it is working, however, Im not getting any audible notification that its available like you normally do. At least, not at first. It starts giving audio and visual que's after you fire it a few times. However, Im not sure if this is caused by M27..

Sounds like it's probably an unrelated sound issue. One thing I found helped when I had separate sound issues (where a range of different sound effects including ACU being under attack stopped working consistently) was doing a restart of my computer (restart rather than shutdown), but if that doesnt help I'd see if anyone can help you in the technical support area

v54 summary of changes
Small update mainly to fix the bug with M27 taking control of non-M27 allied naval units

  • 3 bugfixes, including bug with initial land factory build location and controlling non-M27 naval units
  • 2 Misc changes (reducing the amount of AA structures that get built, and no longer targeting underwater mexes with TML)
  • Temporary eco strategy - very niche strategy that will be most relevant probably in AI vs AI games - M27 will eco temporarily even if it lacks map control if it has a firebase protecting most of its units and its core mexes are behind the opponent's

Acknowledgements:

  • Relent0r - screenshot highlighting the factory build location issue was a more widespread isuse than I'd thought
  • Teralitha - Confirming the naval control bug was still present in many cases

Feedback: AI defending against yotha(seraphim chicken experimental) I watched as a single yotha casually strolled through 2 of my allied M27 team mates wiping them out entirely with barely a scatch. One of the defending AI had a sizable group of T3 tanks that they brought to deal with the chicken. Only they didnt. They would approach the chicken at the very edge of the chickens range, and never even try to get in range of their own weapons. They kept retreating out of their weapon range and all got destroyed while doing no damage whatsover to the chicken. My 2 AI teammates were doing better than me in this battle. I had been nuked and was struggling to make any progress. When i saw the chicken coming, and I saw my teammate with a group of 20-30 T3 tanks along with some turrets in the base, I figured they could handle it no prob. But not so. The above happened and the chicken wiped them out easily then moved on to wipe my next teammate in the same fashion.

My assumption here is that the AI are programmed to be a bit too cowardly. Maybe in general, or maybe when on defense. they should have had little trouble dealing with the chicken. Its rather strange how the AI behaves when its my team vs their team.

For example, if I send a monkeylord to an enemy base, the AI will respond by quickly making a huge swarm of t1 bombers. The AI on my team didnt do that. Maybe the AI responds differently to different threats? I dunno. But I have seen the AI on my team get wiped out by a single monkeylord before too. The more I play with this AI the more It seems like the AI on my team plays dumb while the enemy plays smart. I had one team mate that far exceeded me in eco and everything, I thought for sure we were gonna win. But when I look at their base... no artillery... no nukes... no experimentals.. Yet the enemy team will be droppin nukes and marching experimentals, dropping arty on all of us.

As I said, its feels like when the AI is on my team, they dont play very smart or do much, but the enemy AI always seems to be geniuses and gets way ahead of my team on everything. I will say this, my team loses alot. I have won sometimes, but its hard, usually because my team never does very well compared to the enemy team. Its as like, if I dont carry my team, Im pretty much guaranteed to lose with this AI on my team. It gets a little frustrating.

I also want to mention, of all the games ive been playing with M27, I dont believe Ive ever seen them build a GC before. I see monkeylords often, chickens less often. Dont think ive ever seen a crab either. Or a czar. I did once see asswasher. Nukes are pretty uncommon as well. I am seeing the AI build multiple nuke defenses, which is quite inefficient. Thats alot of their mass being wasted.

Anyway, to sum up

  1. AI plays too cowardly with ground units, and as a result gets decimated without doing much. If I had to guess, Id say the AI treats all T3 ground units as a spiderbot regardless of their actual weapon ranges, and as a result, will get killed by units that outrange them without actually closing the distance and engaging.
  2. Builds too many nuke defenses, essentially wasting a ton of mass.

I have always been playing with random factions, but Im gonna be testing with all one faction vs all one faction to see how the AI handles such matchups. And really to see what they build compared to others.

@teralitha Thanks for the feedback, in terms of your points:
-Experimental defence - Ive recently finished drafting specific logic for this in my current WIP version which sounds like it should address your main concern here, although monkeylord may still cause issues if the AI doesnt have omni up by that stage
-t3 units not engaging experimental - have you got a replay? Theyre not meant to engage if they think theyll lose the fight but it sounds like they might be a bit too cautious, or (if it’s their base under attack) should just try attacking anyway
-too many smd being built - I was hoping to fix this in the current WIP but a replay where I came across the issue is desynced; have you got a replay example of this? Ideally where 3+ smd are built near to each other when the enemy has just 1 nuke launcher
-No GC being built - I expect if you only play Aeon vs Aeon you’ll see some being built, Ive seen them and Czars built numerous times where the only faction on the team is Aeon
-Poor M27 teammates - one possibility is that the teammates lack air control so focus on regaining it while the opposing team has air control so focuses on other areas, which would also account for the poor response to attacking experimentals. m27 only considers friendly M27 air units when deciding if it has air control so it’d be eg 3 m27 trying to outproduce 4 m27 at air (and likely almost always being behind as a result)

When it comes to air control, I usually dont focus on making air units myself, but instead I send out SACU's to my allies to build SAMS and Shields around their bases since they dont do much of that themselves. M27 tends to focus only on offence. But I only do this if I am able. In games where I cant support them in time they will tend to die a slow death from air attacks or novax picking on their shields. They would do much better if they would build more shields and sams since M27 heavily builds air. I hardly ever need to build anything to defend against a ground assault. I usually get away with building one experimental and just have it at the front line with some sams and some other static defenses. Even if my base is in the front, my main worry is defending against a ground experimental, nukes and t3 artillery. I never get assaulted by waves of ground units with M27. But perhaps that is just reactionary. its usually waves of engineers trying to steal all the mass points.

Unfortunately, my recent game where I saw multiple smd, the replay didnt record the latter part of the game where this was happening. The replay ends halfway into the match. If I find a replay where it happens Ill post one later. Also, the AI is still transferring control of Pgens over to me. This is kind of an issue because whatever gets transferred, either to me or another AI, which is usually T1 or T2 Pgen, never gets reclaimed. They usually reclaim lesser PGens later on, but they wont do it for ones that are transferred, whcih then clutters up their base. It might be better if the AI never transferred any structures at all. Resources are generally shared anyway, so its not necessary. Ive watched the AI transfer power over to me (The resource, not the structures) SO them gifting Pgens really is not necessary at all.

Just as an aside Maudlin. You can leverage the brain:TakeResource and brain:GiveResource as well to transfer energy directly should you want to implement more restrictive pgen gifting but still want to be able to quickly help allies if they have crashed power. I do it on mine though I don't play with AI on my team so never really done much validation on it.

Here is a new replay where the AI is seen having built 2 SMD nearly next to each other, both of which have nothing loaded, and that AI got destroyed by a nuke... https://replay.faforever.com/18075538

I only saw what was current on my team while playing. The dark red colored AI in the south is the one in question. Others may also have built multiple smd but I didnt watch the replay.

@teralitha Thanks, I'll have a look to figure it out (from an initial glance it looks likely to be an overlap between my firebase SMD logic and my main base logic but I'll test to confirm).

Re the T1 power gifting they're meant to transfer back to the original owner who then reclaims them once all teammates have sufficient power, so if this isn't happening if you send me a replay I can see why. Broadly, if all M27 teammates have a T3 PGen (the actual threshold is earlier than this) and the M27 gifted the PGens also has surplus energy (of 100 per second) then they should be gifted back.

Meanwhile they should only gift T1 PGens to a non-M27 teammate if that player has less than 10% energy stored (as well as less than 750 energy income per second)

Re its attacks I did see one (ai vs ai) game recently where 3 ythotha got sent to attack an enemy base at the same time but it's more likely to attack with 1-2 experimentals, while waves of units are more likely at lower tech levels (but if you're turtling up then it's far less likely)

@relentless Already implemented :), I like to share PGens as well since a lot of my build conditions are based on the AI's gross and net energy so giving the T1 PGens over makes those more reliable/accurate than estimating the overflow available to it.

Well, if it is intended that they gift Pgens back, I have never see it happen. All ive seen is once they have been gifted to someone, its permanent. I think the replay I just gave you should show this. And if they are gifting them to me, I am unable to gift them back. I believe that is something you would have coded into the AI, to not allow a player to gift them anything. If I notice they have given me something, I will usually control K them. I still think you should remove PGEN gifting at all.

I watched that replay back today and I saw that the red AI actually built 3 smd's(EDIT: Actually they built 5 of them which were all destroyed by artillery and then they promptly built 3 more! After which they got hit by a nuke and died...) and they were turning them on and off repeatedly. Definitely needs a change.

@teralitha Found the issue with the SMD (and why I've not come across it before) - Seraphim battleships can build nukes, so the AI was (correctly) seeing them as a nuke capable unit and trying to build enough SMD to prevent being overwhelmed by nukes if they were all building them.

I'll probably tweak it for the next version so limit the amount of SMD being built where the nuke launchers are battleships.

Also not seeing any 'left over'/isolated T1 PGens on the replay (about 45m in) - the only PGens out of place are where an ally whose base (and all their power) got mostly destroyed and so was gifted the PGens

Yea it wasnt the best example in that replay. Ive seen it happen more prominently on different maps.

So.. my cybran submarine can build nukes too. Does the AI react to that by building more SMD? perhaps I can trick the AI into wasting more resources into SMD then by building a bunch of subs...

@teralitha yes and yes (assuming it sees the subs), but you’ll be wasting mass on the nuke subs yourself since theyre not worth the mass for the tml effect, so it’s only likely to be viable on larger team games where every player has to build smd to protect from a nuke

The thing is... a single SMD can shoot down multiple nukes if it has enough loaded. Nukes travel slowly, so it would take like 3-4 nukes dropped at the same time to get past a single smd that is loaded with enough to stop them all. Anyway, I hope you can make an adjustment so the AI isnt over reacting to a nuke possibility and wasting resources. And seriously consider getting rid of the gifting, except in very extreme cases.

Those are all the main issues I see with the AI currently in my opinion.

Major:

  1. Too much gifting(and possibly not returning to owner)
  2. Too many SMD

Minor:

  1. Producing way too many T3 engineers for their eco level.
  2. Not protecting base well enough with shielding and AA vs other M27AI that are going heavy on Air.(Pretty much every match i use M27 in, they all go berzerk with air units and spider bots)

Oh yea one other minor issue I forgot about, If the AI builds a naval factory, every AI team member will send some engineers over to aid it. Looks like the factory is surrounded by a rainbow. (And they only ever build one factory even when I set the options to be able to build more than one) I mean, that part makes sense, but they never aid my naval factory 😞 But really, they should be using their mass on their own production, because usually those AI are not doing so well on eco themselves.

@teralitha I'll see if I can fix the power gifting back when I next work through some minor changes (no time for current release though as it needed releasing today due to the upcoming rainbow cup but I did notice in a couple of the testing replays that the conditions were met for power to be gifted back yet it wasnt). It's not a big priority though as it just means the AI misses out on a small amount of reclaim.

Hopefully you should notice a difference with protecting the base against experimentals (it's probably still not enough to actually stop the experimental, but is more noticeable than before where sometimes almost nothing would be done)

Re navy it's working as intended - M27 will work with other M27 for navy, but not with non-M27 (since it has no control over how the non-M27 navy is used). How effective the 'coordination' approach is varies depending on the map (basically it's worse if the M27 start positions are far away from each other/closer to the enemy than each other). As the navy's still in it's early days it also doesnt have much logic re when it's better to stop building navy and focus on ecoing up, but I may not add that anyway (due to the risk of stopping naval production and losing navy, allowing the enemy to then destroy all of your eco with ships)