FAForever / fa

Lua code for FAF
221 stars 228 forks source link

Allow automatically loading constructed units into constructed transports #6164

Open clyfordv opened 1 month ago

clyfordv commented 1 month ago

Demo of two backend lua widgets for autoloading units in transports. Allows (for example) infinite construction of stingers carrying mech marines.

First widget: If a land factory is assisting an air factory, any non-engineer units from the land factory will be routed to assist the air factory instead of going to the land factories rally point.

Second widget: When an air factory finishes constructing a transport, it checks for the presence of any non-engineer land unit guards. This works independently of the first element; units can be manually ordered to assist a factory and will be loaded into transports in the same manner. Prototype only loads 1 unit per transport, but additional logic can check the size of the transport and load units as appropriate.

Stretch goals: give units assisting an air fac special formations, either a basic square or a more advanced arrangement where they group up with respect the air factory's build queue. Right now they play musical chairs as more units arrive/are loaded, which is workable but distracting and carries all the usual factory assist pathfinding issues.

https://github.com/FAForever/fa/assets/7411478/df2edc70-f0f5-42e0-b008-cca1eb489d9f

See discussion here: https://discord.com/channels/197033481883222026/1144605729911738439

Garanas commented 1 month ago

About the feature: I like it, but I'm also feeling conflicted. I do certainly think it is interesting and novel and I also understand the value. While testing I noticed two problems:

Stretch goals: give units assisting an air fac special formations, either a basic square or a more advanced arrangement where they group up with respect the air factory's build queue. Right now they play musical chairs as more units arrive/are loaded, which is workable but distracting and carries all the usual factory assist pathfinding issues.

While working on https://github.com/FAForever/fa/pull/5908 I noticed that units can have unique guard formations. The property is called GuardFormationName and it is in the AI table section. I assume links to a function name in formations.lua. I think you can experiment with that to create a better, alternative formation.