Jump to content
  • Advertisement
  • entries
  • comments
  • views

GameSaveSystem - Alternate Implementation: Save & Swap

Sign in to follow this  


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!
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!