GameSaveSystem - Alternate Implementation: Save & Swap

posted in Beals Software
Published April 26, 2015
Advertisement
Github Link: https://github.com/dbeals/GameSaveSystem

The initial implementation of incremental saves is great and I'll be sticking with it for most of my games, but there are instances that it simply isn't a good fit (games that have large save files for example.) So, to get around this I have added a new implementation: save and swap. I want to point out ahead of time that the new implementation does still keep one backup copy. I'll be adding a flag to not create the backup in the next commit; I would have done so now, but I didn't think about it until afterwards. Here's the breakdown of the process, using MySave.sav as the save name:

When you save the first time, it goes directly to MySave.sav.
Every save after that creates a MySave.sav.new.
Once the save has completed, it renames MySave.sav to MySave.sav.bak.
Then it renames MySave.sav.new to MySave.sav.

The new implementation can be found in SwapSaveManagerBase and has pretty much the same interface as the incremental SaveManagerBase - SaveGame(SaveName), LoadGame(SaveName), AutoSave(), Export(ZipFilePath), and Import(ZipFilePath).

As a side note, if you're not keen on using the base classes that I've included, 99% of the work is done via the SafeSaveHelper and SwapSaveHelper static classes. You can download the library and utilize the system with those classes alone.

If there is any other implementations that you can think of, let me know!
Previous Entry GameSaveSystem on GitHub
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement