An "Unlimited Unit Cap" Option

@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 🙂

@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.

@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)

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

There you can talk to all AI devs.

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

@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

@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.

@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

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.

Cannot delete

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?

Cannot delete