Friday Facts #326 - Particle emitter & Data cache

Regular reports on Factorio development.
Filter Inserter
Filter Inserter
Posts: 722
Joined: Thu Oct 03, 2019 7:10 am

Re: Friday Facts #326 - Particle emitter & Data cache

Post by Honktown »

AndrewIRL wrote:
Sat Dec 28, 2019 10:48 am
Startup time - Data Cache

Sounds awesome, would love to see a speedup in modded games. With the wrong settings in:
eg 255 wide by 255 high chests allowed

the game startup time can be as long as 20-30 minutes. Not seconds, that's not a typo, minutes.

Code: Select all

Approximation for total memory usage is: "20 x N x N x M x M" bytes, where N is max width and M is maximum height. Couple of examples of memory usages if max width and height is set to same number:
N=42 (default) => 62MB
N=100 => 2GB
N=256 => 85GB
N=1000 => 20TB
You playing on a server with that kind of ram needed, buddy?

I wonder where the speed-up is occurring. If the cache was one big block of graphics, that wouldn't compress very well and may need gigabytes on disk. If it was just optimized offsets/pointers (like defragmenting), that makes sense. A command-line parameter which only generates the cache could be useful, so the game doesn't need to be fully started and the cache can be generated at any time (for the super modders, generate the cache on a schedule when you're sleeping and it'd be ready every morning!). Hmmmm if we know where the cache is stored, one could back it up or even share it for different mod/version configurations. Couldn't share if there were hardware details needed, but backing it up could let you could add or remove mods, and if there was a matching cache already, use that instead of recalculating.
I have mods! I guess!

Fast Inserter
Fast Inserter
Posts: 237
Joined: Fri Mar 24, 2017 2:17 pm

Re: Friday Facts #326 - Particle emitter & Data cache

Post by AndrewIRL »

Honktown wrote:
Sat Dec 28, 2019 1:10 pm
You playing on a server with that kind of ram needed, buddy?
It was peer to peer and I had joined someone else's game. After the sync and restart I noticed it took 20+ minutes. I asked the guy about it and he said it was the WideChests. Thanks for this info about RAM usage, explains a lot!

Posts: 21
Joined: Wed Jan 09, 2019 12:02 am

Re: Friday Facts #326 - Particle emitter & Data cache

Post by JekoRhino »

Allaizn wrote:
Fri Dec 20, 2019 3:31 pm
JekoRhino wrote:
Fri Dec 20, 2019 3:14 pm
What about particles that come from Sources(Emitters) off screen?
Say you have Assemblers all around the out side the Red Box(view screen)
and you move in any direction. Will the Particles just appear
or would you see the Assembler exploding when moving there.

Question is based on the Animation where no particles
from out side the Box are rendered or was this
just a example of how it would work.
I see two separate questions here:
1. How is it handled if an offscreen emitter would be able to create particles that fly into the screen area?
Answer to that is that the emitter is restricted to only create particles up to 16 tiles away from itself. For rendering we then don't use the screen rectangle itself to search for the emitters, but a rectangle that's larger by 16 tiles in each direction (plus some extra to allow account for height).
2. How is it handled if an offscreen emitter comes into view range?
The emitter retroactively creates it's particles and then renders them on the position they should be right now if they would have been created immediately when the assembler exploded.

In other words: particles managed by an emitter and "normal" particles that were defined to look the same should always act the same visually (unless I put a bug in there by accident) - including things like save & reload, going offscreen and onscreen again and zoom-to-map. The only difference is that the emitter's lua definition is somewhat more restrictive than the lua definition for a particle.
JekoRhino wrote:
Fri Dec 20, 2019 3:14 pm
Have a nice Christmas break everyone!
Thank you, have a nice time, too!
Thanks for your Answer!
I'm allays exited for in depth programming Explanations
and I wasn't sure if that's even possible to calculate it for every particle.
Seems like a lot to me, but I guess that's handled by the GPU
and particle don't stay that long too. :D

Post Reply

Return to “News”

Who is online

Users browsing this forum: No registered users