I wrote a mod which stores quite a lot of data for each entity it in the game. When the factory becomes big (say 10k entities) it becomes slow to save and load the game. Around 20 seconds for 10k entities. The save file is not too big, 2 MB compressed, the "script.dat" inside the save file is 26 MB for the 10k entities.
Most of the data my mod keeps in memory are easy to recalculate so not necessary to save into the save file. Is there any way to exclude some data from the save game? I'm looking for something similar to the "transient" keyword in Java.
Exclude data from save game?
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Exclude data from save game?
Anything saved to the global table named "global" (i.e. _ENV.global) is stored into the savegame. All other variables are not. Recalcuation is only a good idea if it happens distributed over many ticks though (just warning you to not try to recalculate a huge bunch of stuff right after loading ).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.