How to save the current session to then restore it?

Do you have the blueprints or code you are using?
I use a USaveGame class, and add data into that. I then set the data I want to save (For example, any session info), and call SaveGameToSlot and pass in the USaveGame class I created.

Hi,

So Iā€™ve been working on a multiplayer game. Right now Iā€™m working on the player reconnecting after thereā€™s a disconnect (for example the game crashed or something). I was trying to use blueprints to store the session to which the user connected so that afterwards if the player would restart the game he would be able rejoin the same session.
I am currently using the blueprint SaveGameToSlot and then the LoadGameFromSlot,however I get the error ā€œInvalid session info on search resultā€, which led me to believe that what Iā€™m actually saving is a pointer to the object which doesnā€™t exist anymore since the game was restarted.

That said is there a way to save the session using only blueprints? Or do I have to save it using cpp?

Thanks in advance :slight_smile:

Thatā€™s exactly what Iā€™m doing. I created a SaveGame child blueprint that contains only the BlueprintSessionResult. I then proceed to store it and load it, which seems to be working fine using the SaveGameToSlot and LoadGameFromSlot. Only When I use the loaded session to connect to steam I get the error stating that ā€œInvalid session info on search resultā€.

Found any solution?

For me looks like a Session Result Structure canā€™t be save at a ā€˜save gameā€™.

you should not save any pointers. IMHO, what you need to save is a name of the user and all his relevant data, like inventory, scores, etc. You also need a method of identifying users, like a user name, for example. So when a user gets connected, from his player controller you can get his user name and restore data.

Actually, there is a much better way, unless it is somewhat a persistent world. Unreal has a PlayerState that is automatically saved once a client disconnects. When a player reconnects, its player state can be restored automatically and you can recover your inventory, health, kills, mana, etc. There is a very nice article about it: https://blog.maide.ca/2016/02/26/ue4-persisting-users-across-disconnects/

1 Like

First of all thanks for the answer, however what Iā€™m trying to do is not save the user information but actually save the server information, such as the server ip and other stuff so I can reconnect to the exact same server, since the client will connect previously to a random server.