Seamless Travel - Persisting Data

   @KingOfProgramz

The way I do it roughly is:

  1. Before quitting the game, or loading a new level or whatever, in each players state, I gather all data I want to be saved about that player and put it in a single struct (including name, steam id, stats, progress, location, class etc etc) (lets call it PlayerStruct)

  2. The server loops through each player state, gets the newly updated player struct and saves it in an array of PlayerStructs. I then save that Array of PlayerStructs to a file.

  3. When a new level opens or a game is continued or whatever, every connected player checks their game instance (since clients only see their instance) and sends their own name and/or steamid to the server.

  4. On the server, compare every connected players name and/or steamid with every saved index in the array of PlayerStructs from step 2. I basically get each saved player struct, one at a time, break the required info output and compare it to the current player.

  5. If a match is found, send the data to the matching players playerstate.

  6. Repeat from step 1 when required.

Sorry for my late reply :slight_smile: I just saw a notification here now.

1 Like