Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411525 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 02:58:46 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)OS Best Practices and me
Pages: [1] 2
Print
Author Topic: OS Best Practices and me  (Read 4238 times)
Oddball
Level 10
*****


David Williamson


View Profile WWW
« on: October 04, 2010, 02:12:09 PM »

I'm looking for information on developer best practices for the three main operating systems. By this I mean where Microsoft, Apple, etc. would like me to put the various data, settings and save files that my game uses. Developers seem to put these things in all sorts of places, but I'm trying to find out where they are officially supposed to go. I assume this information is freely available for developers, but I'm not sure where to find it. Some key locations I'd like to know are:

  • Executable. The .exe/.app file itslelf.
  • Fixed media/data. Graphics, sound effects, music, level data, etc.
  • Game settings. The preferances and settings usually set by the user.
  • Dynamic media/data. User created and downloadable content.
  • Game saves. The player's saves and progress data.
  • Documentation. Read me's, EULA's, and stand alone manuals.
  • Anything else I may have missed.

Also any links to where this information can be found would be much appreciated.



Here is what I have so far.

  • Executable In general this should be decided by the end user, but there are recommended locations.
    • Windows /Program Files/AppName/
    • Mac OS X /Applications or ~/Applications/
    • Linux /usr/bin/AppName/ or /usr/games/AppName/

  • Essential media/data This is media or game data that your game could not run without. Usually kept in the App's directory(see above), but on Mac OS X in the .app bundle.
    • Windows AppName/
    • Mac OS X AppName.app/Contents/Resources/
    • Linux AppName/ or /usr/share/games/AppName/

  • Support media/data This is media or game data that is not essential for the game to run. It could be settings files, game saves, downloaded content or user generated content. This content is user specific, for shared media/data see below.
    • Windows %APPDATA%/AppName/
    • Mac OS X ~/Library/Application Support/AppName/
    • Linux ~/.AppName/

  • Shared media/data This is similar to support media/data above, but with the difference that all users can have access to it. Useful for highscore tables, UGC, etc that all users can use.
    • Windows ? ? ? ?
    • Mac OS X /Library/Application Support/AppName/
    • Linux /var/games/AppName/

  • Temporary media/data This is any media or game data that your game creates temporarily during runtime.
    • Windows ? ? ? ?
    • Mac OS X /tmp/
    • Linux /tmp/

And here are some useful links on the subject.

Please post corrections or any additional information below.
« Last Edit: October 06, 2010, 03:53:36 PM by Oddball » Logged

Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #1 on: October 04, 2010, 04:00:40 PM »

  • Executable. The .exe/.app file itslelf.
Mac: Generally goes in /Applications, but Mac users can run programs from pretty much wherever they want.

Windows: Program Files, on the main drive.

Linux:  Varies by distro, common locations in include /usr/bin, /usr/local/bin, /usr/games, /usr/local/games

  • Fixed media/data. Graphics, sound effects, music, level data, etc.

For some Mac OS programs this is bundled in the app at Contents/Resources.  Otherwise, in the same location as the bin.  Windows usually puts it with the bin, Linux distros vary, once again, but with the bin is generally fine.

  • Game settings. The preferances and settings usually set by the user.

Mac: ~/Library/Application Support/yourgamename, or sometimes ~/Library/Preferences/yourgamename
Windows: $APPDATA/yourgamename
Linux: ~/.yourgamename/

  • Dynamic media/data. User created and downloadable content.

Generally the same as game settings.

  • Game saves. The player's saves and progress data.

Generally the same as game settings.

  • Documentation. Read me's, EULA's, and stand alone manuals.

Not sure, I just bundle the manual with the program.

These should be pretty close.  Above all, never assume that you have write permissions to the binary's directory.  On a properly configured system, you almost certainly won't have them.
Logged



What would John Carmack do?
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #2 on: October 04, 2010, 11:13:34 PM »

But if user-made content goes in users' home directories, others won't have access? The point is that they are shared, like official content.
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #3 on: October 05, 2010, 04:44:46 AM »

But if user-made content goes in users' home directories, others won't have access? The point is that they are shared, like official content.

That's just the way it works.  The user's home directory is really the only place you can assume you have write permissions to.  Every game I've played that offers user-made content either puts it with the binary (which is wrong, and will break on a proper multi-user system) or puts it in the home directory.  If you want to share after-market content, each user needs their own copy.
Logged



What would John Carmack do?
Oddball
Level 10
*****


David Williamson


View Profile WWW
« Reply #4 on: October 05, 2010, 04:48:50 AM »

Thanks Average, it's a good start. I would still like to find any official word on this. I have found this relating to Mac OS X, but nothing for Windows yet.
« Last Edit: October 05, 2010, 05:03:04 AM by Oddball » Logged

jmp
Level 0
**


View Profile
« Reply #5 on: October 05, 2010, 07:48:19 AM »

I would still like to find any official word on this.

