[Rseding91] [2.0.15] Demolishers take a disproportionate amount of cpu time
[Rseding91] [2.0.15] Demolishers take a disproportionate amount of cpu time
Space Age has somewhat bad performance on my device, so i investigated a bit.
the show-entity-time-usage debug view shows that a disproportionate amount of time is used for AsteroidCollector and SmokeWithTrigger, additionally a big amount of time is used for Inserter.
This is about SmokeWithTrigger. Investigating the game files i found a rather low amount of mentions of smoke-with-trigger. Specifically found some related to demolishers.
To test my theory of demolisher involvement i killed all demolishers using a command. this made SmokeWithTrigger take 0ms in updates and made factorio --benchmark go from 15 to 13 ms.
It therefore seems that demolishers cause a big amount of cpu work even while not useful.
proposals to fix:
* only spawn the smoke if a player or player-controlled entity is close by, alternatively spawn graphical (no-effect) smoke all the time and then switch it once players get close to preserve visuals.
* reduce the amount of time the checks take. right now i assume that each smoke cloud checks each entity for being an enemy and not having the slowdown effect yet. specifically this would consider each segment of the demolisher. to fix that either some faster/better filtering could be used, or, since unlike poison capsules the effect does not stack, a single check could be done for each group of smokes, or both.
the show-entity-time-usage debug view shows that a disproportionate amount of time is used for AsteroidCollector and SmokeWithTrigger, additionally a big amount of time is used for Inserter.
This is about SmokeWithTrigger. Investigating the game files i found a rather low amount of mentions of smoke-with-trigger. Specifically found some related to demolishers.
To test my theory of demolisher involvement i killed all demolishers using a command. this made SmokeWithTrigger take 0ms in updates and made factorio --benchmark go from 15 to 13 ms.
It therefore seems that demolishers cause a big amount of cpu work even while not useful.
proposals to fix:
* only spawn the smoke if a player or player-controlled entity is close by, alternatively spawn graphical (no-effect) smoke all the time and then switch it once players get close to preserve visuals.
* reduce the amount of time the checks take. right now i assume that each smoke cloud checks each entity for being an enemy and not having the slowdown effect yet. specifically this would consider each segment of the demolisher. to fix that either some faster/better filtering could be used, or, since unlike poison capsules the effect does not stack, a single check could be done for each group of smokes, or both.
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
An extension of the proposal is as follows;
A hacky solution is that the generation of the volcanic ash and magma trail is not needed when there are no player controlled entities. Example of behavior where the blue boxed star represents a player structure, and red represents active worms with trails. Grey represents worms without trails been created.
A hacky solution is that the generation of the volcanic ash and magma trail is not needed when there are no player controlled entities. Example of behavior where the blue boxed star represents a player structure, and red represents active worms with trails. Grey represents worms without trails been created.
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
Can you provide a save file that I can test with?
If you want to get ahold of me I'm almost always on Discord.
-
- Manual Inserter
- Posts: 1
- Joined: Sat Nov 09, 2024 11:49 pm
- Contact:
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
Hi Rseding91,
I have noticed this happening on my save (attached)
After killing all demolishers with a command, the ms/tick drops from ~13 to ~8 ->
I have noticed this happening on my save (attached)
After killing all demolishers with a command, the ms/tick drops from ~13 to ~8 ->
- Attachments
-
- space_age_together_79h.zip
- (53.68 MiB) Downloaded 7 times
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
thanks for providing an example, here is the original one, it still has the same issue even though vulcanus is more round.
first upload did not work out, so i deleted surfaces and blueprints, its about half the size now and the upload worked.
first upload did not work out, so i deleted surfaces and blueprints, its about half the size now and the upload worked.
- Attachments
-
- assemblystorm_with_demos.zip
- (79.42 MiB) Downloaded 14 times
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
Very useful thread, I was also wondering also what "SmokeWithTrigger" was.
On our game it's taking up a non-trivial amount of update time: viewtopic.php?f=49&t=121399
(admittedly there are lots of other things taking far more)
Save file attached to that thread. We also have the other culprits mentioned in the OP (inserters and asteroid collectors).
SmokeWithTrigger is taking up the same time as all the assemblers we have going, apparently.
On our game it's taking up a non-trivial amount of update time: viewtopic.php?f=49&t=121399
(admittedly there are lots of other things taking far more)
Save file attached to that thread. We also have the other culprits mentioned in the OP (inserters and asteroid collectors).
SmokeWithTrigger is taking up the same time as all the assemblers we have going, apparently.
- GregoriusT
- Filter Inserter
- Posts: 341
- Joined: Wed Apr 10, 2019 6:42 pm
- Contact:
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
Still the case in 2.0.20 by the way. One of my Friends is having this exact Issue causing Lag.
Don't underestimate Landmines!
Biters bite, Spitters spit, Spawners spawn and Worms... worm? - No, they throw their vomit! They even wind up to directly hurl it at you! friggin Hurlers...
Biters bite, Spitters spit, Spawners spawn and Worms... worm? - No, they throw their vomit! They even wind up to directly hurl it at you! friggin Hurlers...
-
- Fast Inserter
- Posts: 194
- Joined: Sun Oct 05, 2014 6:12 am
- Contact:
Re: [2.0.20] Demolishers take a disproportionate amount of cpu time
Currently [2.0.20], SmokeWithTrigger is eating around 1.2ms when normal in the game, and spikes to over 3ms (over 5ms in a few cases) when someone decides to go attack a demolisher or more and persists until a minute or so after they're dead. That's enough to cause it to drop below 60UPS for some clients, impacting their framerate down to the low single-digits before the UPS itself starts faltering and they build substantial buffer until the game has to be paused for them to catch up or the source of this is killed off and then wait a minute after, though by that point there's a lot of 'wait' built up and a large buffer so interacting with game is rather painful and jerky and extremely delayed when they are trying to, say, run for their life and their character doesn't want to move. This is on computers that handled, for example, a couple of dozen settled planets with very large active factories on ~12 of them with ~40 active ships in Factorio 1.1 Space Exploration without dipping below 60UPS. Even when not under attack the UPS is sustaining at 60UPS on those clients, however their FPS is dropping to between 15 to 35 FPS to keep the UPS at 60 (16 core systems at that, though it seems only 2 cores are in decently heavy use by factorio).
We've been trying to go on a long distance rampage to kill demolishers (attracting via artillery and killing at our base) without spawning more territory to help, and it does seem to be doing though, albeit slowly (there's multiple dozens of demolishers active on Vulcanus currently due to earlier exploration). The server is keeping up (barely it seems, but it is), just some clients aren't even though they aren't on that old of systems (as indicated above).
Closely watching the timings is what led us to the SmokeWithTrigger values spiking at certain times that correlated with the intense lag, and searching on these forums led us to that being the 'cloud' effects at the demolishers, which is what led to us starting to slaughter them from a distance (to not spawn more) and confirming that them using those clouds in force substantially effects UPS. Considering the persistent SmokeWithTrigger costs happening when one is not being attacked, I'm theorizing that they have such an effect around them in general?
SmokeWithTrigger is not the only high value, but it is the highest. The next highest entity timing is inserters and then assemblers at around 1.5ms and 1.3ms, but they don't jerk around and are fairly consistent. Electricity network timing is also up there at 1.2ms if I recall right (we know to keep each surface to 1 electrical network only as spamming electrical networks is a surefire way to lag the game to death, at least in 1.1 and before).
We've been trying to go on a long distance rampage to kill demolishers (attracting via artillery and killing at our base) without spawning more territory to help, and it does seem to be doing though, albeit slowly (there's multiple dozens of demolishers active on Vulcanus currently due to earlier exploration). The server is keeping up (barely it seems, but it is), just some clients aren't even though they aren't on that old of systems (as indicated above).
Closely watching the timings is what led us to the SmokeWithTrigger values spiking at certain times that correlated with the intense lag, and searching on these forums led us to that being the 'cloud' effects at the demolishers, which is what led to us starting to slaughter them from a distance (to not spawn more) and confirming that them using those clouds in force substantially effects UPS. Considering the persistent SmokeWithTrigger costs happening when one is not being attacked, I'm theorizing that they have such an effect around them in general?
SmokeWithTrigger is not the only high value, but it is the highest. The next highest entity timing is inserters and then assemblers at around 1.5ms and 1.3ms, but they don't jerk around and are fairly consistent. Electricity network timing is also up there at 1.2ms if I recall right (we know to keep each surface to 1 electrical network only as spamming electrical networks is a surefire way to lag the game to death, at least in 1.1 and before).
Re: [2.0.20] Demolishers take a disproportionate amount of cpu time
We have exactly the same issues. Yesterday we reached vulcano and explored the planet, if we come now near to a big demolisher, my FPS drops to 5.OvermindDL1 wrote: ↑Tue Nov 19, 2024 7:24 am Currently [2.0.20], SmokeWithTrigger is eating around 1.2ms when normal in the game, and spikes to over 3ms (over 5ms in a few cases) when someone decides to
....
Overall is the performance very bad atm.
Added our savefile
- Attachments
-
- nightraiders.zip
- (78.49 MiB) Downloaded 6 times
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
I looked into the code, I think you should give the demolisher a extra simple hitbox, this clouds with all that triggers and low cooldowns is very overshot.
I am not a game dev and I am not deep in the factorio modding, but this cloud stuff with expending and repeats - combined with a nested collision actions seems not a good way to design it. I think you have to refactor this part and add very simple hitboxes around that enemy that just stick to it.
I don't know if that helps. Sry if not.
I am not a game dev and I am not deep in the factorio modding, but this cloud stuff with expending and repeats - combined with a nested collision actions seems not a good way to design it. I think you have to refactor this part and add very simple hitboxes around that enemy that just stick to it.
I don't know if that helps. Sry if not.
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
+1 for the bug, I'm playing on a laptop and smoke with trigger takes around the same time as inserters (~1.5ms) (while I'm on navius too...), it tanks my already poor performance a lot
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
We’ve identified the reason they’re taking as much CPU time as they are but we haven’t had time to work on them yet. Crashes, desyncs, and other game features not working correctly have taken priority.
If you want to get ahold of me I'm almost always on Discord.
- BlueTemplar
- Smart Inserter
- Posts: 3173
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: [2.0.20] Demolishers take a disproportionate amount of cpu time
Meanwhile, sounds like despawning chunks (hopefully taking demolishers with them) might help here ?OvermindDL1 wrote: ↑Tue Nov 19, 2024 7:24 am [...]
We've been trying to go on a long distance rampage to kill demolishers (attracting via artillery and killing at our base) without spawning more territory to help, and it does seem to be doing though, albeit slowly (there's multiple dozens of demolishers active on Vulcanus currently due to earlier exploration). The server is keeping up (barely it seems, but it is), just some clients aren't even though they aren't on that old of systems (as indicated above).
[...]
mods or commands
BobDiggity (mod-scenario-pack)
-
- Fast Inserter
- Posts: 194
- Joined: Sun Oct 05, 2014 6:12 am
- Contact:
Re: [Rseding91] [2.0.20] Demolishers take a disproportionate amount of cpu time
Sadly no mods or commands here, it's a completely vanilla server with no admin access to /c (to keep achievements for those that like going for them).
And yeah, as demolishers are killed, more ones spawn further out, and they all load back in when the game is loaded (didn't it used to be just 'active' chunks loaded back in, like ones with pollution or 'near to player entities', not "all" like vulcanus seems to do?).
EDIT: But yeah, I can't really play well on it anymore, my 'buffer' size just kind of constantly grows as my FPS drops to 6fps (guessing 10% is a cutoff internally of reduction?) while UPS hovers around like 58UPS until I eventually drop. Which is funny because the computer running the client is both more powerful and has more cores (and is much newer) than the dedicated server (which I picked specifically because it was slow just so it would slow down before dropping other people, which isn't happening as it keeps up fine...)
And yeah, as demolishers are killed, more ones spawn further out, and they all load back in when the game is loaded (didn't it used to be just 'active' chunks loaded back in, like ones with pollution or 'near to player entities', not "all" like vulcanus seems to do?).
EDIT: But yeah, I can't really play well on it anymore, my 'buffer' size just kind of constantly grows as my FPS drops to 6fps (guessing 10% is a cutoff internally of reduction?) while UPS hovers around like 58UPS until I eventually drop. Which is funny because the computer running the client is both more powerful and has more cores (and is much newer) than the dedicated server (which I picked specifically because it was slow just so it would slow down before dropping other people, which isn't happening as it keeps up fine...)
Re: [2.0.15] Demolishers take a disproportionate amount of cpu time
hey totally understand that priorization, but just to be clear: this is almost the entire entity update time early game (~60 spm, nauvis, vulcanus, gleba).
lategame it is about 10%. so this is not just some minor performance issue.