Knuckle Cracker

Particle Fleet => Pre-release chatter => Topic started by: knucracker on April 22, 2016, 01:52:12 PM

Title: Where to store things, per OS
Post by: knucracker on April 22, 2016, 01:52:12 PM
Where to put stuff on each OS...  what a pain.  I have some new ideas for Particle Fleet, but before I commit I thought I'd throw it out and see what the community has to say.
For CW3, I've been using 'documents' on OSX and linux but I get complaints about that.  So based on my research the following looks closer to normal for each platform. 

SETTINGS are things like your preferences and your key (if nonsteam).  GAMEDATA is everything else (your scores, downloaded missions, maps you are editing, etc).

Latest Proposal
Windows
SETTINGS: c:\Users\USER\Documents\My Games\particlefleet\settings\
GAMEDATA: c:\Users\USER\Documents\My Games\particlefleet\

OSX
SETTINGS: ~/Library/Application Support/com.knucklecracker/particlefleet/settings/
GAMEDATA: ~/Library/Application Support/com.knucklecracker/particlefleet/

Linux
SETTINGS: ~/.local/share/knucklecracker/particlefleet/settings/
GAMEDATA: ~/.local/share/knucklecracker/particlefleet/

Windows
SETTINGS: c:\Users\USER\AppData\Roaming\knucklecracker\particlefleet
GAMEDATA: c:\Users\USER\Documents\knucklecracker\particlefleet 

OSX
SETTINGS: ~/Library/Application Support/knucklecracker/particlefleet/settings/
GAMEDATA: ~/Library/Application Support/knucklecracker/particlefleet/gamedata/

Linux
SETTINGS: ~/.config/knucklecracker/particlefleet/
GAMEDATA: ~/.local/share/knucklecracker/particlefleet/
Title: Re: Where to store things, per OS
Post by: raziel on April 22, 2016, 01:59:48 PM
why not to store them in game's folder?
Title: Re: Where to store things, per OS
Post by: Jdban on April 22, 2016, 02:06:46 PM
Windows looks good, looks pretty standard. That's all I can comment on.
Title: Re: Where to store things, per OS
Post by: J on April 22, 2016, 02:12:15 PM
Quote from: raziel on April 22, 2016, 01:59:48 PM
why not to store them in game's folder?
Storing them inside the game folder causes security issues on windows machines. (Old) games that did that need to be run as administrator in order to work correctly.

I notice there's now a 'knucklecracker' folder, is it possbile to auto-move the game files of older games to that directory? My documents is looks a bit cluttered with all these games.
Title: Re: Where to store things, per OS
Post by: knucracker on April 22, 2016, 02:20:36 PM
Quote from: J on April 22, 2016, 02:12:15 PM
Quote from: raziel on April 22, 2016, 01:59:48 PM
why not to store them in game's folder?
Storing them inside the game folder causes security issues on windows machines. (Old) games that did that need to be run as administrator in order to work correctly.

I notice there's now a 'knucklecracker' folder, is it possbile to auto-move the game files of older games to that directory? My documents is looks a bit cluttered with all these games.

CW3 already supports (via gamesettings.xml) moving what I call the GAMEDATA folder for ParticleFleet.  So you could move CW3 to this new structure.  I'm nervous about releasing an update of CW3 that would do this automatically.  It could fail, mess up some backup of the old folder somebody was using, cause additional confusion when somebody look in the old place, etc.

Title: Re: Where to store things, per OS
Post by: kwerle on April 22, 2016, 02:24:21 PM
The OSX game data is <edit> nearly </edit> spot on.  It should probably be:
~/Library/Application Support/com.knucklecracker/
or even
~/Library/Application Support/com.knucklecracker.particlefleet/


For settings, it's generally the right thing to use the settings and preferences APIs.  I'd be surprised if whatever IDE you're using doesn't support that:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/UserDefaults/Introduction/Introduction.html

