Where do you save the highscores?

Community Forums/General Help/Where do you save the highscores?

Marcell(Posted 2014) [#1]
Hello,
where do you other people save the highscores and other data in your Blitz products?

If the product is installed into the Program Files folder, the Program Files folder doesn't seem to be the right place. As I just learned, the data is actually saved in Virtual Store, if the data is tried to save in the Program Files folder.


GfK(Posted 2014) [#2]
"C:\Users\<username>\AppData\Roaming\<gamename>\" would be the usual place*. There's Windows API to retrieve this path but how you do that depends on what version of Blitz you're using.

* AppData is a hidden folder


Marcell(Posted 2014) [#3]
Thanks!


xlsior(Posted 2014) [#4]
Whatever you do, don't hardcode the path -- doing that is bound to fail on non-english windows installs, as well as future versions of windows.

According to the microsoft programming guidelines, you'll have to use a windows API to ask the system for the path to use.

(Older versions of windows were more lenient in where you wanted to write, but windows 7 & 8 won't just let you write everywhere anymore)


Derron(Posted 2014) [#5]
I save it in my own (the apps) folder - so if people have a portable-apps-setup it is saved right with the app.

same for linux/mac.


bye
Ron


dawlane(Posted 2014) [#6]
What xlsior says don't hard code the path.

On windows.
If the application is installed for all users then the application should use the ALLUSERSPROFILE environment variable.
For just a users local storage APP_DATA environment variable from the system for user specific storage.

Environment variables
A better description of the Environment variables

Linux.
If the application is installed for all users then the application should use the directory ./var/games, but it's not written in stone that it has to go into this directory.
For just a users local storage, the environment variable $HOME can be used to locate the users home directory and data stored in the .config directory ($HOME/.config/myGame/)

To list the environment variables on Linux. Use the command printenv. This command will only show environment variables that have been exported. This should also apply to Apple OS X as well.
Each process that is started inherits it's parents environment variables. If you want to see what a processes environment variables are use cat /proc/<PID>/environ | tr '\0' '\n' replace the <PID> with the process number.
Each Linux distribution will have it's own set down to the number of possible configurations.
But the common ones that can be seen are
PATH, HOME, USER, PWD, TERM, SHELL, LANG, LOGNAME, DISPLAY
One example of one that isn't seen
HOSTNAME

OSX.
If the application is installed for all users then the application should use /Library/Application Support/
There should be a the same directory in structure in the users home directory. The users home directory can be located in the same way it is on Linux with the $HOME environment variable.

The is only one topic about this.

Edit: Modified to show most common locations for a application to store data.


Henri(Posted 2014) [#7]
There is also Brucey's volume mod for this.

-Henri


Marcell(Posted 2014) [#8]
In Blitz3D GetEnv$("AppData") gives the path to proper AppData folder. I've started to use this.


Marcell(Posted 2014) [#9]
Does anyone know/remember which Windows versions are the first ones that have %AppData% folder?


dawlane(Posted 2014) [#10]
Windows Environment Variables


Yue(Posted 2014) [#11]
Every day you learn something, it solved my problem in Windows 8 and the configuration file of my project.

One question, which means the processor level?


dawlane(Posted 2014) [#12]
You can find a description of the environment variables here

Updated this post.