So, I am making a sandbox game and need to make a save system that can basically store the entire save state. I understand the basic idea that I can in theory serialize a bunch of data into a file and then take it out again in the same order but theres a few caveats im curious about:
-
Platform independence. While not extremely important, it would be nice to know that saves can be transferred just fine. I understand that different systems store data differently, so just using
readorwriteor<</>>on a struct it will depend on how the compiler/system organizes the bits. (big endian vs small, and maybe other things?). Im thinking the way to solve this is probably some library -
Corruption. Idk how big of an issue this is or if I should even worry about it, but if the data is somehow corrupted I probably don't want to load it since it might cause big errors
-
Version independence. This is the most problematic to me. I don't need to seriously worry about it until(unless) I actually release and have players but I'd like to start with this in mind. When I update the game, I'd want old saves to always work on new versions (tho not vice versa). The only way I can think to do this is to futureproof the system for any changes I might make to the game (impossible) or maintain a seperate save loader for every major version of the system I make. Maybe theres a better way? I wonder how most games deal with it.
Any help or insight is appreciated, thanks!