M28AI Devlog (v146)
-
Progress update:
Introduced most aspects of air based logic (main exception are bombers):- Torpedo bombers
- Air scouting
- Gunships
- Asf/inties
- Transports (and engi drops)
Have merged the air logic branch as it should be relatively stable. Asf/intie logic will need some refinement as M28 has a tendency to suicide them, but other aspects such as the gunship logic from initial results looks like it is performing slightly better than M27's version.
-
-
-
-
Progress update: The end of the beginning? or the beginning of the end?
A lot has happened with M28 in just 2 weeks, such that I'm hopeful that it's release date could be in a matter of weeks rather than months. To summarise what's been implemented:
- Naval logic, including building and upgrading naval factories, building naval units, and using naval units
- Novax
- Nukes
- TML
- T2 PD (although in a very limited/niche way comapred to M27)
- Ahwassa
- T3 arti
- Various small changes to improve its performance slightly (e.g. less likely to overflow mass, doing better on maps where it can only reach the enemy with air, logic for engineer order reprioritisation)
M28 now has all the core features that I'd set out to implement ahead of the release (some original points such as T3 bombers were pushed to be post-release but others like T3 arti and T2 PD that were planned for post-release have already been implemented). The main areas it needs work on are compatibility (making sure various niche scenarios work), and a new set of 'competitiveness' related goals I recently added - in short, making sure that while it may not be as good as M27 it should perform similar or better to the other custom AI when released.
The most exciting point for me personally though is the performance gains M28 is still suggesting it will provide compared with M27. When I'd previously ran it on the scenario I used for M27 for benchmarking (4v4 UEF on Africa) it was significantly faster, but that was before air and naval logic were added, and there was always the danger that I could spend half a year building an AI hoping it would run faster, only to find out it was slower. Now though it has almost all core features, and is still much faster (more than double the speed).
- For example, taking M27's 'benchmark' map of a 4v4 UEF mirror on Africa, M27 v67 took 167s to run the first 10m, and encountered stuttering for 20.8 seconds cumulatively.
- By contrast, M28 took 67s, and the cumulative time of freezes was just 0.4 seconds. The only main caveat to this is it freezes the game for a while (probably at least 1 minute) at the start of the game which is much longer than M27, but overall it should still be faster for games running 10+ minutes even after factoring this into account.
- Although not tested (as it's hard to produce an easily comparable scenario), I'm also confident that logic for T3 arti should be far lighter on the CPU than M27's approach which should help late game (as I suspect this was a likely culprit of some of the slowdown, along with M27's preference for swarms of T1 bombers).
-
That is great progress
-
M28AI's release day has arrived!
The main changes made from before were focused on compatibilty, (cpu) optimisation, and increasing its difficulty.
Compatibility
Tested M28AI with the following mods and map settings (usually this just consisted of a single game, so please let me know if you come across any issues):- Maps with water starts (including all-water maps such as Dreadnought Chasm)
- Survival maps
- AI Wave survival mod
- Flying engineers mod
- Norush game setting
- Low unit caps
- Crazy rush
- Nomads
- BlackOps
- BrewLAN
- Max AiX modifier (IIRC 5.9)
Optimisation
Big thanks to @Jip who helped me achieve a significant reduction in the time taken by M28AI to analyse the map at the start of the game. Previously M28AI was taking more than 2 minutes on 10km maps such as polar depression, with one of the functions being run taking c.102 seconds. With Jip's help this function's time was reduced to roughly 0.2 seconds, with M28AI completing its analysis in most cases in 30s or less (slower CPUs will take longer). The devlog contains more information and profiling for this.This also allowed me to make use of more accurate water zone generation (without increasing the analysis time).
Jip also helpfully provided code to allow M28AI to get the navmesh label (broadly, whether a particular part of the map is pathable by particular units) for a particular point on the map (which was needed for the optimised code mentioned above to work properly).
Competitveness
Various tweaks and improvements were made to make M28AI provide a harder challenge. As part of this I made sure that M28 was capable of beating RNGAI and/or DilliDalli AI on a number of maps (including those maps I'm aware of where they're capable of beating M27AI some of the time).Rather than try and achieve >50% win rate on all these maps, I instead just aimed for a single win, and did the AI version of 'save scumming' with replays until M28AI either won the replay, or creating a new game on the map resulted in it winning. Outside of Astro Crater (where M28AI is able to beat M27AI a majority of the time) I didn't test M28AI against M27AI. This is because I realised early in the development of M28AI it was too demotivating to watch it get crushed by M27AI (wheras against RNGAI and DilliDalli AI even if it loses often it's a close fought game, providing me with motivation to try and improve M28AI as opposed to giving up).
As a rough count this process involved 109 tweaks and improvements to M28AI (examples of more impactful changes within this include T2 artillery construction, destroying obsolete radar, and basic logic for building and managing bombers).
Since I've played a grand total of 1 game against M28AI (just to make sure M28 didnt take control of my units when it was my ally against 2 enemy M28AI), I expect it will need a lot more changes to improve its performance against players and become 'cheese resistant'. Almost all games were 1v1s (since they're faster to test) so although the code was all written with the aim of working in team game scenarios, I expect these aspects of it logic will be a bit rougher around the edges.
Please let me know if you have any feedback, suggestions, or encounter bugs.
-
After my record for the longest version (in development and code length) ever comes my record for the shortest version ever (a 1 line change)! Big thanks to Relent0r who mentioned M28 wasn't building any tanks, which was due to a bug that arose when one of the common debug options I use (showing unit names) was disabled.
-
v3 - Starting a new campaign
- Added preliminary support for campaign maps - currently I've only tested on the first FAF mission (Black Day), and I expect on many maps it won't work properly (due to one of the bugs identified below potentially completely breaking M28 I decided to release earlier than planned as a part-hotfix update). My aim will be to improve M28's performance over time (e.g. currently 1.5 AiX M28 struggles on easy on black day if the human player does nothing). As part of this, M28 allows an AiX on campaign maps of up to 10.0 AiX for the M28 teammate, and will take its share of initial units at the start of a game (since it's not possible to gift units to an AI ally in the campaign)
Note - if playing with M28 as a teammate, a higher unit cap is recommended. - Improved the basic bomber management logic (idle bombers should return to a safe location, large numbers of bombers should search further away for enemies)
- Improved build order on certain maps (e.g. on maps where the only mex adjacent factory build locations are blocked by reclaim, M28 should now try and just build the factory in a 'clear' area so it starts construction sooner)
Fixed a few bugs, including:
- M28 potentially not working on some maps with water
- PD being way too far away from the base (more an issue on 5km maps)
- Added preliminary support for campaign maps - currently I've only tested on the first FAF mission (Black Day), and I expect on many maps it won't work properly (due to one of the bugs identified below potentially completely breaking M28 I decided to release earlier than planned as a part-hotfix update). My aim will be to improve M28's performance over time (e.g. currently 1.5 AiX M28 struggles on easy on black day if the human player does nothing). As part of this, M28 allows an AiX on campaign maps of up to 10.0 AiX for the M28 teammate, and will take its share of initial units at the start of a game (since it's not possible to gift units to an AI ally in the campaign)
-
v4 - Campaign and other enhancements
A bunch of bugfixes, tweaks, and some improvements specifically for campaign maps:- 24 bugfixes. The more generally impactful of which relates to the mass/energy stall logic which should now be much more likely to only pause some things rather than everything when stalling
- Quantum gateways and RAS should be built for campaign maps and AiX modifiers (not 1.0 M28 though since I see RAS as too inefficient at that level)
- Reworking of how buildable locations are tracked - originally intended as an optimisation it ended up taking far longer than the previous approach, but I decided to leave it in since it is more accurate and my hope is that it makes late-game major slowdowns less likely than the previous approach.
- Optimisation of nuke targeting logic to reduce how long it can take (at the cost of being less likely to edge-nuke targets), and a number of other functions
- M28 can now capture campaign objective targets. So for example it is now capable (without any AiX boost) of completing FAF mission 2 on easy on its own unaided (i.e. with the human player afk for the entire game).
- Roughly 32 other tweaks/improvements, a number of which are aimed at having M28 better handle very high mass scenarios.
Acknowledgements
- Hdt80bro โ helping me find a better way to confirm if a map is a campaign map, and clarifying how to hook orders such as IssueGuard
- Grandpa Sawyer โ helping me debug an issue with the base AI taking control of my units (including the IssueFactoryAssist() order being the one I needed to hook)
- Jip โ Helping with the same bug as the above, highlighting I was hooking a file that only existed on FAF develop (hence why it wasnโt doing anything for non-FAF develop games)
- Fearghal โ replay highlighting major late game slowdown for M28 on Astro Craters Rich
- Wingflier - replay showing M28 losing at 1.5 AiX
-
The campaign AI works pretty nicely, the biggest issues I've run into so far is the AI suiciding to the PD on "Golden Crystal". It happens everytime I tried to play the map, so I think it should be fairly easy to reproduce.
The AI would send their com to the bottom left of top left, tank PD fire then eventully retreat. Then after will they would go back this will repeat. The com normally dying trying to overcharge the PD.
-
@savinguptobebrok Thanks for flagging, I'll have a look for the next version (v7)
-
v5 Release
Main focus was on getting M28 to work ok on FAF mission 3 and some improvements to mission 1 objectives
- 15 Bugfixes
- 11 Misc changes, including a cap on the number of RAS SACUs, and making gunships more aggressive in campaign
- Objectives to repair a damage building (such as the optional one on FAF mission 1) can now be completed by M28
- M28 should treat civilian targets that need to be protected as relatively high priorities for its gunship and asf defence logic
- Resolved an issue on FAF mission 3 where M28 wouldn't build navy until the 2nd objective (the reason was due to it wanting to build its naval factory in part of the map that hadn't yet been revealed)
- Added a unit cap override option in game settings (so M28 can e.g. be given a 1k unit cap) and made 3 improvements to its decisions when near the unit cap.
-
v6 Release
A small release (which doesn't reflect any issues/improvements highlighted the past week as I was away):- Sniperbots should be less likely to move in range of an enemy fatboy
- T1 mobile arti and T2 MML should be more aggressive
- ACU should cancel its upgrade if hit by a TML (such that it is about to die), and should avoid upgrading in range of an enemy TML (that it has identified) unless under TMD coverage
- Added counter to cloaked enemy ACU/SACU that is outside omni coverage
- Increased the amount of SAMs M28 builds both in its base and across the map
- Increased the MAA production by basing the decision on whether there is sufficient MAA on the amount of MAA only (previously SAMs were taken into account)
- 2 Bugfixes, the main one preventing size 1 buildings being built (which meant T1 and hence T2 PD wouldn't get built)
Acknowledgements:
- Azraeelian Angel โ Multiple player vs M28 replays, which resulted in most of the changes made this release
- Relent0r โ highlighting M28โs ACU could be killed by a single TML firing multiple missiles, and a replay where M28โs ACU would upgrade while taking damage and almost dead.
-
v7 Release
Various small changes from replays and points people have highlighted in the past week (4 bugfixes and 9 misc changes), including:- ACU should be less suicidal around PD @savinguptobebrok this should hopefully fix the issue you highlighted)
- Fixed an issue with large numbers of M28 on the same team where too few factories would get built (in turn leading to overflowing mass at the T2-T3 transition stage)
- Monkeylord should be more aggressive (instead of trying to kite with its bolters)
- ASFs should no longer suicide to defend a friendly novax satellite!
Acknowledgements
- QAI300 โ Replay highlighting bug with land units not moving (caused by the logic that triggers when engineers are to build a game ender).
- Radde โ 4 human v 4 M28AI replay highlighting mass overflow issues at the T2-T3 stage
- Azraeelian Angel โ More human vs AI replays
-
V8 Release
32 Changes made, largely based on replays and testing on M5 and M6 of the FA campaign. The more significant of these changes are:- Improved how M28 handles missions 5 and 6 of the campaign (mission 5 - it should no longer try and target invulnerable civilian buildings; mission 6 - it should build things despite not having an ACU and is less likely to have a bunch of GCs sitting underwater taking damage from enemy subs)
- Early game improvement in teamgame scenarios - previously M28's ACUs and engineers would consider moving to a nearby zone with unclaimed mexes even if that zone had another M28 ACU/base in it (now they will prioritise other nearby locations first)
- Increased the likelihood of T2 arti being built in response to certain enemy threats (such as an enemy firebase)
- Units should move instead of attack-move when they think they should easily crush the enemy (to avoid e.g. a GC inching forwards on attack move due to t1 engineers or land scouts)
- Reduction in the land zone size of start positions as on some mapgen maps they ended up reaching to the midpoint of the map
- Fixed a resource sharing bug that could lead M28 to think it was mass stalling when it wasnt
- Improved late-game so it's less likely that multiple game enders will be started at once
- Improved mass storage logic (it now gets more accurately factored into income, and is more likely to be built around T3 mexes in priority to T2)
Acknowledgements
Radde and Azraeelian Angel for each providing a number of human vs AI teamgame replays (that formed the basis of most of the changes made this update) -
@maudlin27 - Hello maudlin27, first of all I have the greatest respect for your work. The AI โโis incredible and makes AI games super exciting. Since I like playing against an AI, I appreciate your AI. As the level of difficulty increases, it does not exceed it, like an AXI AI. I have two unit mods in the vault (SAVERS FATBOY & SAVERS RAMROD) in both cases your AI is telling me to contact you so they can be used in the game. I just notice that the AI โโstill uses them. Does your AI still need a note or does the AI โโact better with these mods then? Greeting Saver
-
@saver Hi, the note's just meant to flag the greater risk of errors if mods are used as depending on what the mod does there could be unexpected scenarios. I.e. in theory it should be compatible with mods, but if you come across any really strange/obviously bugged behaviour (or, if you have the Log window [F9] displaying, if you see loads of lua error messages) then send me a DM on discord with the details and replay and I can check.
-
v9 Release
Main changes were reworking how Ahwassas target units (including a bugfix that stopped them targeting buildings) and replay based changes (12 tweaks and bugfixes in addition to the Ahwassa changes), including:- Ahwassas should be more aggressive, particularly in larger numbers, while also being slightly better at avoiding ground AA fire
- MMLs should be slightly more likely to try and overwhelm a TMD defended positon
- ACU should be more aggressive (by factoring in the threat of allied units approaching its current position)
- Fixed some bugs with gunship targeting logic
- Adjusted experimental behaviour slightly so they're less likely to attack-move if an enemy experimental is attacking them just outside their range.
Also implemented logic provided by Jip to make M28 compatible with the upcoming FAF develop release.
Acknowledgements:
- Jip - Providing voice chat and code for the upcoming FAF develop changes (that introduce a new brain class for each AI)
- Azraeelian Angel - Human vs AI replay
- Radde - Human vs AI replays
-
Hello @maudlin27 , my brother and I have been heavily playing your M28 mod and we love it. Just wanted to put it out there that if there is any specific feedback you wanted from us we would be willing to help test and provide feedback for you.
Cheers,
Russtymango
-
@russtymango Thanks for the offer! At the moment I've no shortage of things to look at, but in the medium term one area that would be useful to get more information on is human vs AI naval gameplay.
Navy is an area that AI struggles with generally, while most replays I get sent will be for maps where navy plays no role, and as a player it's also the weakest part of my game/playstyle, so I expect it to be the weakest part of M28.
In particular, replays of human vs M28AI games on both naval maps, and maps which have a naval component (but also work with land/air) would be useful. If you're able to do it beating an AiX version (e.g. 1.2 modifier or better) even better as that makes it easier to highlight major mistakes the AI is making that cost it the game.
-
Many thanks for another great AI!
Just tried a match with M28 on the map concord lake, but it seems M28 doesn't like the map and decides not to play it
The ACU spawns but doesnt initiate any activity.
Noticed that there was a bug like this earlier on maps with water, so perhaps this is another variant of it?FYI It's an original map, so it's not in the map vault
-
@j_w_w Could you send me a DM on discord with a copy of the map? Iโve recently had a similar issue flagged on another map so itโs likely the same problem but Iโd need to be able to test on the map to confirm.
Alternatively you could retest it after the next update which may have fixed the issue.