Fixing Player Save Data when Transferring Saves Between Windows and Linux Dedicated Servers
The the problem we are trying to solve is that Windows generates player IDs differently than Linux. What this means is that after transferring the save files to the new Linux server, everyone will be seen as new characters instead of old because the IDs are different.
All we need to do is determine what those new IDs are, and then replace the old ID with the new ID in the save files. So the first step is determining what all those new IDs are.
Create Backups In Case of Failure
It is always a good idea to create copies / backups of any file you are going to edit. Any time this guide asks you to change a file, make sure you have a copy of the original in case anything goes wrong.
Vim – just need a text editor for very large json files.
Generate New Player IDs
The easiest thing is probably to use your fresh server install first since it has no characters and have all your players join the server once, making a new character. This character doesn’t matter, so they don’t need to spend any time customizing them. Ideally they pick a character name that makes it easy for you to identify who is who.
If you have already transferred your old saves to the new server and are just trying to fix the players now, it get’s a little more tricky because you have to differentiate between the oldIDs and newIDs in the same Level.sav file by comparing them to old player sav file names to filter out the old from the new. If that doesn’t make sense now, it will by the end of this guide.
Determine Which Players Have Which New IDs
In Saved/SaveGames/0/<ServerID> you will find a Level.sav. Use the python script to turn the Level.sav into Level.sav.json. This is a massive file when converted to something we can edit – goes from something like 7MB to 500MB – so you will need a special editor to change it – many freeze with this file size or change to read-only mode.
In my case, I used vim since it’s free and can pretty much handle whatever you throw at it, but it’s not the most user friendly editor since it’s a terminal text editor. Now open the json file and search for the term ‘NickName’ (‘/NickName’ in vim) and you will find the first player name. Above the nickname is a PlayerUId section.
The value for this section is the new player ID. Write down (case sensitive) the player name and the first 8 characters of the ID (before the first dash and zeros).
Now do this for every character you want to transfer/fix (press n to search forward, or N to search backward in vim).
Determine Which Players Have Which Old IDs
Once you have inventoried all the new player IDs, it is time to do the same thing for the saves you want to fix from the old server. Collect and write down all the old player IDs from the Level.sav from the server you are trying to transfer, creating a reference for each players old and new ID.
Replace Old IDs With New IDs
In vim, you can use ‘:%s/oldID/newID/g’, replacing oldID and newID with the proper values. As an example, since this file records who owns what essentially, one of my old player IDs was replaced over 500 times, so try to do this globally rather than one at a time. Do this for each character you need to fix and then save (‘:wq’ in vim). Now convert the json file back to a sav file using the python script.
Rename Player Saves
Now that the Level.sav is fixed, we need to update all the player sav files. In the same directory as the Level.sav, there is a Players folder. Each file in this folder has the same oldID as the player in our Level.sav. Each of these files needs to be renamed to match the newID. Simply update the first 8 characters with the new ID, in all caps to match the file format.
Fix The ID in the Player Saves
The file names now match the new IDs, but the contents still have oldIDs in them. Use the python script to edit each one, replacing the oldID with the newID, and convert back to a sav file.
Now when you transfer your files over to the new server, players should no longer be asked to create new characters and should be playing the ones from the old server.