[Multiplayer] How to Save Player Variables such as playerName and playerScore inbetween maps via server travel

I struggled a lot with this too, but in the end I ended up storing all the player variables I wanted to transfer in a “PlayerInfo” struct in the Player Controller, keeping that struct updated in the Game Mode and putting each players struct in a Map where the keys are strings with player names.

When its time to server travel I store that map in the Game Instance which is persistant across maps, then read it on the other side linking each player to their PlayerInfo struct using their name.

Edit: here are some pictures from my blueprints (sorry if a bit messy)

Update each players struct in the Game Mode BP every time you make a change

Then go through the Player Controller to access the game instance and store the Map variable

In the Game Instance

Then after you server travel

Get the map variable in the Game State BP

and finally from there, you should be able to access the Map variable with with the new Player Controllers

It should be noted I use the Advanced Sessions Plugin for steam to get player names and in shipped products its probably better to use uniqueID strings instead.
Hope this helps!

1 Like