sulix/omnispeak

[Proposal] Separation of directories for each keen game

Poligraf opened this issue · 7 comments

Hi David

I would like to propose to you the idea of separating keen data and saves files from configurations for each of the games.

Instead of keeping everything in the same directory relative to the binary, it would be nice to keep audio.ck4 and savegame.ck4 in data/keen4 and all configuration files to remain in the same directory as the omnispeak binary.

This will make it a bit easier to transfer data files around.

If you disagree with idea, feel free to close ticket.

sulix commented

Reworking how files are handled in Omnispeak is on my todo list. I haven't worked out exactly how it'd work yet, but some level of support for splitting user files (configs, savegames) from data files (egagraph, gamemaps, audio, etc) is definitely a goal. I hadn't thought much about explicitly having different paths for the different games, though, so that's something I'll have to think about. At the moment you can sort-of fake it by running from a different current directory, but that's not a perfect solution.

The current goal is to have Omnispeak keep track of two directories, a datafile directory and a user-data directory. There'd be some way of configuring these (probably with some code to search a few paths for copies of the various games), as well as defaults of the current directory, the directory with the executable, an $XDG_DATA_HOME directory, or some hardcoded paths (e.g., /usr/share/games/keen4).

In fact, one idea is to have a single "episode.ck4" file which holds the filenames and other info for an episode, and to replace the "/episode" switch with a path to this file — that way Omnispeak could infer the other paths from that. Alas, it'll probably be a while before I can finish implementing that.

One thing I don't understand about your proposal is the desire to keep the savegames in the data/keen4 directory, separate from the config files. Is there a particular reason you want the savegames alongside the datafiles (audio, etc?)

No reason, keeping saved games in a different directory to config files and to game files is preferable.

Ideally if a user can specify the config and save game filepaths it would be great.

sulix commented

I've done some of the initial work to support loading things from different directories.

The current version now accepts the /GAMEPATH and /USERPATH arguments.

Note that:

  • The original game's files will be looked for in the "Keen Path" (which is set by /GAMEPATH, and defaults to ".")
  • Files packaged with Omnispeak (the headers, ACTION.CKx, etc) are looked for in the "Keen Path", and — if not found — in the "Omnispeak Path" (defaults to ".", but set to the directory the executable is in if there's no "ACTION.CK4" file)
  • Savegames and config files are found in the "User" path (set by "/USERPATH", defaults to ".")

This will change a bit, and become more configurable and less buggy, as I keep working on it. At the moment, it may even be a slight regression, but hopefully this is a good start.

Hi David

Thank you. This will make it significantly better for users on all platforms.

Ps I have finished keen4 and 90% completed on keen5 on the retrofw device and port is released for all the retrofw users.

Thank you for your work, its always good to get such a helpful developer

sulix commented

Glad to hear that Keen 4 and 5 seem to be working.

I'm still in the process of updating some of this filesystem work (including some tidy-ups and bugfixes this morning), so it may be worth keeping an eye on any changes over the next few weeks in this area.

(One thing I'm hoping to do is to make some of the defaults here configurable at compile-time, so you can set better defaults when porting to other platforms.)

Cheers,
-- David

sulix commented

FYI — as of commit 20181c9 — it's now possible to specify the default data and savegame paths at compile time using, e.g.,
make KEENPATH=/usr/share/games/keen5 USERPATH=savegames

It's also possible to prefer the XDG Data Path for savegames with the XDGUSERPATH option. Even if that option is not enabled, it'll be used as a fallback on SDL2 builds.

There are a few other #defines you can use in ck_config.h to fine-tune the path selection.

The /GAMEPATH and /USERPATH command-line options still work.