AI Development Guide and M27AI v74 Devlog
-
@tyne141 Thanks, I'll see if I can make it a bit more timid on larger maps where it has to go through water to get to the enemy (as well as if there's anything I can do about the lag/stuttering which I expect is pathfinding related)
-
v50 - Navy is here!
Introduced navy logic for each faction, including:- Figuring out if it wants to consider going for navy on a map, and if so where to locate its factory
- Deciding on the best time to go navy
- Producing a range of naval units (no shield boats or stealth boats yet though)
- Utilising different tactics based on the naval state
- Per-unit dodge micro (to help survive battleship and Aeon destroyer shots)
- 7 bug fixes and 5 misc changes. One of the biggest behind the scenes changes is a cap on how long M27 will spend rechecking pathing, which should solve issues on some maps that would cause it to pause for a couple of seconds regularly
Despite both the addition of a whole new field of war, and individualised microing of units, M27 runs faster than the last update (which I think will be due to the cap on pathing checking time).
Note that navy is a very tricky area for AI (one of the reasons I've held off introducing it and focused on niche areas from v37 onwards), and this is only the first version of the logic so I expect in some cases it will be worse off than before as a result of this.
Acknowledgements:
- tyne141 - Replay highlighting ACU's vulnerability to torpedo bomber snipe
-
@maudlin27 - example of navy game: I've played a few games with navy now and it seems to be working well. In a few games it has used the missiles on the cruisers to great advantage. Here's a Setons game I just played with 7 M27AIs + me and it seemed to work well; I didn't notice any major mistakes made by the AI; however, two of my opponents commanders were killed on the land bridge by the M27 opposition so they were maybe being a bit too reckless with their commanders: https://replay.faforever.com/17979113
-
V51 released but I'm holding off summarising the changelog for now as I may need to roll back to v47 and scrap the various changes made since then.
A few different players have reported desyncs happening sometimes when playing M27 with more than one human player. If you come across this, please could you send me the replay, and also let me know the last version of M27 you played multiple such games (i.e. games with 2+ humans) on so I can try and figure out which version caused the desyncs to start happening.
So far I've seen it happen from 3m into a game to more than 1 hour into a game, on a variety of maps and gamestates.
-
v51-52 - Navy enhancements and desync fix
- Hopefully fixed a desync that would occur frequently when more than 1 human played a game with M27AI
- 10 other more minor bugfixes
- 9 enhancements to engineer build logic e.g. making them and ACUs start construction sooner, and improving the initial build order (most noticeably when trying to go second air)
- 30 enhancements to naval related logic (including air responses to naval threats), the most significant being a shift in the 'all out' naval attack logic to decide for each unit whether to attack based on its range (so e.g. a force of 5 destroyers and 1 frigate vs an enemy force of frigates should no longer suicide the 1 frigate into the enemy if they're out of range of it)
- 3 other misc changes
Acknowledgements:
- Relent0r – replay highlighting naval game; Alterting me to the desync issue along with several replays
- Theodorex – Noting issues with M27 when T2+ units are disabled.
- Tyne141 – Game vs M27 on Setons
- GreatShrek – noting they’d suffered a desync (would’ve been nice had it been via a message not a review, but their replay made it viable for me to find and fix the desync, as it gave a map where desyncs happened almost every time early game making frequent testing of changes viable)
-
Not sure if this is the right pace to post this, but your AI often transfers resource structures to each other and me unecessarily. It kinda starts a chain reaction, where one will gift some something, and then another ai will gift theirs to that one and so on and so forth to where they all are exchanging resource structures often in order to even things out when its not really needed.
-
@teralitha Have you got a replay as an example? It's meant to transfer power generators to teammates when it would be reclaiming them but thinks the teammate has low power and would be better off having them, but I wouldn't be expecting it to trigger that often (so would probably need a replay to figure out why/if it's something that needs fixing).
-
Yes, here - https://replay.faforever.com/17791454
Its happens just after 10 minutes where a bunch of pgens get swapped around between me and a couple others team mates. I didnt have a problem with power, but for some reason I got a bunch of pgens gifted to me.
-
@teralitha Thanks, I'll update it in the next version to keep the PGens in the 'M27 family' (unless the teammate is about to stall power)
-
Hey guy, just to give a little feedback about how the AI performs.
- Commanders seem just a little bit too careless and go out pretty far from their bases in the early game and get creamed. Now, I know some human players also do this, usually noobs, but M27 is not a noob right
- I feel like the AI plays a little too standoffish for its own good. Im beginning to realize that I can exploit this. For example, Hit and run. While this is effective when attacking, its weak when defending and Im figuring out how to manipulate the AI's behavior when I am making offensive moves. Basically its becoming predictable. Would be interesting if squads of AI units were more randomized in their movements. Sometimes being standoffish or hit and run, then suddenly implementing shock manuever/blitz when you least expect it. Or trying to sneak a platoon of ground units around your flank/rear and hitting your weak spot, which is a tactic that ive found works really well on them, since they tend to focus on the front lines.
- They never build mass fabricators. Not sure if thats a hard thing to get them to do or not. They seem to very rarely make SCU's. Like in my last game, I only saw 1 gateway, on the enemy side, but didnt see any scu from it at all.
- Ive watched enemy experimentals like chickens or cyclops doing lot of circles, presumably attempting to avoid things like t2 artillerly, but sometimes when they have a clear advantage, such destroying half an enemy base, they for whatever reason suddenly turn around and retreat before finishing the job and they might not even have much damage.
- M27 seems to produce a massive overabundance of t3 engineers.
- Also massive numbers of air units and anti air units. I never see just regiments of ground units marching and attacking. The AI always seems to be very air/anti air heavy and quite sparse on other types of units.
-
@teralitha Thanks for the feedback! Some of that's intentional, some I'd probably need a replay to decide if it's intentional or not:
1 - (Replay needed but unlikely to change much) - ACU is meant to be aggressive early game and also if it thinks it's behind in the game. If it's easy to consistently kill them then a replay is the best way for me to see if there're any tweaks I can do to make it slightly harder (although it's the area that's probably got the most code and things to take into account as it's very hard to get the balance right between being aggressive and being too aggressive, so there's a good chance a defeat would just fall under the category of the AI being outplayed).
2 - (Unlikely to change) Unit dependent - if it has units like gattling bots/hoplites then it should always hit and run with them. There was one scenario originally where they'd charge in (if trying to get an ACU kill) but I found it really damaged their chances of killing the ACU. Some attacks will be semi-randomised in terms of the target, but trying to sneak around enemy positions is hard to do and not something I'd be able to implement for the forseeable future (requires much better pathing logic than I use at present).
3 - (Might change in the future) Mass fabs I find to generally be a weak unit as a player and even riskier as an AI (since it'd be easy for a human opponent to suicide a bomber in to start a chain reaction) so while it's down as a possible long term change for my AI to build T2 mass fabs in some niche scenarios it's not a priority. While it should sometimes build SACUs it should do this sparingly as on most maps/scenarios I'm unconvinced that they will help it win so it's currently something it might build if it has lots of mass income and some spare mass, so I expect in the game where it built a gateway it had spare mass when it started buillding the gateway but by the time it finished it was using up all its mass so never had enough to want to start on an SACU.
4 - (Replay needed, planned to change) - I expect this is where it is thinking the enemy might have an experimental and wants to get a second experimental to continue the attack but I'd need a replay to confirm. The logic for this is down as something to be improved at some point due to scenarios like this.
5 - (Replay potentially needed, might change in the future) - I expect this will be where the delay between existing engineers completing 1 building and starting on the next leads to the AI storing up lots of mass, and this triggers building engineers to make use of the mass, but I've not noticed it being a significant issue on games I've seen so would need a replay to check if it's this or something else.
6 - (Air - unlikely to change; AA - replay possibly needed) - Generally my impression has been that it underbuilds AA (particularly when supporting an attack such as an experimental). Until recently it would overbuild AA for its ACU but this was fixed so it should be a more modest amount. However, I expect if you're playing M27 vs M27 then it will be building more AA as it varies the amount of AA based on how much air the enemy has, and since M27 likes to focus on air it results in opposing M27 building more air and AA (essentially all of the M27 AI will end up building much more air units and AA units than if they were fighting against an opponent who didnt focus on air). However if you've got a replay where M27 is fighting against a team with no M27 in it and it's massively overbuilding AA the nI could use a replay to check. -
Sure, here is a game I just had earlier where you can see some of these things taking place https://replay.faforever.com/18000390
Id also like to report, in my current game which is a bit of a water map, there seems to be something going on with my ships. They appear to be being controlled by the AI. I keep telling my ships to do what I want, but then they are getting mysteriously redirected to all kinda of different things and not by me. Also, I disabled unit sharing in the options, but the AI can still do it somehow.
-
@teralitha Thanks, I'll have that bug fixed for the next version - looks like it is mistakenly treating all allied naval units as being M27 naval units
-
Seems to be a problem overcharging. Not sure if its because of your mod or not. But its the only mod Im using so a good chance.
Problem is I cant do overcharges. The button is never highlighted no matter how much energy I have stored.
-
If you disable M27 and e.g. just play against normal AI can you overcharge? I dont have any issue myself (playing with M27) and I don't recall putting in any code to disable overcharge, so it may be an issue with the base game (especially as you mentioned in the other thread you aren't able to target individual units with T3 arti so sounds like a few strange UI related behaviours).
-
Yeah could be an issue with FAF. In vanilla I can overcharge. On a different note, with M27, something that is a bit annoying is when I build an T3 arty, AI will send over engineers to help me build it sometimes, and thats ok, but the problem is when they also start building their own T3 Pgens next to it. Im not sure if that matters whether or not an allied PGEN will give the connection boost to the arty or not, but I dont think its intended.
Another little issue Im seeing on occasion, the AI will send out a cluster of T3 engineers toward the enemy bases that behave as though they are combat units on the offensive, and they just die.
https://i.imgur.com/qBuXOVK.jpg -
@teralitha Re the T3 arti PGens this sounds like an indirect effect of it's backup logic for finding somewhere valid to build (where it takes the last location that something was successfully built as a start point when searching for build locations, coupled with its logic for building power normally where it tries to build power adjacent to units that benefit from the adjacency). I'll see if I can adjust the adjacency logic to only factor in units owned by the AI since adjacency doesnt benefit allies.
Re the engineers I'd need a replay to see why they're doing that/if it's intentional, e.g. they may all be on reclaim duty, or trying to build something (that's ended up with a really far away location due to not finding somewhere nearer the base) etc.
-
https://replay.faforever.com/18009052
Keep an eye on Gray, they are one of the biggest cuprits that send out all the engineers groups Also, I looked at every AI, and they at any given time will have anywhere from 50-90 T3 engineers each. That seems very excessive to me. They never ever have enough mass to warrant having so many engineers.
Check this out - https://i.imgur.com/JwDscQD.jpg
-
Is there an arbitrary limit placed on the m27 AI on how many nuke launchers if can build? Just wondering because in my current game I built 4 nuke lanchers, but for some reason only 1 will allow me to build nukes, the rest I have built cant. Not sure if its because of the mod but Im thinking it is.
-
@teralitha No limit. I've also seen the same M27 AI build (and use) multiple nuke launchers. Sounds like another UI issue, but I've not had anyone else say it happens with M27. See if you can reproduce without M27 (e.g. just enable cheats and spawn in 4 nukes both with and without m27), and if it's the same without M27 ask for help in the technical support section on discord and/or on the forums.