Driftwood2D / Driftwood

Driftwood 2D Tiling Game Engine and Development Suite
http://tileengine.org/
MIT License
24 stars 1 forks source link

Good macOS port #133

Open pmer opened 7 years ago

pmer commented 7 years ago

Creating a script to make an .app bundle for macOS (a folder called "Driftwood.app") is straightforward and easy, and will be portable so any platform can make them.

What's more difficult is finding a way to make the bundle Mac-ish.

Mac apps come in two types: traditional Unix apps and macOS GUI apps. Program authors tend to stick to one type. Unix-like apps commonly come with config files and store their data in a dot file, as per Unix convention. They are often launched via the terminal. macOS GUI apps store their configurations in the ~/Library and tend to use more platform-specific APIs. They also follow a tradition of being entirely configurable through the GUI. They have good support for being launched without a terminal. (Think: Firefox or VLC.)

Unfortunately, almost all games on macOS follow the macOS GUI type. (Think: any modern game, which will have a Settings menu option once you start it up.) I expect that some potential Mac users will be confused by Driftwood's Unix-like conventions.

This issue is to track discussion on potential ideas to resolve this.

pmer commented 7 years ago

Solution for today

For now, we can release a folder that contains an .app bundle, a config file, and the data folder.

This task has been assigned #134.

But that's not the best we can do

But this will feel dirty on macOS—an obvious cross platform app that didn't spend time making a good port. In the long run I think we should make something better.

Separating the Driftwood executable from its data

The proper place for .app bundles is in the /Applications folder, and they should not be contained within a folder. Read-only data files that come bundled with the app can go in the .app bundle, but Driftwood needs a new place for its config and world data files.

Location for data

Data for .app bundles are conventionally kept in ~/Documents if there is value in letting a user back up or otherwise copy the files (e.g., save games), ~/Library if you provide a GUI for managing data and don't want to clutter up a user's Documents folder, or your app can ask the user to specify the location, perhaps with a file open dialog.

Case study: Tiled

If you open Tiled with no arguments it will re-open the last maps you had open. It stores this list in ~/Library on macOS and ~/.config/mapeditor.org/tiled.conf on Linux. (Not sure about Windows...) It also stores user settings in that file.

You can use the open file dialog to pick new files to open, or you can double click them from a file browser since Tiled associates itself with the .tmx and .json extensions.

Note that on macOS there are a ton of ways to launch an application with no command-line arguments:

  1. From the dock, if you've chosen to keep the app in your dock.
  2. Running the .app bundle directly from Finder.
  3. From Spotlight.
  4. From Launch Pad.
  5. Calling /usr/bin/open -a <name of your app>, which has the same.

The only way in the GUI to launch an app with arguments is to open a file (e.g., a .pdf for Preview) that your app has been associated with.

Editing settings

The other thing the macOS release of Driftwood would benefit from is if you didn't have to edit a JSON file to change worlds or toggle fullscreen, etc. There exist people who use Macs who would love to use play Driftwood games but who don't know what a JSON file is let alone feel comfortable editing one.

macOS is also a platform where you'll find people who do know what a JSON file is but still don't want to edit one to change settings.

Side benefit

If we tackle these issues for macOS, the Windows port might benefit as well.

Timeline

Maybe after the beta phase of development, once we're ready to say we're 1.0.