[1.1.x] Hidden script rendered shapes are still being checked in preparation loop

Bugs that are actually features.
Post Reply
DBotThePony
Inserter
Inserter
Posts: 28
Joined: Tue Mar 12, 2019 4:50 am
Contact:

[1.1.x] Hidden script rendered shapes are still being checked in preparation loop

Post by DBotThePony »

Not a bug, bug design oversight.

Rendering library shapes which are hidden (set_visible false) still checked in main render loop, which is pointless, because it is clear that they won't even get drawn until getting un-hidden by scripts, and to me looks like nobody bothered or even thought doing this tiny optimisation.

This raise "Script render preparation" time with my mod: https://mods.factorio.com/mod/shield-generators, despite 99% of shapes are being invisible.

If you want to test against my mod, grab version 0.1.2, because 0.1.4 destroy rendering objects (and recreate them later) instead of hiding them to workaround this issue.
factorio_zFDuyaZ6Me.png
factorio_zFDuyaZ6Me.png (62.9 KiB) Viewed 1193 times
Last edited by DBotThePony on Tue May 11, 2021 12:21 pm, edited 2 times in total.

KeepResearchinSpoons
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Tue Dec 01, 2020 6:57 pm
Contact:

Re: [1.1.x] Hidden script rendered shapes are still being checked in preparation loop

Post by KeepResearchinSpoons »

same thing with alt-view;
if you go with a "custom grid", should you need a 3x3 one or something, I can give you the code, it is exactly as you say.
It does NOT change "script preparation" whether an alt view is enabled.
It is even more deadly if you have an alt view with a detail-augmented copy.

On a side note, this api is not ready for anything big anyways.
If you go for the said 3x3 or 2x2 grid charted on the ground, using lines is... somewhat fine. A bit costly but well still tolerable.
But should you want to have a void-padded rects that are a bit smaller than a 2x2/3x3 cell,
AND use "just" a lot of rectangles with an option "no fill"...
Welcome are all the lags.

And I am not even talking about per-player overlay level here, just a global fully static all-players one.
*Just* 256 rects per chunk (2x2 grid) is apparently enough to push the fps clock to its max and meet some first lags for my side.

((for a test, add a rendering.create_rect at x%2==0, y%2==0 to the on_chunk and you shall see how fast it degrades the fps))

And the worst part, it does not help to "clean" all the other part of the map player should no be able to see either.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.x] Hidden script rendered shapes are still being checked in preparation loop

Post by Rseding91 »

Thanks for the report. This is known behavior and there's currently nothing we can do about it.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”