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

    An "Unlimited Unit Cap" Option

    Scheduled Pinned Locked Moved Suggestions
    32 Posts 16 Posters 3.8k Views 2 Watching
    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.
    • UvesoU Offline
      Uveso @CheeseBerry
      last edited by

      @cheeseberry said in An "Unlimited Unit Cap" Option:

      Why do we accept 1% of our games to be notably worse, if adding a single line of code could change them for the better?

      Who told you it's just a single line ???
      If you want to change the unitcap you need to modify:

      \lua\ScenarioFramework.lua
      function GiveUnitToArmy()
      (army brains ignoring armycap on transfering units and re-enable it after doing it.)

      \lua\SimUtils.lua
      function UpdateUnitCap()
      (logic for ShareUnitCap option)

      \lua\AI\aiarchetype-managerloader.lua
      function UnitCapWatchThread()
      (This thread is watching the unitcap for GPG AI and need to be rewritten for unlimited units)
      function UnitCapWatchThreadSorian()
      (This thread is watching the unitcap for Sorian AI and need to be rewritten for unlimited units)
      function GetAIUnderUnitCap()
      (AI helper function for UnitCapWatchThread & UnitCapWatchThreadSorian)

      \lua\editor\UnitCountBuildConditions.lua
      function UnitCapCheckGreater()
      (Need a new function that does not need a UnitCap to calculate % of possible units)
      function UnitCapCheckLess()
      (Need a new function that does not need a UnitCap to calculate % of possible units)

      \lua\sim\ScenarioUtilities.lua
      function CreateArmyUnit()
      function CreateArmySubGroup()
      function SpawnPlatoon()
      function SpawnTableOfPlatoons()
      function CreateArmyGroup()
      function CreateArmyTree()
      function CreateArmyGroupAsPlatoon()
      (AI Scenarios need to know the unitcap and/or switching it on and off.)

      \lua\sim\Unit.lua
      function OnCaptured
      (function need a patch for CampaignMode and captorBrain.IgnoreArmyCaps)

      \units\XEB2402\XEB2402_Script.lua (Experimental Satellite System)
      function OnCaptured
      (function need a patch for CampaignMode and captorBrain.IgnoreArmyCaps)

      A CheeseBerryC 2 Replies Last reply Reply Quote 1
      • A Offline
        ANALyzeNoob @Uveso
        last edited by

        @uveso Well, it certainly looks like it would be much more complicated to change all of those things...but then the intelligent way to create an ESSENTIALLY unlimited unit cap would be changing the 1500 option to 15000...

        1 Reply Last reply Reply Quote 1
        • CheeseBerryC Offline
          CheeseBerry @Uveso
          last edited by

          @uveso It seems to me that you are assuming that I want to set the unit cap to literally infinity.
          As mentioned in my first post, I don't think a literally infinite unit cap is even possible. Finite hardware and all that.

          Are you saying that there is not just some global variable or equivalent that one can change from 1500 to e.g. 15000 as Corva suggested?

          1 Reply Last reply Reply Quote 0
          • UvesoU Offline
            Uveso
            last edited by

            @CheeseBerry

            Yes that's exactly the point. (thats why i also pointed to all related functions)
            If you took a look at those functions you will see that an unitcap of 'infinite ' or 15000 will break some AI functions.

            There are tactical decisions based on unit count that can't work with extreme numbers like 15000+.

            Nothing that can't be fixed, but its not a single line of change.
            Its more like 1-2 hour work of coding and 1-2 Days of testing and rebalancing the AI.

            1 Reply Last reply Reply Quote 1
            • FemtoZettaF Offline
              FemtoZetta
              last edited by

              I don't think he's concerned about AI at all, he's just talking about pvp games.

              1 Reply Last reply Reply Quote 0
              • UvesoU Offline
                Uveso
                last edited by

                @FemtoZetta

                I have no opinion on this.
                I am only providing information about what is needed to change unitcap in SupCom.

                And in case someone decides to implement this, then all should have in mind this change can take a while.
                Its not only the GPG and Sorian AI that need to be patched. Also my and all other AI mods need a fix then.

                As i said before, its not just a single line to change.
                (This shouldn't discourage anyone from asking, it's just a fact.)

                1 Reply Last reply Reply Quote 1
                • veteranasheV Offline
                  veteranashe
                  last edited by

                  Just saw a game with a mod with raised unit cap x4

                  1 Reply Last reply Reply Quote 0
                  • furyritchieF Offline
                    furyritchie
                    last edited by

                    One good thing about the unit cap is that you can't spam t1 only you need to upgrade to t2, t3, experimentals and other structures etc.

                    Former Board Member - March 2021 - March 2022

                    1 Reply Last reply Reply Quote 0
                    • UvesoU Offline
                      Uveso
                      last edited by

                      @veteranashe

                      the mod you mentioned is not changing the game functions.

                      The mod is patching all units in blueprint.lua like:

                      Blueprint.General.CapCost = Blueprint.General.CapCost * 0.25
                      

                      Its changing the need of cap for a unit.

                      This is the worst way to do it.
                      Absolutely incompatible with AI functions and every unit count function in the game.
                      (the cap is only visible for the c-engine not for LUA code)

                      CheeseBerryC 1 Reply Last reply Reply Quote 0
                      • CheeseBerryC Offline
                        CheeseBerry @Uveso
                        last edited by

                        @uveso
                        Thanks a lot for explaining the possible technical hurdles, I was in fact not aware of their existence!

                        FemtoZetta is of course right that I myself only care about PVP games, but, should a significantly larger unit cap be introduced and fully integrated into the client, it should work with all of FAFs features. This does of course include AI.

                        Do you think the technical hurdles are managable/reasonable? How would you recommend testing the change?

                        Regardless, I would gladly volunteer to help with the implementation and it's tests wherever I can 🙂

                        1 Reply Last reply Reply Quote 0
                        • UvesoU Offline
                          Uveso
                          last edited by

                          @CheeseBerry

                          Yes its technical possible. And we have also developer who are able to do it. (i guess this was the question)

                          I can't say if its reasonable. Only you can.

                          Do you want this so badly that it is okay with you that I have to work 2 days for it?
                          Not to mention the other 7 AI developer who also need to check their AIs.
                          Also Nomads and SCTA (Total Annihilation) are based on the FAF codebase and need some tests.
                          (Nomads should be ok, but SCTA is using custom AI functions)
                          I know this sounds a bit exaggerate, but i already checked some functions and it is indeed needed.
                          (I say it again, this is not meant to discourage you, just a fact)

                          Testing itself is the easy part. My AI has an option for endless test games.
                          So you only need to start a AI vs AI game and watch the log window.

                          The tricky part is patching some functions.
                          One function is watching the unitcap.
                          When unit cap is rached the AI knows it has reached the maximum amount of units.
                          This means we have equal or more units that the enemy.
                          Time to attack.
                          But wihtout a unitcap how can we decide that we have maximum units reached,
                          and more important that we have more or equal units than the enemy ?
                          (we can't just get the data from LUA without using cheat methods and our AIs don't use those methods)

                          This does not mean we can't do it, but we need some time to test new functions and conditions.

                          CheeseBerryC 1 Reply Last reply Reply Quote 0
                          • CheeseBerryC Offline
                            CheeseBerry @Uveso
                            last edited by

                            @uveso

                            Personally, I'd totally spend a weekend working on this.
                            It might not improve FAF by a huge amount, but compared to the ridiculous number of man hours already put into this project, it also doesn't take a huge amount of time.

                            Sadly though, I can't implement and test everything on my own. While I am a semi-competent programmer, I have no clue about the inner workings of FAF, or any of the AIs.

                            Therefore the question is: Who's help do I need and how do I get their buy-in? (Seems like talking to you is a good start)

                            1 Reply Last reply Reply Quote 0
                            • UvesoU Offline
                              Uveso
                              last edited by

                              Well, you could join us on our AI-Development Discord:
                              https://discord.gg/ChRfhB3

                              There you can talk to all AI devs.

                              1 Reply Last reply Reply Quote 1
                              • Dragun101D Offline
                                Dragun101
                                last edited by

                                Not to be that guy, AI discord is good. But this is one of the reasons Great Discord Intergration happened. To have these discussions there too for players. (That AI Discord is great. Just we shouldn’t forget that tbere are places for AI discussions now on faf discord too!)

                                I’m a shitty 1k Global. Any balance or gameplay suggestions should be understood or taken as such.

                                Project Head and current Owner/Manager of SCTA Project

                                1 Reply Last reply Reply Quote 0
                                • Anachronism_A Offline
                                  Anachronism_
                                  last edited by Anachronism_

                                  @CheeseBerry @Uveso
                                  Btw, fwiw, I just made a simple 'No Unit Cap' mod that allows every army to ignore the unit cap via SetIgnoreArmyUnitCap. I tested it with both regular AI's and Sorian AI's, and they both built above the unit cap with it enabled. It's on the vault if you want to try it.

                                  pfp credit to gieb

                                  1 Reply Last reply Reply Quote 3
                                  • UvesoU Offline
                                    Uveso
                                    last edited by

                                    @Emperor_Penguin

                                    i have downloaded your mod and tested it.

                                    well, there are some functions you maybe want to check.

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/AI/aiarchetype-managerloader.lua#L106
                                    UnitCapWatchThread will kill units if the unitcap is reached (ignoring it will not help here)

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/AI/aiarchetype-managerloader.lua#L142
                                    UnitCapWatchThreadSorian is same as above but also killing T3 units on cap

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/AI/aiattackutilities.lua#L127
                                    function GetBestThreatTarget() unitCapRatio is used for threat calculation

                                            local unitCapRatio = GetArmyUnitCostTotal(aiBrain:GetArmyIndex()) / GetArmyUnitCap(aiBrain:GetArmyIndex())
                                            # if we have no threat... what happened?  Also don't attack things way stronger than us
                                            if myThreat <= IgnoreStrongerTargetsIfWeakerThan
                                                    and (myThreat == 0 or enemyThreat / (myThreat + friendlyThreat) > IgnoreStrongerTargetsRatio)
                                                    and unitCapRatio < IgnoreStrongerUnitCap then
                                                continue
                                            end
                                    

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/editor/UnitCountBuildConditions.lua#L906
                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/editor/UnitCountBuildConditions.lua#L915

                                    UnitCapCheckGreater and UnitCapCheckLess are called 248 times inside the AIbuilders in 15 files:
                                    https://github.com/FAForever/fa/tree/deploy/fafdevelop/lua/AI/AIBuilders
                                    they all need to be checked!
                                    Example:
                                    { UCBC, 'UnitCapCheckLess', { .8 } },
                                    (thats the part that will cost the most time)


                                    not related to AI:

                                    In case you ignore the unitcap you need to tell the player brain that you do so.
                                    brain.IgnoreArmyCaps = true
                                    You used SetIgnoreArmyUnitCap(i, true) but you need to call this funtion:
                                    IgnoreArmyUnitCap()
                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/aibrain.lua#L932

                                    So at the moment these functions are failing:

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/ScenarioFramework.lua#L226
                                    GiveUnitToArmy is disabling the SetIgnoreArmyUnitCap and would only reenable it if brain.IgnoreArmyCaps is set to true

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/sim/Unit.lua#L789
                                    Unit:OnCaptured() is also disabling the ignore for the unit transfer on capture

                                    https://github.com/FAForever/fa/blob/deploy/fafdevelop/units/XEB2402/XEB2402_Script.lua#L152
                                    The Experimental Satellite System has a hook for OnCaptured and is also failing on capture


                                    As i posted above, just increasing or disabling the unitcap is not working.

                                    1 Reply Last reply Reply Quote 2
                                    • J Offline
                                      jcvjcvjcvjcv @CheeseBerry
                                      last edited by

                                      @cheeseberry said in An "Unlimited Unit Cap" Option:

                                      Don't even get me started on the times in which your teammate gets sniped late in a full-share game and his army gets transferred to two players, not one, because the guy with the highest score didn't have enough unit cap to spare..

                                      That's just to punish people who haven't kept up to date since engi-mod

                                      1 Reply Last reply Reply Quote 0
                                      • LunyshkoL Offline
                                        Lunyshko
                                        last edited by

                                        But we alredy have unlimited unit cap. Dont know if its related to a bug but i see quite a lot my unit cap beung displayed as 0/0 or smh like that and it never ends even uf i do 2k units.

                                        "Good luck and a safe landing commanders!"

                                        1 Reply Last reply Reply Quote 0
                                        • I Offline
                                          iamscope
                                          last edited by iamscope

                                          Cannot delete

                                          1 Reply Last reply Reply Quote 0
                                          • Eternal-E Offline
                                            Eternal-
                                            last edited by Eternal-

                                            If you rich 1.5k then i believe you have around 300 useless engineers on map. And it's only engineers, what about t1 units? T2 units?

                                            Profile | Eternal MOD pack | Check new client

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