If there's some reason you can't use that system, the location you suggested will do...
Title: Re: Where to store things, per OS
Post by: Ninja on April 22, 2016, 02:28:03 PM
Well, I use Windows, and what you put there does look pretty standard.
I will say, though, I've never quite understood why so many games use the AppData folder, and I find it a tad annoying as it can be hard to find. Can someone tell me why it is games usually use this folder?
Title: Re: Where to store things, per OS
Post by: MadKingMidas on April 22, 2016, 02:37:14 PM
I personally have a very small SSD running only my OS on my C:\ drive. I would prefer to be able to choose whete the game files and such are being stored during the insallation.
Title: Re: Where to store things, per OS
Post by: knucracker on April 22, 2016, 02:44:34 PM
Quote from: MadKingMidas on April 22, 2016, 02:37:14 PM
I personally have a very small SSD running only my OS on my C:\ drive. I would prefer to be able to choose whete the game files and such are being stored during the insallation.
I can make the GAMEDATA folder path something you can change in the game's settings menu.  So for any platform you can point it to wherever you prefer.  But, 99.9% of players will probably use the defaults.

Title: Re: Where to store things, per OS
Post by: J4kubS on April 22, 2016, 03:29:57 PM
Linux looks good :)
Title: Re: Where to store things, per OS
Post by: Bingeling on April 22, 2016, 05:01:46 PM
On windows, help keep Documents somewhat tidy, and put it into "Documents\My Games". Many other games do that.

I do not see a reason why you should not also put the config there? Why hide it? In the case someone wants to move stuff the manual way, it would be just one folder to move. Just leave one item that points at the main storage folder in appData.

You can have a "Save Games", "Config", "Cache" or whatever is needed or suitable inside the particlefleet folder.
Title: Re: Where to store things, per OS
Post by: knucracker on April 22, 2016, 07:57:25 PM
This is an article from several years ago that is interesting (the comments as much as anything).
https://www.rockpapershotgun.com/2012/01/23/stop-it-put-save-games-in-one-place/

If you had to fit a line to the data in the comments, it might be to use Documents\My Games\Game_Name...

As for SETTINGS and GAMEDATA.  I guess they could actually live together.  SETTINGS are really just game options (like graphics settings, and key mappings), plus the key if using the NONSTEAM version.

Based on that the following might be the proposed default locations.  Note there is really only one directory, and settings and gamedata are just siblings under it.   For windows, the dir moves under My Games.  For OSX there is a "com." in the company name.  And for linux everything moves under ~/.local/share/.  For linux I just left it as "knucklecracker" rather than "com.knucklecracker".  I don't supposed that is a common thing on linux, so I left "com." out.  Similar for windows.  Looks like the game, not the company name, tends to show up under My Games.

Windows
SETTINGS: c:\Users\USER\Documents\My Games\particlefleet\settings\
GAMEDATA: c:\Users\USER\Documents\My Games\particlefleet\

OSX
SETTINGS: ~/Library/Application Support/com.knucklecracker/particlefleet/settings/
GAMEDATA: ~/Library/Application Support/com.knucklecracker/particlefleet/

Linux
SETTINGS: ~/.local/share/knucklecracker/particlefleet/settings/
GAMEDATA: ~/.local/share/knucklecracker/particlefleet/

Title: Re: Where to store things, per OS
Post by: kingarthur on April 22, 2016, 11:38:40 PM
on windows it might be better to leave it just under documents as my games could make it harder to find. Im pretty sure the folder doesn't exist on my windows 8 computer and Im not sure about 7 or 10. so it would just create another folder that isn't needed.
Title: Re: Where to store things, per OS
Post by: MadKingMidas on April 23, 2016, 01:01:19 AM
Quote from: virgilw on April 22, 2016, 02:44:34 PM
Quote from: MadKingMidas on April 22, 2016, 02:37:14 PM
I personally have a very small SSD running only my OS on my C:\ drive. I would prefer to be able to choose whete the game files and such are being stored during the insallation.
I can make the GAMEDATA folder path something you can change in the game's settings menu.  So for any platform you can point it to wherever you prefer.  But, 99.9% of players will probably use the defaults.

