Working with Saved Game Objects

I’ve been trying to develop a saved game system for my game for several weeks. I don’t know what I’m doing wrong, but I can’t ever get it to work 100% correctly. Can anyone explain the workflow to approaching a saved game system?

I’ve checked out many, many videos on this subject. I feel like I must be missing something fundamental about them.

Perhaps you could share a sample of what you’re working with to see what the issue might be?

It’s important to create the same variables you wish to save on a save game object and then set them from whichever variable they are derived from in a function somewhere most likely situated in the game instance and be sure to “Save Game To Slot” at the end of your logic.

The naming conventions used for your slots have to be matching precisely.

If you wish to then load from the save game you would create another function that would essentially do the inverse of the saving function. Essentially getting the variables from the save game and setting them in the appropriate place such as the game instance from that “Load” function.

I’m not sure how far along you are in your attempts, but this works for me. I can’t say for sure without seeing what could be wrong on your end.

Like @Humanasset says, examples are best, otherwise we’re just guessing. For some reason, the save game causes a lot of confusion. It’s just a file you write to.

Here’s my savegame 101

3 Likes

I’ve been posting for the last few weeks, I know you’ve helped me out on a few things.

It just seems like every time I solve one issue, a new one shows up, so I was kind of hoping that I was just doing something blatantly wrong lol.

1 Like

Perhaps someone can answer me this. If I have a struct that tracks actors in the world, it seems like at times it has no issue remembering these actors, but at others forgets them completely.

For example, the game remembers variables like Lives and Health after the Load Cache function runs, but not ones like Current Checkpoint.


Is there a chance that your game state is loading “Cache Data” from default variables?

Any time you have a level change your game state will reset to default so there’s not a possibility to keep any persisting data unless you are loading from disk. Since the game state is loading on client and server, you’ll have a hard time keeping a ever changing checkpoint variable in sync. I would personally suggest keeping data like checkpoints on the game instance and retrieving it from there via a save game.

Ok, I didn’t know that. It’s supposed to run that Cache Data function each time a change in the level occurs, but if that’s how the Game State works then that could be it.

I’ll try moving it to the game instance, thanks!

1 Like