xNul / palworld-host-save-fix

Fixes the bug which forces a player to create a new character when they already have a save. Useful for migrating maps from co-op to dedicated servers and from one dedicated server to another.
MIT License
885 stars 69 forks source link

Issue with existing users losing character when migrating the host user #26

Open brstillwell opened 8 months ago

brstillwell commented 8 months ago

We put our Coop save onto a dedicated server last night before we ran the fix to update the host ids. While we were waiting a friend who was not part of the Coop save created a new character and has put 12 hours in already. When we used the script to fix the host character, it forced our friend to have to create a new character, but the host was fixed.

So it seems this can be used to fix users who were there for the Coop save by running this with their new Ids. But it breaks users that were not part of the Coop save but had made progress on the Linux server.

Environment: Windows to Linux How we ran it: Pull save files from Linux server to windows PC. Ran the python file to fix the host. Put files back on Linux server.

Is there anyway we can use this to fix the host without breaking current users on the Linux server?

xNul commented 8 months ago

Thanks for the issue. I've seen a couple people saying the script actually caused other players to lose their characters but I wasn't sure it was true until I read your issue. Did you use the version of the script I uploaded six hours ago or the one before? If you used the version that's been available for the last six hours, can you try commenting out lines 102-110 like so:

like so:

#group_ids_len = len(level_json["root"]["properties"]["worldSaveData"]["Struct"]["value"]["Struct"]["GroupSaveDataMap"]["Map"]["value"])
#for i in range(group_ids_len):
#   group_id = level_json["root"]["properties"]["worldSaveData"]["Struct"]["value"]["Struct"]["GroupSaveDataMap"]["Map"]["value"][i]
#   if group_id["value"]["Struct"]["Struct"]["GroupType"]["Enum"]["value"] == "EPalGroupType::Guild":
#      group_raw_data =  group_id["value"]["Struct"]["Struct"]["RawData"]["Array"]["value"]["Base"]["Byte"]["Byte"]
#      raw_data_len = len(group_raw_data)
#      for i in range(raw_data_len-15):
#          if group_raw_data[i:i+16] == old_level_formatted:
#             group_raw_data[i:i+16] = new_level_formatted

and trying to use the script on the host again? It could be related to those changes.

brstillwell commented 8 months ago

Commenting out this code is breaking the server when the person who was not part of the Coop save is joining.

This was ran on the 3 Coop save users and we are able to join with our characters but not in the guild. When that new friend joins he gets stuck on a loading screen then the server crashes. I am assuming it is because an error loading his character.

xNul commented 8 months ago

ok then I guess it isn't related to the new guild fix so it's probably something else. Have you tried having him create a new character then using my script to move his data from his old save to the new one?

brstillwell commented 8 months ago

The strange thing is that he doesn't get a new save. It just wipes his save and starts him over with the same GUID.

xNul commented 8 months ago

Unfortunately I don't have time to debug individual saves so we'll have to wait until someone figures out the cause of the bug and fixes it, or I'm able to finish a parser I'm working on for the byte data to make it easier to understand all of these kinds of bugs and avoid them.

For the future, I'm going to close similar issues and redirect them to mega-issues like this one because I'm just one person and I don't have the time to troubleshoot for all the people using the tool.

xNul commented 8 months ago

Oops, accidentally closed it :)

SpecialAnubis commented 8 months ago

I was redirected here by xNul.

Interestingly, switching to @JannikBirn 's variation of xNuls host save fix, it worked flawlessly first time.

( https://github.com/JannikBirn/palworld-host-save-fix/tree/main?tab=readme-ov-file )

I don't know what is different between his script and @xNul s, But his seemed to work for me. My character remained in tact, as did the original co op hosts. Just putting this here so if anyone is still having trouble with this bug, you can use @JannikBirn script instead for now - as it seems to have fixed the bug already.