For Linux, check out the Filesystem Hierarchy Standard.
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #6 on: October 05, 2010, 08:00:19 AM »

If I remember well, there is still ways to have shared files for an app on Windows (even Vista/Win7 that otherwise will create a user-specific folder anyway if you write in the program files directory to manage old apps behaviour).

Have to check that too.
Logged

PGGB
Level 8
***



View Profile
« Reply #7 on: October 05, 2010, 09:42:32 AM »

But if user-made content goes in users' home directories, others won't have access? The point is that they are shared, like official content.

That's just the way it works.  The user's home directory is really the only place you can assume you have write permissions to.  Every game I've played that offers user-made content either puts it with the binary (which is wrong, and will break on a proper multi-user system) or puts it in the home directory.  If you want to share after-market content, each user needs their own copy.

OS X and Windows have a shared directory, but yeah on Linux you don't have that and it's probably not a good idea either way to use those (though Blizzard uses that in SC2 on OS X).
Logged
Core Xii
Level 10
*****


the resident dissident


View Profile WWW
« Reply #8 on: October 05, 2010, 11:31:24 PM »

What about /var? /var/games?
Logged
PGGB
Level 8
***



View Profile
« Reply #9 on: October 06, 2010, 12:38:07 AM »

What about /var? /var/games?
/var is only for temporary files like logs and such.
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #10 on: October 06, 2010, 01:05:33 AM »

This thread (with a sum-up at the first post) should be sticked. It's really useful information.
Logged

Oddball
Level 10
*****


David Williamson


View Profile WWW
« Reply #11 on: October 06, 2010, 06:32:02 AM »

I have updated the first post with what I have so far, but there are still a few blanks. I would also be interested in finding the official logos that Microsoft let you use to show that your game is compatible with their OS. I have found the Mac logo license, but nothing official for Windows or indeed Linux.
Logged

PGGB
Level 8
***



View Profile
« Reply #12 on: October 06, 2010, 07:10:14 AM »

Linux doesn't really have an official logo so I guess you would probably use the mascot. For Windows I found this.
Logged
jmp
Level 0
**


View Profile
« Reply #13 on: October 06, 2010, 09:18:54 AM »

Quote
/var is only for temporary files like logs and such.

/var isn’t only for temporary files, it’s for variable files. Many games use /var/games for storing high scores, saved games and such. According to FHS, static files belong to /usr/share/games whereas variable files belong to /var/games.

Anyway, I searched for a bit and found this document:
Linux Games Install And Directory Guide (more specifically this page)

It’s rather old but seems like it could still be useful.
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #14 on: October 06, 2010, 09:37:08 AM »

I would also be interested in what the proper way to create and distribute Linux binaries is (if there is one). Like bundling all the dependency libraries without having to compile them for a specific distro.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #15 on: October 06, 2010, 11:15:34 AM »

I would also be interested in what the proper way to create and distribute Linux binaries is (if there is one). Like bundling all the dependency libraries without having to compile them for a specific distro.

The proper way is to make individual packages for distros.  Bundling dependencies is highly frowned upon in the Linux world.

Most projects that I've seen distribute source, and rely on other people to package it for various distros.  For example, somebody made an Arch Linux package for one of my games.  I had no involvement in this, the dude just did it.

By the way, /Library/Application Support is not where you want to put shared resources and what not on a Mac, that directory requires admin access.

/Users/Shared might work, but I haven't played there in a while.
Logged



What would John Carmack do?
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #16 on: October 06, 2010, 11:19:57 AM »

Right, but what if you don't want to distribute source? I remember downloading quake2 binaries from iD before it went open source and they were just plain old ELF binaries all together in a zip file. Libraries in the same folder as the executable will override global path libraries like in any other OS, right? Why don't people just do that?
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #17 on: October 06, 2010, 11:21:14 AM »


By the way, /Library/Application Support is not where you want to put shared resources and what not on a Mac, that directory requires admin access.

/Users/Shared might work, but I haven't played there in a while.

I'm pretty sure the standard on the Mac is ~/Library/Application Support/YourApp

EDIT: Oh wait. This is for shared. I was thinking user-specific. Nevermind.
« Last Edit: October 06, 2010, 11:28:20 AM by Ivan » Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #18 on: October 06, 2010, 11:50:57 AM »

Right, but what if you don't want to distribute source? I remember downloading quake2 binaries from iD before it went open source and they were just plain old ELF binaries all together in a zip file. Libraries in the same folder as the executable will override global path libraries like in any other OS, right? Why don't people just do that?

You asked about the proper way.  Not everyone does it the proper way.  A lot of Linux people won't play games that they can't get source for, on philosophical grounds.

I always distribute source, so I don't know the details of other approaches.
Logged



What would John Carmack do?
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #19 on: October 06, 2010, 11:59:56 AM »

A lot of Linux people won't play games that they can't get source for, on philosophical grounds.

( ._.)
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic