Installation notes
To play with M27AI, go to the mods section in the FAF client and search for M27AI. Download the mod, then when hosting a game make sure you have enabled the M27AI mod. This should allow you to then select M27AI as one of the players in the game.
Further details including screenshots on how to setup custom AI are included on the FAF Wiki:
https://wiki.faforever.com/en/Custom-AIs
Summary of how M27 plays compared with default/sorian AI
M27 is intended for players in search of a greater challenge than the default/Sorian AI. Some of its features include:
- Adaptive playstyle, responding to player actions, and actively seeking out vulnerabilities in player forces and building units to exploit these
- Making use of player tactics/unit microing and certain 'try-hard' type approaches, for example kiting with units, hover-bombing, synchronising MMLs to overwhelm TMD, manual reclaiming, ctrl-King T2 mexes to build T3
- Being built with FAF balance/meta in mind
To give a couple of examples of the challenge it provides compared to the default and Sorian, 1 (normal) M27 AI has managed to beat an Adaptive and/or Sorian adaptive AiX with a 2.0 modifier, and also beaten 7 Sorian adaptive (on the same team) on Setons, and is consistently the winner of AI vs AI tournaments (although RNGAI is a close second and worth checking out as well since it offers an alternative play style).
M27AI background and status
Following the 2021 Supreme Computer Cup I was inspired to have a go at developing a basic AI for FAF. As I had zero experience of coding in Lua, I thought at the same time I would write down things as I learnt them to have both a guide for other people interested in getting started in developing an AI, and a dev log for the creation of my AI.
See below for a link to the current AI development guide and devlog (2022-12 update - as people were having issues viewing the original file I've split it out and have separated the main 'devlog' part of M27 development from the more general notes on getting things setup to develop the AI and useful functions)
Devlog extracts: https://docs.google.com/document/d/1uQlEoN-kti7G2MnhwD60uaaHwVevPNYH/edit?usp=sharing&ouid=100973959280546778272&rtpof=true&sd=true
Development guide extracts: https://docs.google.com/document/d/1puzW5hKcOBNE7wu7bXj6qXfTJ60r2f93/edit?usp=sharing&ouid=100973959280546778272&rtpof=true&sd=true
You can also access the mod on Github:
https://github.com/maudlin27/M27AI
While in theory it should be possible to install the mod by copying the M27AI folder (from Github) into the FAF mods directory, some people have reported issues with that. It's recommended that the mod is installed through the FAF client (via the mod vault).
I've copied the current overview from the guide below:
This document is intended to do 3 things at once (meaning it does none of them very well!):
- Act as a guide to people new to FAF AI development, including collating any other useful resources out there on AI development
- Be a sort of dev log of my thought process and development steps for creating my first FAF AI, with extracts of code thrown in
- Form my main ‘todo’ list for further developments of my AI
If you see any errors, or have any comments or suggestions (in particular any AI developers who read this since you’ll probably know better/easier ways of doing things than the methods I’ve chosen) let me know and I can update the guide where relevant.
If you’re here for useful resources and/or details of how to write AI and don’t care about the dev log aspect then just skip to section 2) Setup and background and section 5) Index of useful functions, and/or browse the index for points that may be of interest.
Latest changes (v70-74 summary)
V70 summary of changes:
Update based primarily on issues spotted from the first weekend of the Rainbow Cup tournament:
- Fixed a bug that caused MAA to stay way too far back from the ACU when there were nearby enemy tanks (i.e. the MAA would run away from the tanks even if they were needed to protect the ACU from gunships/bombers)
- Significantly improved the speed at which the AI will try and get T2 PD if the enemy gets a guncom and attacks its base
- Added new capture logic to capture certain civilian units on the map (e.g. titans on big bang dry)
- 6 other bugfixes, and 12 misc changes, mostly relating to building ground based anti-air, and being a bit more cautious with bombers (including not overbuilding them once a very large bomber force has been assembled).
v71 - 8 Minor bugfixes and tweaks
V72 - 4 fixes, including AIX fix
v73 - M28 compatibiltiy fix and energy storage adjust for FAF balance change
v74 - Minor bug fixes, primarily relating to the mobile factory and Aeon gun upgrade FAF changes
Note: Most of my focus is currently on M28 - the below links to a separate M28 devlog:
https://forum.faforever.com/topic/5331/m28ai-devlog-pre-release
Areas of focus by version (history):
v1-3: Release
v4 - Intel and threat detection
v5 - Use of ACU and hotfix
v7 - Engineers and building upgrades
v9 - Air
v10 - Anti-Turtle
v11-v12 - Pathfinding and misc changes
v13 - Anti-navy
v14 - ACU and mobile shields
v15-v18 - CPU optimisation and hotfixes
v19 - Rally points and air domination strategy
v20 - Late game
v21-23 - Eco management
v24 - Bombers
v25 - Misc
v26 - Nukes
v27 - T3 Arti
v28 - Game options/compatibility
v29 - Optimisation and TMD
v30 - Czar, Soulripper and Defences
v31 - Bombers (again) and TML
v32-33 - Plateaus
v34-35 - Turtling
v36 - Skirmishers
v37-38 - Game enders
v39 - Quantum optics
v40 - Deceiver
v41 - Hives and shield disruptor
v42 - Misc and multi-TML defence
v43 - Misc and UEF experimentals
v44-46 - Teamwork
v47 - Optimisation
v48 - Personality
v49 - Hotfix
v50-51 - Navy
v52 - Desync hotfix
v53 - Shield boats
v54 - Temporary eco strategy
v55 - Experimental defence
v56 - Stealth boat
v57 - Pathfinding (again!)
v58 - Misc (RC tweaks)
v59 - Gunships
v60 - Naval enhancements
v61 - Stats
v62 - Land spam
v63 - T3 arti prioritisation
v64 - Mass fabs
v65-v66 - Skirmisher and T3 arti tweaks
v67 - Misc
V68-tml enhancements
v69 - Misc
v70 - Guncom defence and capture
v71 - 74 Mini updates - bugfixes