Read/Write

So, for a save system that uses a txt file, where would I put said txt file (directory-wise) so I don’t have to specify the whole filepath?
(If the program is running from the same dir as a file it’s loading is in, then you can just day open(whatever.txt), instead of open(C:\Users\MrFoo\Desktop\Blender…) or whatever)

If I make the game a standalone, presumably it goes in the same dir as the exe, but before then - where’s it running from?

bge.logic.expandPath(path)

Also, if you want to ensure an easier implementation of save files, I would place the game in its own folder and write the saves to the same locations (maybe have a folder labeled ‘saves’ if you want the ability to have many concurrent saves at once). The benefits is that you won’t then lose your saves if you download a new release from Blender.org.

Then for uploading the game you just pack it into a zip or .7z file (or into a tarball if you use Linux).

For GaiaForge I put my saves in user home directory because that’s the one place we can assume whoever is playing has write permission. You can find it in my signature :slight_smile:

If you use

logic.expandPath("//MyFile.txt")

then you would put the file in the same directory as the .blend/.exe file.

Of course you can add sub-folders, you just need to add it to the parameter:

logic.expandPath("//MyFolder\MyFile.txt")

For some reason I thought path only worked in windows builds