Should I store all my stats vars in the save game object?

I’m redoing my whole save game system, and things like player character HP, experience, inventory etc are stored in my player character BP, and when I want to save / load, I got to have a function to copy all those values to variables in my save game BP, then on loading push those vars back into my player character.

Shouldn’t I instead just keep them stored directly in my save game BP vars? this way I wouldn’t need to pull and push values every time, would just need to use “save game to slot” and “load game from slot” nodes.

what is the best practice?

Yeah you can use structs in your save game blueprint, that would be smart :blush: and you can also consider having a custom game instance

What you’re doing right now is the typical way that save games are handled.

The primary reason is that needs of the data are completely different for your runtime and your save game. You may have cached values or acceleration structures that don’t/shouldn’t get saved and can easily be rebuilt on load. It’s much easier to write your game logic using data that is local to, say, an actor or the ai controller than it is to try and route all that information through a save game. And on the savegame side you’re usually erring on the side of compactness and have to (eventually/maybe) worry about versioning and backwards compatibility.

There are ways to automate some of this logic, though they do require doing work in C++ as they are not available to blueprint. But even in blueprint you can easily isolate that logic you’re talking about into a couple functions.

1 Like