Weird. I never use defaults. I like knowing exactly where everything I install is. Love my storage drive.
Title: Re: Where to store things, per OS
Post by: GoodMorning on April 23, 2016, 02:18:35 AM
I try to avoid caring, provided the game works. If the save needs to vary by user, then store it somewhere that isn't the install directory. Otherwise, I would prefer to find the entire game in one place. (I don't know what Steam &c. try to do...)
Title: Re: Where to store things, per OS
Post by: steelwing on April 23, 2016, 06:17:44 AM
Your last proposed Linux location looks good.  If you're using Unity to make the game, though, Unity has another location for where it puts things.
On Linux, that location is:  ~/.config/unity3d/<publisher name>/<game name>/
Some unity games (not all, by any means) store gamedata and/or settings there.  I'd rather you kept it someplace else, but up to you.  Just putting another alternative out there. :)
Title: Re: Where to store things, per OS
Post by: knucracker on April 23, 2016, 09:16:05 AM
That location for unity is where it will store 'prefs', and some other new things.  http://docs.unity3d.com/ScriptReference/PlayerPrefs.html

It's a facility Unity provides for some rudimentary persistent storage.  Some engine related settings are also there (like default monitor to use in a multi monitor setup).  It's in an oddball enough location on each platform that it isn't super appealing as a place to put other stuff.  But yeah, that's yet one more location stuff is shoved per game.

As for the final decision on where to put stuff (especially on windows), it's a no win scenario. :)  There is no place that will make everyone happy or be the expected place.  That's part of the problem and why it is all a mess.  Best I can do is pick some location that is at least in good company (some other games use it) and also provide a way in the game to change it. 

