Closed Romboter closed 1 year ago
I actually really like how you used JSON stringify to just round all the positional data. I assume that also updates railPoints too? I desperately need to clean up the code that uses railPoints. Also, I was actually thinking about converting rotation from radians to degrees so it's even smaller in the save. Not sure how much overhead that'd add.
It'd be neat to keep working on this pr as just a nice little overhaul of saves in general. I might throw some commits on top of this, especially if saves are going to be served from the site in the future.
Yep, it cleans up the railPoints too :)
Definitely some more savings to be had...if its worth the effort post LZMA idk... The numbers below are from manual manipulation of the json to simulate the output to judge savings of each option listed.
Once compressed using lzma the difference in percent is decent between the options but the actual space saved is smol in kb because lzma devman good.
The original save was 80kb and it compresses to 11.2kb Reducing precision to 3 brings it to 8kb Switching to degrees gets it to ~6.5-7kb Going nuclear on text + degrees gets it to ~5.8-6kb
Pre-compression numbers Original - 80kb Reducing precision to 3 - 66kb Going to degrees ~62kb Cutting text to minimum + degrees + precision 3 - ~44kb
Yeah, having shorthand names for all the props, converting building keys to ids, and replacing railpoints so that there's just a single object with the x/y/rotation for the handle seems like a given. Still blows my little mind how LZMA works. It's amazing.
Image data seems like where we'll get heavily beat to death. I'm thinking the only improvement I can add is giving image data ids and storing it outside of entities so that there's no duplicate image data.
This would also be a great time to just plop a little version number on the save. Ray and I talked about this yesterday a bit, and with all these changes this would be a nice time to use it since a lot of the properties will be changed around.
Save files reduced in size by about 15%