• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login
FAForever Forums
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login

AI-Uveso (v116) - AI mod for FAForever

Scheduled Pinned Locked Moved AI development
162 Posts 41 Posters 51.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    Gladry @Uveso
    last edited by 5 Apr 2021, 04:32

    @Uveso

    if bp.Economy then
          if bp.Economy.BuildCostEnergy and bp.Economy.BuildCostMass 
    ...
    end
    
    if bp.Economy.BuildTime then
           bp.Economy.BuildTime = 
    end
    
    1 Reply Last reply Reply Quote 0
    • U
      Uveso
      last edited by 5 Apr 2021, 09:55

      @Gladry

      I am sorry i don't know what you want to tell me with this code snippet

      Its not a part of the code we talked about, enhancements don't have a Economy sub table.

      Also you don't need to ask for if bp.Economy then when you need to know if bp.Economy.BuildCostEnergy exists.
      Just call directly if bp.Economy.BuildCostEnergy. it will return false if bp.Economy is missing.

      1 Reply Last reply Reply Quote 1
      • A
        Accipian
        last edited by 5 Apr 2021, 18:03

        @Uveso
        I appreciate the response. I thought Nomads was always up to date through the patching mechanism? I am running the most recent version of FAF and it still produces the same result. Is there a way to check to make sure I am running the most recent version of nomads?

        Thanks!

        1 Reply Last reply Reply Quote 0
        • U
          Uveso
          last edited by 6 Apr 2021, 04:15

          @ctrlaltdelete :

          Good question; i always use the develop version of nomads downloaded from Git-Hub:
          https://github.com/FAForever/nomads

          I thought it is the same version that you can play through the FAF client.
          Its both printing version 98 to the log, but the client version has still this error.

          1 Reply Last reply Reply Quote 0
          • I
            Idalgos
            last edited by 12 Apr 2021, 15:31

            @Uveso
            Hi! Encountered the same problem as ctrlaltdelete, and as I am not that techsavy, wanted to ask how should I update nomads to fix this problem?
            P.S. Really like your AI, it wrecked me and my friends good, was fun expirience! Thank you for providing that!

            1 Reply Last reply Reply Quote 0
            • P
              plasia
              last edited by 1 May 2021, 01:41

              In case you missed it on discord @Uveso

              Seraphim Experimental Bomber likes to gift itself as a mass donation. It does this via a ctrl+k. It does this before dropping any bombs. I have seen this multiple times.

              https://youtu.be/oBbjImRz6jA

              1 Reply Last reply Reply Quote 0
              • U
                Uveso
                last edited by Uveso 5 Jan 2021, 15:24 1 May 2021, 15:24

                @plasia

                Yes this bomber was driven by a suicide platoon. it was meant to just destoy itself.

                This was the corresponding platoon former:
                https://github.com/Uveso/AI-Uveso/blob/master/lua/AI/AIBuilders/Mobile Experimental-Air.lua#L431

                Its driven by this function (AirSuicideAI):
                https://github.com/Uveso/AI-Uveso/blob/master/hook/lua/platoon.lua#L2518

                The suicide platoon was searching for Economic buildings.
                That's why he destroyed the first Tech3 energy building closest to the AI's base.

                Maybe a bad decision to do it with a suicide attack, but not a bug 🙂

                1 Reply Last reply Reply Quote 0
                • P
                  plasia
                  last edited by 4 May 2021, 07:03

                  I'm not trying to be rude, but follow along here:

                  If my teammate got up an experimental and just suicided it into something like an energy building I would be.... most upset.

                  It's simply a mass donation. "Oh no! not my T3 reactor, that will inconvenience me for a whole minute!" Then I profit from all that mass dropped on my front door.

                  Suiciding into energy... is just silly. Suiciding into something that matters, like a SMD... that makes sense.

                  1 Reply Last reply Reply Quote 0
                  • U
                    Uveso
                    last edited by Uveso 5 Apr 2021, 17:27 4 May 2021, 17:27

                    Hey Plasia,

                    i am a german, and i like direct and honest answers!

                    You are absolutly right, its a total waste of mass and fight power.

                    And its already fixed!
                    The new target priorities for suicide platoons are:

                                    categories.STRUCTURE * categories.EXPERIMENTAL * categories.ECONOMIC,
                                    categories.STRUCTURE * categories.EXPERIMENTAL * categories.SHIELD,
                                    categories.STRUCTURE * categories.EXPERIMENTAL * categories.ARTILLERY,
                                    categories.STRUCTURE * categories.TECH3 * categories.ARTILLERY,
                                    categories.STRUCTURE * categories.TECH3 * categories.NUKE,
                    
                    P 1 Reply Last reply 5 May 2021, 04:45 Reply Quote 0
                    • U
                      Uveso
                      last edited by Uveso 5 Apr 2021, 17:32 4 May 2021, 17:31

                      Comming soon:

                      Advanced ACU attack function
                      https://youtu.be/LvLNFyNk3kg (5 minutes)

                      Amost 90% of the function is finished.
                      I guess i will be able to make an mod update in the next 14 days.

                      1 Reply Last reply Reply Quote 0
                      • P
                        plasia @Uveso
                        last edited by 5 May 2021, 04:45

                        😄

                        @uveso said in AI-Uveso (v92) - AI mod for FAForever:

                        Hey Plasia,

                        i am a german, and i like direct and honest answers!

                        You are absolutly right, its a total waste of mass and fight power.

                        And its already fixed!
                        The new target priorities for suicide platoons are:

                                        categories.STRUCTURE * categories.EXPERIMENTAL * categories.ECONOMIC,
                                        categories.STRUCTURE * categories.EXPERIMENTAL * categories.SHIELD,
                                        categories.STRUCTURE * categories.EXPERIMENTAL * categories.ARTILLERY,
                                        categories.STRUCTURE * categories.TECH3 * categories.ARTILLERY,
                                        categories.STRUCTURE * categories.TECH3 * categories.NUKE,
                        
                        1 Reply Last reply Reply Quote 0
                        • U
                          Uveso
                          last edited by Uveso 6 Jan 2021, 03:15 1 Jun 2021, 03:15

                          Update31.May.2021(v93)

                          • New: Added advanced ACU fight function. Microing, threat management, proper overcharge targets.
                          • New: AI is now able to use gifted factories also after full share or player disconnect.
                          • New: Adding "DoNotAllowMarkerGenerator = true," to the map scenario file will block autogenerating markers.
                          • Opt: Added builder for an early energy storage to enable ACU overcharge
                          • Fix: Hardcaped the amount of mobile AA that can be build per location
                          • Fix: Fixed a bug inside the AI-Marker generator (thanks to chp2001)
                          • Fix: Ecomanager will no longer pause the build of Tech1 factories.
                          • Opt: Decreased the massextractor upgrade ratio for Sub AI Storm
                          • Opt: 2nd factory now needs at least 2 mex and 4 energy buildings to be build.
                          • Opt: Air Suicide Platoons no longer attack none game ender buildings.
                          • Opt: Panic Builders are now also building tanks and bots, not only arties.
                          • Opt: ACU will now assist engineers (energyproduction and factories)
                          • Opt: Aeon ACU is now first enhancing with CrysalisBeam, not HeatSink.
                          • Opt: Optimized AI marker generator. (fixed issue with Open Palms)
                          • Opt: Added a value to the AI-Marker to identify related layer areas (.GraphArea)
                          1 Reply Last reply Reply Quote 0
                          • The_JanitorT
                            The_Janitor
                            last edited by 3 Jun 2021, 14:43

                            The AI is not doing anything on some maps ex. Twin Rivers, can we get list of maps that AI should be working on?

                            Secure the kill and send it off.

                            1 Reply Last reply Reply Quote 0
                            • U
                              Uveso
                              last edited by 3 Jun 2021, 16:16

                              @HintHunter

                              My AI is working on almost every map.
                              It has a build in AI waipoint generator so you also can play maps without any AI markers.

                              I tested Twin Rivers right now, and its working like expected.

                              Can you post a full game.log ?

                              The_JanitorT 1 Reply Last reply 3 Jun 2021, 16:39 Reply Quote 0
                              • The_JanitorT
                                The_Janitor @Uveso
                                last edited by 3 Jun 2021, 16:39

                                @uveso Contacted you on discord.

                                Secure the kill and send it off.

                                1 Reply Last reply Reply Quote 0
                                • maudlin27M
                                  maudlin27
                                  last edited by 3 Jun 2021, 19:30

                                  While I expect the AI has been designed for more conventional ladder 1v1 matches rather than the 1v1 map I chose, I've still noted various issues/flaws with what the AI did which I think would be applicable more generally. This was using the 1 June uveso mod:

                                  Replay ID #14646432
                                  Uveso adaptive Vs guncom:

                                  • 1st Land fac location - it picks somewhere that requires the com to move (losing a couple of seconds)

                                  • Power order - It has a hydrocarbon right by the starting location, yet focuses on building 3 T1 power gens first. It'd be more efficient to have the com assist the hydrocarbon once the first engi is done (e.g. have the com get t1 mexes while the engi is being built, then assist the hydrocarbon); on a map where the hydrocarbon is further away then I could see more merit in getting more t1 pgens first

                                  • Power stalling and lack of focus - the AI has a com building 1 T1 pgen, an engi building a 2nd T1 pgen, and a 2nd engi building a hydrocarbon, all while power stalling. Far better to focus on the most power efficient option (Hydro), and pause any construction while power stalling until the power generation is completed

                                  • Mass stalling/not claiming T1 mex - the AI mass stalled for a while (with far more spent mass then generated) all while 2 unclaimed mexes are in range of engineers. While mass stalling, more power is being started/built, and then a t1 factory; far better to focus on generating easy mass (t1 extractors), then the factory (assuming more build power is needed), and then more t1 power (assuming the planned strategy requires significantly more energy), than to try and do all at once

                                  • Too much power - Far more power is built than needed (12 T1 and hydro would be enough if going for a gun upgrade, but instead the power is wasted)

                                  • Engineers sent out dont start building at nearest t1 mexes

                                  • Strange order changing - The first t1 engi sent out of the main base passes 2 unclaimed mexes, then goes all the way back to base while other engis go to where it originally was; presumably some command given to that first engi, but it would've make sense to take one of the others nearer the base for the new command and use the far out engi to build t1 mex

                                  • Unused build power/factories - Lots of t1 land factories built, but some of these appear to sit idle.
                                    No need to construct more factories if the existing ones aren't going to be used. The factory also sat idle despite a big threat [guncom] being scouted

                                  • Feeding an enemy kills - Scouts come across guncom - instead of sending all defenceless units away from it, and building up something to try and counter it, the AI keeps sending engineers and unarmed scouts piecemeal (giving the guncom free kills)

                                  • Storage before T2 Mex - Engineers build mass storage between 2 t1 mex; better to first upgrade those mex to t2 before building the storage

                                  • Mass generation prioritisation - The mass storage is built at the same time as the T2 mex upgrade, all while mass stalling. Normally it's best to focus on 1 mass generation (i.e. the t2 mex upgrade) first, and once complete move on to the next (e.g. mass storage). The exception being if there's significant amount of mass built up that can be used (not the case here).

                                  • Unit mix - Preference for lots of engineers over any combat units, meaning vulnerable to just about any attack. Although lots of buildpower gives the option to try and respond quicker to threats (e.g. get quick PD up, or assist an air factory to rush bombers etc.), the AI didn't make use of the engineers and hence offered no resistance to the enemy commander.

                                  • Counterproductive COM micro - The AI sent its unupgraded com (with no support) to fight mine. The AI com then 'stutters' (about 6m5s in), getting about 1 shot to every 4-5 of my coms (I'd expect 1 shot for every 2 of mine given mine had a speed upgrade) - it keeps rotating as if it's thinking about doing something else before switching to attacking my com. In observer mode it looks like this might be due to move commands sent to the com - maybe they're being sent/changed too often?

                                  • Energy storage for combat - In the situation where you have lots of surplus power and build power, minimal ground units, but your com is about to get into battle, then getting 1 energy storage as a top priority might help sway the battle in your favour.
                                    In this scenario it wouldn't have been enough, but would still have been of a bit of use given the excess T1 pgens that had been built

                                  • Response to attack - similarly to the unit mix point above, despite scouting an enemy guncom advancing on the main base, no units or pd were built in response to this threat (lots of engineers, land facs and an air fac were available). Instead some factories are idle, others are producing engineers, and 2 new naval yards are being built, all while mass stalling

                                  M27AI and M28AI developer; Devlogs and more general AI development guide:
                                  https://forum.faforever.com/topic/2373/ai-development-guide-and-m27ai-v71-devlog
                                  https://forum.faforever.com/topic/5331/m28ai-devlog-v150

                                  1 Reply Last reply Reply Quote 0
                                  • U
                                    Uveso
                                    last edited by 4 Jun 2021, 05:46

                                    @maudlin27

                                    great feedback!

                                    Well, my AI is a turle AI and normaly i would play on this map against the "rush" sub AI with a cheat and buildfactor of 1.7
                                    The adaptive AI uses 40% of its overall income to upgrade mex etc. So it has no eco for combat units at the beginning.
                                    Thats because turtle playes don't attack in the first 5 minutes with a Gun Com ^^ They use the ACU as engineer 😄

                                    I am not sure if we could make an duel style AI.
                                    There are some limits by the game engine and we can't make everything possible.

                                    Its like the ACU torsotwist. its adjusting the torso on almost every movement command.
                                    So its sometimes not firing at all when evading.

                                    But build order and better timing can be done.
                                    I will do a test AI with your recommendations and see how it works.

                                    Thank you again for your much appreciated feedback!

                                    1 Reply Last reply Reply Quote 0
                                    • maudlin27M
                                      maudlin27
                                      last edited by 4 Jun 2021, 22:23

                                      Is it possible for the AI to be reactive (e.g. the moment a scout reveals a threat the AI changes strategy), or does it have to try and pre-empt potential enemy attacks by covering all bases (e.g. build AA, PD, TMD, T2 arti in anticipation of potential attacks regardless of whether the enemy has any of the units in question)?

                                      Similarly, if a command is sent to start construction of something, and a critical event happens (power stall, or to a much lesser extent mass stall) can the AI be told to change what it's doing then, or would it have to wait until the next event (e.g. construction finishes)?

                                      In terms of the eco side, if the intention is to eco and not build any defence then I'd do a 'hard eco' - i.e. there's no point building so many t1 factories, engineers and power initially; better to get more mass generation (so t1 engi's prioritise any near unclaimed mex first, then switch to upgrading a mex near the core base to t2), enough power to support an upgrade to T2, get T2 upgrade on com or factory, and hope to then make use of the tech and eco advantage to turtle up before the enemy catches on and tries to rush. That is, a couple of token t1 land units won't help unless the enemy sends their com with no upgrades and no support, or builds zero land units (meaning their mex can be killed), both of which are highly unlikely, but having the capability to build lots of land units (without using such capability) is using up alot of resource and delaying the point at which you can get t2 defence.

                                      M27AI and M28AI developer; Devlogs and more general AI development guide:
                                      https://forum.faforever.com/topic/2373/ai-development-guide-and-m27ai-v71-devlog
                                      https://forum.faforever.com/topic/5331/m28ai-devlog-v150

                                      1 Reply Last reply Reply Quote 0
                                      • S
                                        Sprouto
                                        last edited by 5 Jun 2021, 00:10

                                        Technically - yes - it is possible. However, the real weakness is that there are no metrics or functions that can easily, or more importantly, performance-wise, address that kind of scenario. The AI, unlike the human, has little to no ability to 'remember' what he saw, even just seconds ago. This makes pro-active behaviors difficult to construct.

                                        Eco management is another weak area, and one the AI has some difficulty adjusting to - part of the problem is one of scale, another is the game design itself. Due to the random nature of the unit designs, there is little commonality in building costs and times - as a result, a constructor's consumption can bounce erratically from item to item, a condition which afflicts factory builds as well. Many attempts have been made to have the AI 'pause' his construction, which is unfortunately a band-aid on the problem - the real problem being one of reasonably accurate prediction of consumption. The side effect of the original code designed to 'pause' building is a ping-pong of rather costly events which don't solve the economy issue, but tend to push it around, and at some considerable cost to the performance.

                                        There have been many potential AI developers over the years that have had the best of intentions, only to throw their hands up at the inability to address that flaw.

                                        1 Reply Last reply Reply Quote 0
                                        • UvesoU
                                          Uveso
                                          last edited by 5 Jun 2021, 05:16

                                          @maudlin27

                                          Yes the AI can react to threat and is able to change its behavior.
                                          Its not changing a kind of strategy, but builder will change what they build or what they attack.

                                          In case we use custom made functions then we can also cancel build orders or stop an ACU
                                          enhancement when we need to move the ACU. My AI is using a custom function for the ACU and is
                                          able to cancel enhancements.

                                          And again thanks for your detailed hints how the AI should make the first decisions.
                                          I said it already i am a turtle player. My only experience with a competitive opening is watching
                                          replays from Nexus and Tagada.

                                          Since you are very interested in how the AI works, here is a good example of how
                                          complex is it to move just the ACU around.

                                          Here is a link to the LUA code lines for the ACU:
                                          https://github.com/Uveso/AI-Uveso/blob/master/hook/lua/platoon.lua#L3396

                                          You don't need to read the LUA code itself.
                                          Just read the remark lines between the code (starting with --)
                                          The function starts at line 3396 and ends in line 4181.
                                          So there are about 780 lines of code needed to just move the ACU in a more smart way
                                          than the original function.

                                          The following function (ACUChampionBaseTargetThread) with 230 lines of code
                                          is for the ACU targeting and awareness of enemy units around the ACU

                                          Like Sprouto said, technically; Yes we can do everything.
                                          But, you can't make every function more smart like the ACU function because we don't
                                          have the CPU power for it.
                                          The whole AI is programmed in LUA, and LUA is a language that is not precompiled.
                                          The game is loading the plain LUA textfiles, then compiling it in a c-engine friendly format
                                          and executes the LUA code.
                                          And this is so incredibly slow compared to c-code.

                                          But we can make better decisions on the start for buildorder or eco using.
                                          (btw, upgrading the closest mex to the base is also a custom function,the original function
                                          was uprading following the buildorder no matter how far away from the base the mex was)

                                          We can't do anything but at least we can try to make a more competive 1vs1 AI.

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post