MacOS X distro: DMG or not DMG?

Discussion in 'Game Development (Technical)' started by stan, Apr 7, 2005.

  1. stan

    Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    188
    Likes Received:
    0
    A Mac user friend of mine tells me that I must distribute the MacOS X version of my game in a DMG, that it looks professionnal and is better that way.

    From my POV, DMG are a pain:
    - It's much simpler for me to handle zip files (both from the author and from a player's POV),
    - the game could be run from the DMG without being installed, which means I can't save files into the game's directory (I can if I set the DMG to read/write, but the player might then redistribute it altered)

    So my question is: should I really distribute my game in a DMG? Are there people who won't download it if it's in a zip file? Does it look so unprofessionnal in the Mac world?

    Thanks!
     
    #1 stan, Apr 7, 2005
    Last edited: Apr 9, 2005
  2. Russell Tracey

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    11
    Likes Received:
    0
    A quick look at the site where lots of Mac users get downloads tells you that developers are using .sit, .zip, .dmg, .bin. So i don't think it matters that much. That said I think that there were some problems with the default install of StuffIt that caused some .zip and .sit files to not work, so a save bet is .dmg.

    Your save games should be stored in "~/Library/Application Support/Your Game Saves" or maybe "~/Documents/Your Game Saves". I think there maybe more places, but it is never inside the app bundle or dmg image or application folder by convention.

    The moto to use when approaching these type of issues is "When in Rome, do as the Romans do".
     
  3. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    5
    I distribute a .dmg.sit, which is a compressed disk image. Some people distribute a .sit which is just the compressed application tree, but in that case you can't put links to your website and such.

    As for the readonly directory... you shouldn't rely on running in a directory with write permissions in any OS, including Windows.

    Handling a .dmg or a .sit are as easy or easier than handling a .zip in the mac. dmg is part of the OS and sit is handled by StuffIt which is a defacto standard (as WinZip in Windows). I'm not so sure about zip. But in any case, I believe .dmg or .sit "feels" more native than .zip to Mac users, and I also believe Mac users are much more sensitive to that kind of thing.
     
  4. Hamumu

    Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    557
    Likes Received:
    0
    Yes, assuming you can write to the game directory has caused me problems a few times on XP. I'm going to have to avoid that in the future! I've always royally hated games saving stuff outside their directory on my PC, but in this modern age of fancy permissions and whatsohoosits, I guess you have to do it. Something about the "My Documents" folder just sticks in my craw. But then I also resisted using the Program Files folder for years and years.
     
  5. Ryan Clark

    Indie Author

    Joined:
    Oct 29, 2004
    Messages:
    656
    Likes Received:
    0
    Whoa, can you elaborate on this? I have always assumed that it would just work. (I've never seen it fail, and this is the first time I've heard about it failing!)

    What caused your problems? Obviously the installer was able to write to that directory... :confused:

    What are your workarounds, then? I cringe at the thought of having to write platform specific "writable directory" finding code.
     
  6. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    5
    I've seen crashes caused by not taking this into account (remember, I get emails everytime a game crashes somewhere). Don't underestimate the problem!

    I'm not sure - maybe an Administrator installed the game but runs it as User?

    No workaround, just writing platform specific "writable directory" finding code :(

    Fortunately, that's relatively simple. There's ~/Library/Preferences in the Mac, ~/.yourgame in Linux, and GetWindowsDirectory() and SHGetFolderPath() in Windows.
     
  7. Hamumu

    Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    557
    Likes Received:
    0
    Yes, if the game gets installed by an admin, then run as a user, any files the admin wrote can't be overwritten or deleted. So the config files and stuff are not writable (In my case, the config/save files don't exist when the game is first installed, so it actually works fine in that case - it only fails if they install as admin, play as admin, THEN try to play as user, so it only happens rarely). I had to offer some very ungainly solutions (moving the files and moving them back in different modes), because I just don't know how to change those permissions! Or of course they can just install the game with the account they intend to play on.
     
  8. Sillysoft

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    831
    Likes Received:
    0
    I distribute on the mac as an internet-enabled DMG file. This means that when the OS first encounters the DMG (on double-clicking it or some browsers will auto-handle it) it will mount the DMG, copy it's contents to the download folder and trash the DMG. In practice this means that the DMG will be replaced by my Application. This way there's no way they can run the application from the mounted DMG, the copy has been provided on their normal local filesystem.

    This method is the current 'apple suggested' method, as far as I can tell. It sure beats a normal dmg file though. And it doesn't leave any remaining archive files in the users download folder.
     
  9. James C. Smith

    Moderator Original Member

    Joined:
    Aug 21, 2004
    Messages:
    1,768
    Likes Received:
    0
    How long has support for Internet-Enabled Disk Images been around? Never mind, I just fallowed the link and see it is new in Mac OS X version 10.2.3.
     
  10. stan

    Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    188
    Likes Received:
    0
    I feel exactly the same as Hamumu, in fact: I hate it when programs write outside of their directory or into the registry... I never use "My documents" and install only a few programs into the big mess which is "Program files".

    But I guess I'll have to go with the trend and put "crap" outside of my game's dir. I'll use the directories mentionned by Gabriel for the Mac and Linux versions. I just have to check how to create the directory (not sure if a fopen() will create one... I'm afraid I'll have to write some system specific code. It's probably not too difficult though ;).)

    Regarding DMG, sit and zip... I mentionned zip because it's supported in MacOS X.3 at least. I didn't have problems unpacking zip files, but that doesn't mean there aren't of course. There's no free tool to create sit files. I don't feel like using internet enabled DMGs because of the problems mentionned on Apple's site (non consistent behaviour, etc.)

    So, well... Still not sure what to use, but I'll probably use a zip or a compressed DMG (I've read that OSX' DMG creation tool can create compressed DMGs by itself, so it shouldn't be necessary to zip or whatever it afterwards.)

    Thanks for your answers!
     
  11. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    5
    ~/Library/Preferences should exist in Mac already.

    Don't use fopen(), use mkdir().

    I'm not sure if these functions expand ~, probably not. Concatenate getenv("HOME") with "/Library/Preferences" to be safe.
     
  12. BitBoy

    Indie Author

    Joined:
    Aug 22, 2004
    Messages:
    57
    Likes Received:
    0
    Using "~" in the path when opening files didn't work when I tried it. Getting the environment variable would work I guess, but I think it's better to use FSFindFolder() to get the appropriate directory. For example, I use this in my code:

    Code:
    FSRef FolderRef;
    char Path[PATH_MAX];
    if (FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &FolderRef) != noErr)
    	throw cException("Couldn't get folder reference.", __FILE__, __LINE__);
    if (FSRefMakePath(&FolderRef, (UInt8 *)Path, sizeof(Path)) != noErr)
    	throw cException("Couldn't get folder path.", __FILE__, __LINE__);
    
     
  13. Red Marble Games

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    154
    Likes Received:
    0
    A couple of suggestions from a Mac-only guy:

    1. OS X is really tight about permissions to write to directories. ~/Library/Preferences will always be OK; another option is the Application Support folder, where you can create your own folder and write whatever you like. Also note that many times the only folders to which you have write access are specific to the user (like ~/Library/Preferences), so that's not a good place to save something like high scores. A surprising number of Mac users share a computer and have different login accounts on the machine, which are not admin and so have very limited write permissions.

    2. Look into the CFPreferences API. It automatically stores things in Library/Preferences as XML files called property lists, and is simple, simple, simple to use. A perfect replacement for all the INI reading and writing that traditionally goes on on Windoze.

    3. I don't get as good compression from DMG files, even so-called "compressed" DMGs, as compared to .sit files, and since size is a premium I don't use them. Zip increasingly "just works" on the Mac -- users can double-click a zip on their desktop and it will decompress (though this may be a 10.3 innovation, not sure OTTOMH). But .sit or DMG are more familiar to Mac people and you will look like a Windoze person who doesn't really "get" the Mac if you use zip (IMHO). That provincial attitude is changing but I think is still the norm for now. And dmg.sit gives the user too many steps between archive and playing (again, IMHO).

    4. There's nothing about .sit files that prevents you from including site links or whatever else you want. You can throw everything in a folder and stuff the folder, or stuff the individual items.
     
  14. stan

    Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    188
    Likes Received:
    0
    So, where is a good place to save high score if you want all users of one computer to share the high scores table? IIRC there should be "/Library/Preferences/"... right? Or maybe that was "/Library/Application Support/".

    As for CFPreferences, I already have my own cross platform ini reading/writing library, so I don't think I'll be using that. But thanks for your answers, they were exactly what I was looking for!

    Thanks BitBoy and Gabriel too. I'm not used to POSIX stuff, so I wasn't thinking of mkdir().
     
  15. Chris Evans

    Moderator Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,162
    Likes Received:
    0
    I also thought saving files in the game directory was fine.

    What happens if the game has an auto-updater? The files in the game directory will have to be replaced or modified. Do you just have to deal with the possibility that someone out there might not be able to auto-update?
     
  16. Jack Norton

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    5,130
    Likes Received:
    0
    I just use .zip files, as all my Mac games runs only on Mac OS X and it has .zip enabled (I think is from OS 10.2).
     
  17. Musenik

    Original Member

    Joined:
    Dec 5, 2004
    Messages:
    796
    Likes Received:
    0
    The archive to zip function was added to OSX 10.3, and 10.2 doesn't usually unzip it's younger brother's files too well. I ship with .zip because my game only runs on 10.3. Otherwise, I'd use .dmg compressed.

    I would like to know more about this 'auto install' dmg mentioned earlier. What browser's support it? Or is it an OSX thing? What versions then?...
     
  18. Red Marble Games

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    154
    Likes Received:
    0
    @stan: Re where to save multiple-user data, the current Apple suggestion is to create a folder in Users/Shared, which is another area that I think it guaranteed to be writable. Go to developer.apple.com and look for CFPrefTopScores for a sample.

    @Chris Evans: I'm not entirely sure about auto-updaters, but I think anything is possible if you ask the user for an admin password; that's what Apple's Software Update does, and in an auto-update situation it's probably OK from a user-interface perspective to have to ask (unlike when saving high scores or something). Not sure of the API for this, probably involves Authentication Services.
     
  19. Phil Steinmeyer

    Original Member

    Joined:
    Mar 1, 2005
    Messages:
    757
    Likes Received:
    0
    So, just to confirm my understanding (and that nothing notable has changed on this front recently...)

    .SIT files used to be the nice way to go, but OS-X 10.4 and up don't ship with the ability to un-stuff automatically, so this is BAD

    Internet-enabled .DMG files are a graceful solution, but they're only available from 10.2.3 and up, so if you want to support older systems, this is BAD

    Regular .DMG files, while awkward to use, work on any flavor of OS-X, so they are reasonably GOOD (except for their awkwardness), right?
     
  20. Savant

    Original Member

    Joined:
    Feb 8, 2005
    Messages:
    1,674
    Likes Received:
    0
    That's my understanding. I'm using basic DMG files for Dr.Germ and haven't had a single problem.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer