NokiMo
Slimechemy
Slimechemy

patreon


Saving not saving

As the work on cleaning up and improving the release goes on, I've made some improvements (If you're on Discord, you might've seen some), but today we'll talk about saving and loading. I've already said before that it's one feature I'm scared of the most, as it includes a lot of reconstituting the state of the world and there's always something going wrong! Well, that time came again, as per a bug report I've went and checked the status of saving, and the thing I've suspected to break the least, was actually the worst!

The world composition saves and loads fine, the inventory was seemingly fine, but the store inventory was broken! The number of items for sale was correct, but the actual items were all blanks (so now you know how a blank item looks like). As I went deeper to find the issue, I've discovered that my logic was sound, it's just the implementation was a little bit wrong. Turns out you can't save object references. Rather, you can, but it's ultimately useless, since the object will cease to exist and you're only keeping references, and not the actual objects in their entirety!

So instead of saving object, you need to save all of the information about them and then re-create them and assign all of their properties back to them (probably the least fun part of the save system, I shudder to think at the amount of stuff you have to do to save in bigger games).

And the reason the inventory seemed to work was because I did not actually purge the inventory when loading the game and since the incoming inventory was empty it did not do anything. 

Figuring this out, I've changed up the save-load system, added more checks and solved that issue (also picked up some minor discrepancies when loading the game)

And all was well, except for one little thing. While the saves from the preview would work on 0.8 and I can re-create the store inventory, your inventory and upgrades won't load as there is no(not sure if completely) information about them in the save file. Now, the good news is, your gallery unlocks will work just fine now and in future versions.

Again, I'm very sorry about this, but it should be fixed now, along with some other annoying couple of bugs. Keep your eyes peeled for the release with new QoL features, animation fixes and bugfixes out soon!

Saving not saving

Related Creators