@ftxcommando said in Removal of the Blinking lights:
@jip said in Removal of the Blinking lights:
it blocks the implementation of another feature that will be another performance saver: the keeping track of energy to disable / enable intel / shields / stealth with maintenance.
This sounds like implementing an auto pause on things that cost energy to maintain when you stall?
No, allow me to explain. Currently there are loops such as these:
- For shields: https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/shield.lua#L697
- For intel: https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/sim/Unit.lua#L2853
Each unit has their own loop running, continuously (read: every tick for shields, and every five ticks for intel) checking throughout the game whether or not you, as a player, have the energy in storage to sustain the shield or intel. When you don't, the loop breaks and the shield / intel is turned off (but still consumes maintenance)
This is a bit of a waste, especially late game when there can be a hundred to a thousand of units doing these checks. A few examples of units that rely on these checks:
- Any unit that has a shield that relies on maintenance: static shields, mobile shields, personal shields
- Any unit that has intel that relies on maintenance: mole, stealth fields, radars, Cybran ASF
I've been wondering myself: what is going on when we're running at my -1 on Setons Clutch, but there's no battles, just units existing and being created?
And one of the previous answers were Cybran build bots. Now the answer is blinking lights (to a lesser degree, of course) and these shield / intel threads that continuously query the brain and the unit to check if they can be sustained or not.
I'd like to re-use the implementation of the blinking lights (it doesn't allow for multiple triggers at once ) to remove and* replace all of these threads of individual units. Instead of having each unit check individually, we check once using this built-in trigger system and turn off (but still consumes maintenance) all the maintenance-based units. Then, once the player has more than 5% energy in storage (or some other arbitrary threshold) the units are enabled again, where intel is enabled immediately and shields first have to recharge.
With this new implementation we'd also prevent the 'blinking on and off' of shields and intel when you have no power. Instead, they remain off (but still consume maintenance until toggled off) until you actually have something in storage again. This can happen when you have missile-building structures, such as SMD, SML and TML.
To sum it up: I'd like to re-use the triggers of the blinking lights to do something more meaningful .
edit: I can't type early in the morning :sad_cowboy: