My Save System is not working when exported

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By glaedr0173

Has anyone dealt with Godot on Steam? I released my game but I noticed that if I save and either go back to the title screen or quit application, then relaunch and continue the save. It is all messed up, but if I run through debug in the editor it behaves perfectly. So its only messed up through steam. Anyone have experience with this? I followed GDQuest’s tutorial. Here is my SaveManager script. If i run the exported .exe, its the same problem so the issue must be through exporting. I have testing it with the steam export template and with no export template at all. Same thing. https://youtu.be/j-tvtDcoTJ8 https://pastebin.com/AqQZ1amT

I can only give you ideas, the code looks fine:
1 - Have you tried to disable encryption and open the savefile saved on users folder, maybe some information was saved wrong or the encryption did something? I see you had password variable on the top of the script.
2 - So it happens if your run the exported .exe, that could mean that a file was not exported correctly, if you have any special files like .txt or else, they will not be exported. I don’t know currently how is the behavior, but I renamed my font license .txt files to .tres to force godot to import and export them, it gives some errors but it does export them.
3 - Try to debug it by requesting a constant string on the savefile or the character name.
4 - Maybe analyze what was exported, for that you could try to unpack your exported project.

The_Black_Chess_King | 2021-10-31 17:33

I couple of debugging suggestions I can give are to trace around the save folder. From the errors at the end of the video I assume this is some sort of can’t find or open the file on the system error. It shouldn’t work at all if it is that though, but I have seen stranger things work. Saving to the user://, on a windows machine will be in the user/appdata/godot/“yourproject”, as the base.

One thing on the path, that shouldn’t matter but you never know is that the plus_file() method on the string class appends an “/” onto the file name as part of the function. I would be surprised if that messed things up though. You can easily test out a change by just adding the strings. i.e.

 var save_path = Save_Folder + Save_name_template

I would delete the existing user:// data you have to start from scratch and see if everything still works on your box as well.

If the file path and all that is working fine, it might be in how you are storing all the data. Have you diffed the .dat files to see what is different after starting a new game and saving the same state data at the beginning? If you are producing the same dat files consistently are basically the same from a beginning of game save, then it is probably not anything to do with the loading and saving of the data from files. And might be how all the data is being interpreted down the line.

r.bailey | 2021-11-01 16:28