I am using a multiplayer setup with a dedicated server. I have a savegame object that is used ONLY by my server to save the state of the game so information will persist between plays. The savegame object contains a struct.
This works fine for a while. I am able to load from the savegame and overwrite it when I am done. However, after [something] (I’m not sure what the conditions are for this), I am no longer able to overwrite the savegame. I can still load from it fine and the struct seems intact. But when I execute a “Save Game in Slot”, it returns false.
I don’t know why it might fail to save the game so I tried calling “Delete Game in Slot” first … but that returns false too! So I can’t save to this file and I can’t delete it. The only “workaround” I’ve come up with is to manually navigate to the file in Windows Explorer and delete it. Then “Save Game in Slot” will work again but I’ve lost all my old data.
I need these saves to be reliable and I have no real way of debugging this. How can I handle this situation?
The events “AddAbility” and “DestroyAbility” are called from other blueprints. Both modify the “Abilities” array and call “Save Ability List”.
That section off of the False in the branch node there was my attempt at deleting/re-saving the savegame if it fails to work for some reason but that never worked. It always prints “Failed to delete save game” and “Does slot exist? True”.
But I want to reiterate, that “Save Game to Slot” doesn’t always fail. I’m not sure under what conditions this suddenly starts failing, it has happened without me having made any changes to Abilities or the SaveGame object. I thought it might be related to using the same SaveGame both in Play in Editor and by running the dedicated server VIA command line outside the editor but it’s just a guess.
I’m starting to think that maybe SaveGame objects are not what I should be using for this kind of data. But also … if this SaveGame object has issues sporadically, won’t my player SaveGame objects also have issues? I’d like to find a root cause. Ok I’m rambling too much.