IvarK / AntimatterDimensionsSourceCode

MIT License
157 stars 132 forks source link

Save file sizes #1715

Closed WaitingIdly closed 1 year ago

WaitingIdly commented 3 years ago

Describe the issue Currently, our late-game save files are getting quite large. We generally want to keep sizes below 50kb. There are a few suspected causes of bloat, which we should probably deal with. Here is an example of a typical save file starting Celestial 5, and compared with some data removed

Saves Base Save: Celestial 5 Start Save.txt 65.6kb

Removed News.txt 51.9kb (-14kb) (resolved in #1893) Removed Automator.txt 55.9kb (-10kb) Removed Glyphs.txt 58.1kb (-7kb)

Solution player.news is a set that stores a 3-5 length string of every news ticker the player has ever seen, and every ~110 is 1kb. We have ~1400 news tickers. This should be removed, the news ticker and statistics line referencing it should be removed, and should either be changed to temporary storage or the achievement should be changed.

Additional context Save file sizes was brought up in 2019 with #927, but definitely needs to be addressed again.

cyip92 commented 3 years ago

Brought up in #1682, there are a few places where some data which could be stored at arrays are instead stored as objects with numerical keys. For example, player.reality.rebuyables and player.dilation.rebuyables, as well as player.reality.imaginaryRebuyables once #1682 is merged in. There may be more places where this occurs too, and changing them to arrays would trim down the save size a bit more and make the code more readable as well.

cyip92 commented 3 years ago

Suggestion about dealing with news ticker save bloat - with the current 1449 news tickers in the game, we can compress this into an array of 46 numbers using bitmasks. This should significantly reduce the file size impact without needing to remove them.

cyip92 commented 3 years ago

News ticker bloat will be reduced in #1893 by about 80%, but still leaving this issue open in case we want to revisit script and glyph info compression.

cyip92 commented 1 year ago

Looking back on this, we reduced save file impact as much as sensible pre-release and have found that post-release the Cloud saving costs have remained manageable with the increased volume of saves needing to be handled; I think this can be safely closed as resolved at this point.