I want to make a nice game, but I need a function, so player can save all his game data. I want to know, how to make it so it saves all game data to the same folder, as the executable Standalone Runtime game file is located. Of course in another folder called Saves, which is located in Game File's folder. Plus, I want to know how to make multiple saves and how to make player able to delete some save files in-game. Please, help me.
Blender treats paths beginning with "//" as relative to the blend file directory. You can use
bge.logic.expandPath to get the absolute path that you can use in standard python file calls to create data files containing all the variable data you want to store.
bge.logic.expandPath(path) Converts a blender internal path into a proper file system path.
Use / as directory separator in path You can use ‘//’ at the start of the string to define a relative path; Blender replaces that string by the directory of the startup .blend or runtime file to make a full path name (doesn’t change during the game, even if you load other .blend). The function also converts the directory separator to the local file system format.
Parameters: path (string) – The path string to be converted/expanded.
Returns: The converted string
Return type: string