Is SaveGame Compatibility generally just bad?

I’m using several structs for my savegame class. Normal stuff. Now after changing things up inside one of my structs. The savegame file cannot be loaded anymore and returns an invalid value when trying. I never checked any of the “Save Game” check-boxes for any of my structs. It says something about serialization and I honestly have no idea what that means or does.

Do I always need to serialize structs for my saved games (check “Save Game”), in order to have 100% compatibility between any changes done inside structs? Do savegames generally corrupt for silly reasons and aren’t reliable?

Example Struct in use:

dude go into unreal and delete the save file the old data can be removed if you dont need it, generally that is how i clean my save files

For you it would be the thing your save game to slot is saving it as.
Retry it after that and let me know if something else is having an issue, always create back ups and or dont delete files untill your sure it needs to or not.

1 Like

Save Games are a bit fickle, you can generally add stuff to it, but if you change or delete something within the variable is not read the same

Say for instance you save a vector for “location” , Delete it and make another and call it “PlayerLocation”

Inside the actual save file it might save something like

00x000001 = 0,0,0
Then when you make the new variable although used in the exact same way, Might save as something differently internally
00a000002 = 0,0,0

When you go to load the old save game where it used to be called location before it was deleted and added again as PlayerLocation
it’s gonna look for the information at 00a000002 instead of the actual location of 00x0000001

This is of course an oversimplification of what’s happening and i don’t pretend to know half of it… this is my assumption, i do know however if you just rename things it’s fine because it’s using pointers and such behind the scenes, and adding stuff it doesn’t care that information will just be empty on old saves where it didn’t exist

Some stuff worth looking at

1 Like

if you’re serializing you do need to check SaveGame on both the struct and the values.

if you’re just saving the struct in blueprint you dont need to, but blueprint structs can be buggy when you change the struct.

1 Like

Alright so you pretty much never change anything and just add on top from what I understand. I did indeed change data inside structs (rename enums etc.) and this probably caused it to become incompatible.

@Auran131 Serializing is pretty much a must then for save games? Will it effectively prevent issues if I rename/move struct data though or what advantage does it actually give in comparison to not using it for saved games?

Serialization is 100x better in my opinion. that said it likely doesnt work when you modifiy a struct.

Although surely you’re only modifying the struct while still in production and not post release? so kinda irrelevant?

@Nightwolf link is very good to watch

the advantage is its somewhat automated using the SaveGame property and can find properties by its unique name, so for instance if i rename a variable it still works.

this also means it can save inherited data from child classes, without changing the savegame logic.

you can still you saved games though, you just serialize the data then save it to the savegame object.

Yeah I’m still in production but this whole experience left a bitter taste. This would’ve been a nightmare if it happened after release.

Right now I’m kind of split on what to do. UE’s SaveGame system really doesn’t seem reliable at all so I might resort to using the official JSON plugin, convert to string, encrypt and save string to file (free custom plugins exist for all of those steps). There might be problems with console support down the line though.

Always up for recommendations. Keep in mind that I’m BP-Only though.
Thanks for the help so far! :slight_smile:

ive got a plugin that can serialize for you in the near, just waiting to upload tutorial videos.

the save system seems ok to me, its just you’d never want to load old data, could lead to corruption on unexpected behaviour.

that said BP structs are dodgy as :open_mouth:

both structs and save systems really need to be one of the last things you implement as you don’t know what you’re doing with them until the design is finalized.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.