[1.1.70] Prolonged lag from particles.

Bugs that are actually features.
Post Reply
FoxLBA
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon May 01, 2017 6:45 pm
Contact:

[1.1.70] Prolonged lag from particles.

Post by FoxLBA »

Mod Krastorio 2 has a grenade with a virus against biters, when using which there is a prolonged droop in performance. I can understand the performance drop due to the script (which actually kills half of the enemies on the map), but the debug option shows that much more time is spent on particle processing.
I find it strange that particles affect performance so much (What's with the particles turned on, what's with the particles turned off).

I did a check without mods as follows.
I created a new map with a lot of enemies (~60k) and ran a simple script:

Code: Select all

/c for _, entity in pairs(game.player.surface.find_entities_filtered({force="enemy"})) do entity.die() end
As a result (in the screenshot), the frieze lasts for a couple of seconds, after which the UPS drops to less than 2 within a minute (approximately).
particles.png
particles.png (4.16 MiB) Viewed 959 times
For control, I changed the method from "die" to "destroy":

Code: Select all

/c for _, entity in pairs(game.player.surface.find_entities_filtered({force="enemy"})) do entity.destroy() end
As a result, the freeze for a couple of seconds and after the normal speed of the game.


Apparently, the "destroy" method is not used by the mod, since this method does not update statistics and does not raise the desired event.


Save file just in case.
Attachments
factorio-current.log
(6.83 KiB) Downloaded 27 times

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

Re: [1.1.70] Prolonged lag from particles.

Post by Rseding91 »

Thanks for the report however that's all working correctly. When something dies it generates the death blood particles. Those fade out after a few seconds. If you do that to a large number of biters on the map they will make a large number of particles all at once. They will eventually go away after some time (depends on how long the mod set them to expire).
If you want to get ahold of me I'm almost always on Discord.

FoxLBA
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon May 01, 2017 6:45 pm
Contact:

Re: [1.1.70] Prolonged lag from particles.

Post by FoxLBA »

Is it possible to add the "no particles" option to the "entity.die()" method?

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

Re: [1.1.70] Prolonged lag from particles.

Post by Rseding91 »

FoxLBA wrote:
Sun Oct 23, 2022 9:24 pm
Is it possible to add the "no particles" option to the "entity.die()" method?
No. The nature of particles aren't meant to live long. So if some mod is making them live super long you need to complain to the author.
If you want to get ahold of me I'm almost always on Discord.

FoxLBA
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon May 01, 2017 6:45 pm
Contact:

Re: [1.1.70] Prolonged lag from particles.

Post by FoxLBA »

Rseding91 wrote:
Sun Oct 23, 2022 10:29 pm
So if some mod is making them live super long you need to complain to the author.
Does this mean that I should complain to the authors of the "base" mod? 😅

The problem is not that particles live for a long time, but that there are too many particles at the same time and there is no limit on the number of their creation. And also there is no way how to separate the necessary functions from the creation of particles (for example, during the mass cleaning of the map).

I'll look into the "ideas and suggestions" branch and add a suggestion about the above API call (if no one suggested it, of course).

Thank you for the answers.

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

Re: [1.1.70] Prolonged lag from particles.

Post by Rseding91 »

Just wait it out. The particles go away after about a minute for me on my laptop which isn't super powerful.

You really aren't supposed to be killing half of all biters on a map in the same tick :D The only way to ever do that is via console commands or through mods essentially doing the same.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”