Help with save data.

Hi All

I have a game with lots of arrays - 12 at the point, more to come. all need to saved, possible about 80+ VAR that also need to be saved.

How would I go about this?

Do i replicate every array and variable in the save game file. Then on load replace all that data that auto fills when game starts.

Never played with save/load yet.

Hey,

so i guess you want to use the Blueprint Savegames? You could do multiple things. Using the SaveGameClass is the first step. You don’t have to use one class for all your SaveGameData, but putting most of it together would be helpful. For example one Class for GameSettings, one Class for CharacterProperties etc.

Then you need to think about the part where it is needed to load the data. GameSettings should be loaded when the GameStarts, so i would place this in the “GameInstance” class. You can create your own and set it in Maps and Nodes like the GameMode and the rest of the classes. This class persists so it would be the best to save your Settings there (you can use them in your menu and gamelevel without saving them in between the level changes).

For Character related things it would be better to find a place where you actualy load the game. If the player selects a save slot before starting the game, i would just save the Slotname and carry it over to the new level in the GameInstance again. Then, when your real game starts, i would get the SaveGameFile in fill in the Data back to the character. Using Structs for all the Character Properties which you can reuse inside of your SaveGame makes it easy, because you just need to plugin this one struct variable.

NODE: The GameInstance class has no “BeginPlay”, but “ReceiveInit” which works the same. It also has “ReceiveShutdown” for the event of closing the game.

NODE2: It is also a good thing to create your savegame objects only once, and not every you save or load. Create them, save them in a variable and reuse them. This helps you by saving only one variable, because the rest is already filled, otherwise you would always need to fill the new created savegameobject with all variables, only to overrite one property.

If you need more information, feel free to ask me.

Thanks for a detailed answer eXi.

Will play around and get back when I have more of an idea :slight_smile:

You are welcome. I will convert the comment to an answer and leave it open. Feel free to accept it or ask me if you need something.