Page 1 of 1

Exclude data from save game?

Posted: Mon Jan 08, 2018 2:46 pm
by suan2
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.

Re: Exclude data from save game?

Posted: Mon Jan 08, 2018 3:09 pm
by eradicator
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 :P).