Methods for saving/loading with multiple users and multiple game types

Hey guys,

I could use some help planning out my save system.

Suppose you have a racing game. You can have multiple user profiles (named save slots).

For each user profile, they can save their progress for multiple types of races. For instance, UserA plays Race1, saves and quits. Then he playes CareerMode1, saves and quits.

Then player switches to User2, which is a new save slot. The saved data for Race1 and CareerMode1 should not be accessed by this user.

So the question is, what is the least convoluted way for me to filter user save slots and specific race data.

My plan is this:

User profiles are a named save slot. A string.

When a race is started, get the user name and append to the race name. e.g. User1 + race5 = User1race5. This is a new save slot and it writes to a specific save object that holds race data struct.

Then, suppose I am on User2 save slot, say I bring up UI that shows races I have saved, it would get each race name, append the current save slot name (user2) to it, and check and see if a save game with that name exist?

Does that make sense? Seems kind of convoluted - i wonder if there is something I am missing that oculd make things easier to test and manage.


It seems to work pretty well and is not too complicated actually. I’ve made a text-game test project like this:

By simply appending the current save slot to the race name, it acts as the filter that I needed.

Then, all the races are held in a map. The map is like this: race name / race data.

For testing, race data is just a single int that gets randomized. But this should be able to be replaced with a struct, no problem.

I am using a unique save game object for saving race data. And then I’ll use another unique type of save game object to save career data, player data, and so on. So the type of save game object filters for type of data that I want to save.

So to summarize, to filter type of data to be saved, i use a custom save game object.
To filter data within those save objects, I append the save slot name to strings which are keys to a map which holds associated data.

In effect, there is only two layers of filtering I need to remember when dealing with save/load, which should make for easy-to-manage system. Could save/load could get simpler than this?

Besides manageability, you might think there could be some performance concerns. Of course I’ll just have to wait and see if there is any problem, but I doubt it because of the nature of the game. The only things we are saving is one actor with a few variables, plus a few strings/floats associated with each race.

If anybody has second opinions it might help a lot. Thanks.