[Optimization] Lamp performance improvement
Posted: Tue Aug 30, 2022 8:12 pm
TL;DR
Lamp optimization; change them to work entirely like solar panels to further reduce their performance impact, adjust visuals slightly to accomodate.Note: This suggestion applies to normal, non-circuited lamps only. Circuited lamps can't be optimized as I am about to suggest and should remain as-is.
Why, aren't lamps already optimized ?
Yes; A few years ago, lamps got optimized as described in Friday Facts #229. This was a good change which made lamps much more performant.Unfortunately, there is still a little performance impact. It's small, but the electric network updates can still add up when lamps are turning on/off:
![Image](https://forums.factorio.com/images/ext/1ccd29fb7ce128e7a4d7dc36be4309b2.png)
140,000 lamps is quite a lot. But real factories can still use enough lamps to cause noticeable lag. As a example, here's the # of lamps on a MP server where they're used only sparingly:
![Image](https://forums.factorio.com/images/ext/007c25c8c62a76d9ec001b36eacd406f.png)
With more consistent usage, there could be tens of thousands or more.
Given this, I think that investing a bit more effort to further optimize them would be a good idea.
How? They're already optimized very well.
As is, yes, they can't really be improved further without creating a disconnect between visuals and gameplay. If you remove the connection between visual appearance and the actual power consumption, a observant player would notice the discrepancy while watching the power graph at nightfall. This would be a problem even if you made the power consumption gradually increase or similar.And it wouldn't be good to remove the staggered lighting-up of the lamps, because it looks quite nice.
But there's a third option: change the visual appearance a little.
![Image](https://forums.factorio.com/images/ext/7ba72b56a94103f758c28c84d29933ff.gif)
Instead of instant-on, instant-off, give them a visual warm-up period. This should probably still be staggered so groups of lights have more visual distinctiveness.
With a warm-up period, it's much less obvious that the lamp isn't perfectly synchronized with it's power consumption. This allows it to be switched over to solar panel-like consumption:
![Image](https://forums.factorio.com/images/ext/2c35319697ebdff31e9c55147777a96c.gif)
And done! Zero UPS-impact lamps! Safe to pave a factory with.