What are good habits when writing a save script

godot 3.5

hi there! I’m having a slight problem with saving (Not related to previous problems I’ve had.) It’s just that I was programming my game on windows, and switched to using linux part way through (long story).

My saving system works for windows with the User folder. I could stick the save file in a different folder, but I’m curious if there’s any good habits with saving and making it so that the game can be distributed accross multiple platforms with ease.

Sorry if this is a confusing question. Not looking for code per sey, mostly just a little guidance or the right direction to go.

Are you using the “user://” path? This will pick a appdata-y, presumed writeable spot on any platform.

1 Like

I was using “user://”. But I can’t find the save folder after having tried saving it on linux. so I don’t know what’s going on there.

On linux the default path will be ~/.local/share/godot/app_userdata, maybe you are using a containered version i.e. flatpak or snapd, so the files are saved within that container?

1 Like

sorry I have been explaining myself poorly I think.
On windows I had saved the game to my own computer, not within godot. This is for saving a game on the user’s computer so they may play it again without restarting the whole game.

SO in windows I had gone to user folder and created a save games folder. On Linux, at least in the distro I’m using, there is not a ‘user’ folder, there is a ‘usr’ folder but obviously its spelled different, idk why.

I want to be able to let the player play the game on linux, windows, etc. So I was curious if there’s a general way to let the game save itself in teh save system that would work for multiple operating systems.

okay sorry for confusion. I THINK I see why you linked that, I’m giving it a read through to figure out more

If they get to pick where the save file is located then Linux users can do the same as Windows. The Linux user’s folder is in /home/username or tilde (~) is a shortcut for this, that’s why the appdata is in ~/.local/... because it starts with ~ it is unique to the user.

/usr/ used to be a user directory back in the 70s but it’s for system wide installed programs, usually read-only for users. /home/ is where the user directories go.

okay… i think I’m slowly getting this, sorry for being dense. I’ll see how I can work with the new information provided, tysm

okay hahha. I’m not very smart ^^; I DID follow the path and it is savin fine apparently, just not in where I assumed it would XD the information you provided helped me find the saves. thank you so much!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.