That said, putting the SETTINGS under the same directory and then allowing someone to change the directory location opens a channel for user failure.  For someone using the non steam version of the game the key is stored under the SETTINGS directory.  If the user changes the directory location and then doesn't copy or move the old location to the new, the game will start and prompt for the key to be re-entered.  Some of those people won't have their email with the key, and then will send me a support request for their email (yeah, such is an indie game developer's life that he has to think about stuff like this :) ).

If I don't make the directory location in game settings too visible, warn, prompt the user to move, etc... that should  cut down on some frivolous changes.  Of those that do change, most might be informed enough to move their stuff over.  If not, some of them will still have their key.  And of course these days most people are on steam anyway and the key isn't an issue.  I bet I'll still see a statistically significant increase in support requests, though :)
Title: Re: Where to store things, per OS
Post by: knucracker on April 23, 2016, 12:24:53 PM
Here's an old post with an interesting stat.  Out of 300 games, 25 use "My Games" under Documents (on windows).
http://www.ocmodshop.com/how-to-keep-game-saves-from-overwhelming-my-documents-folder/

For anyone on windows that has a lot of games installed, how many are saving in "My Games" out of the total you have installed?
It looks like the "standard", if you can call it that, is to just put stuff directly under Documents like I did for CW1,2,3.  It creates a giant mess, but it is a mess that existed before my games and will exist afterwards.  On the other hand, "My Games" is used as well, just in a minority of cases....

Also, for anyone with a "My Games" folder, what games are storing there?
Title: Re: Where to store things, per OS
Post by: J on April 23, 2016, 01:05:58 PM
Quote from: virgilw on April 23, 2016, 12:24:53 PM
Out of 300 games, 25 use "My Games" under Documents (on windows).

Also, for anyone with a "My Games" folder, what games are storing there?
For me it's 2 out of 30 (Rocket League and Railroads!). Please do not use both 'My games' and 'knucklecracker' as folder, one of the two is enough. I'd prefer 'My Games' then (which would be a good contribution towards making it the standard).
Title: Re: Where to store things, per OS
Post by: knucracker on April 23, 2016, 01:39:58 PM
And here is why you only see this kind of stuff in indie games... just read all of that text that says "please don't change this, please don't" :)
Title: Re: Where to store things, per OS
Post by: TLFP on April 23, 2016, 10:06:11 PM
I would have a "Reset to Defaults Button" to reset that to the defaults because some people (like me  ;)) will mess up a few times before getting the learning curb figured out.  :D Should help people some.
Title: Re: Where to store things, per OS
Post by: knucracker on April 23, 2016, 10:21:23 PM
The checkbox next to it toggles it on or off.  So if unchecked, the default is used.  What is in the field only gets used if the checkbox is ticked.  The default is also always shows in text under the field.  And on top of that you can't enter a non-existent directory.  It gets checked when you try to apply, and if not present the checkbox gets unticked.
Title: Re: Where to store things, per OS
Post by: hbarudi on April 24, 2016, 04:51:06 AM
I don't understand why no games save in C:\user\saved games\game\files
Why not use the saved games folder, xp compatibility?
I want my games to be saved there, cw123 and particle fleet and also other titles from other developers.
Title: Re: Where to store things, per OS
Post by: GoodMorning on April 24, 2016, 05:42:47 AM
Is it practical to have the:
Default location store a small file that points to the actual location (this could be in the game's installation dir., as some form of config file)?
Game regenerate everything but the key automatically?
Key stored with the settings location file?
Game offer a "change data directory" option, which moves all the files that need to move, safely and properly?

Suggestions only. The last might cut down on support requests.
Title: Re: Where to store things, per OS
Post by: Fireball14 on April 24, 2016, 08:02:16 AM
Quote from: virgilw on April 22, 2016, 01:52:12 PM
Latest Proposal
Windows
SETTINGS: c:\Users\USER\Documents\My Games\particlefleet\settings\
GAMEDATA: c:\Users\USER\Documents\My Games\particlefleet\
Note - Unity have a problem with chines paths.

PS Maybe JSON to PlayerPrefs?
Title: Re: Where to store things, per OS
Post by: knucracker on April 24, 2016, 10:07:38 AM
Quote from: hbarudi on April 24, 2016, 04:51:06 AM
I don't understand why no games save in C:\user\saved games\game\files
Why not use the saved games folder, xp compatibility?
I want my games to be saved there, cw123 and particle fleet and also other titles from other developers.

I can only speculate, but I can imagine that when it was introduced in Vista nobody used it because XP compatibility was paramount.  And since it was directly under the USER account (A peer to My Documents) there might have been permissions issues and such trying to create it.  This same logic carried over well into the windows 7 epoch since XP remained popular.  These days you could argue that XP compatibility no longer matters, but "Saved Games" has turned into that restaurant that nobody goes to.

It also isn't named particularly well.  "Saved Games" might make some devs hesitate since what they are storing is more than "saved games".  And of course if your app isn't a game, you for sure aren't going to store your settings in "Saved Games".
Title: Re: Where to store things, per OS
Post by: knucracker on April 24, 2016, 10:16:14 AM
Quote from: GoodMorning on April 24, 2016, 05:42:47 AM
Is it practical to have the:
Default location store a small file that points to the actual location (this could be in the game's installation dir., as some form of config file)?
Game regenerate everything but the key automatically?
Key stored with the settings location file?
Game offer a "change data directory" option, which moves all the files that need to move, safely and properly?

Suggestions only. The last might cut down on support requests.

The default location is basically hard coded per platform. It's a #ifdef in the code per platform build.  That takes care of knowing where to go by default per OS.  The setting you can specify that overrides this lives in Unity's PlayerPrefs.  On windows that lives in the registry, and in small files on OSX and linux.  The location in the registry/small files doesn't change.

As for auto migrating the directory over...
I always hesitate whenever I do anything that involves the file system and a recursive operation (even a copy, much less a delete).  Those of us who have been around long enough have all had that gut wrenching experience of "oh !@#$".
So I don't like to build in features that move or delete files.  If I do have anything, it will always be file specific not directory or recursive based.

I've actually taken a step in the opposite direction.  If you specify a custom data path, you have to make sure the directory already exists.  The game won't create the directory for you... it insists you go do that separately, then only lets you apply the setting once it sees it exists.
Title: Re: Where to store things, per OS
Post by: GoodMorning on April 24, 2016, 10:07:05 PM
Just a thought.

The problem seems to be unsolvable, and so the best course seems to be to pick something that you know will work, and use that.

(I would estimate that 9/10 players don't care where the files are, as long as the game runs properly. Of the remainder, many will probably want to know where to find them, but not necessarily move them.)

I could easily be wrong, but it seems to me that it must work first, and be customisable later.
Title: Re: Where to store things, per OS
Post by: thepenguin on April 30, 2016, 10:16:55 PM
If you're going to have a linux/bsd installer, just make sure that people can change the install path (not everyone has a .local folder.  Also, because linux...)
Title: Re: Where to store things, per OS
Post by: Nebulous on May 07, 2016, 08:21:41 PM
Is there anything else that you you want to run by us before the release of Particle Fleet? The people here probably have ideas for everything...