Designing Games with Xconq - Files and Directories

Go to the first, previous, next, last section, table of contents.

## Files and Directories

This section defines file and directory structure for using GDL. This is not required; for instance, an implementation may choose to handle GDL by reading it from strings compiled into the program. However, the standard Xconq library and implementation does adhere to the conventions described here.

A game module is a set of forms in a text file, which has an extension of `.g`.

By convention, the first form in the file is a `game-module` form that defines properties of the module. If the interface has any sort of preview for a particular module, it can then read only the first form, rather than the entire file.

Some interfaces include a game selection dialog, which lists a set of games from which to choose, along with a little information about each. The file `game.dir` in the library directory contains this list, which is simply a list of module name strings:

    (  ;; games that should appear in new game selection dialogs
    "1756"
    "cave"
    "cherbourg"
    "classic"
    "coral-sea"
    "crater-lake"
    )

Xconq does not currently enforce any sort of standard on file names, but for maximum portability, the file name should not include mixed case, it should consist only of alphabetic and numeric characters and hyphen, and should be less than 12 characters in length, with 8 of those distinct from any other name in the same directory. Since Xconq implementations typically use the file name as a way to find modules, these restrictions should apply to module names as well.

Image files are library files with the extension `.imf`. Usually each image file contains a group of images related in some way, perhaps by a common theme or by use in a particular game. Xconq implementations find images either by a method specific to the platform (such as resource files), or by looking up the image's location in the image directory `imf.dir`. The image directory is just a set of pairs of image name and imf file, with markers at beginning and end of the file:

    ImageFamilyName FileName
    amulet fantasy.imf
    ant insects.imf
    anvil-and-crown fantasy.imf
    ap standard.imf
    archer ancient.imf
    . .

Note that while `game.dir` is a GDL-syntax form, `imf.dir` is not. It should rarely be necessary to modify `imf.dir` directly; the scripts `makedir.sh` and `makedir.pl` in the standard library directory are Unix shell and Perl scripts, each of which will generate `imf.dir` from a given list of files, such as `*.imf` in the library. You should run one of these after adding a new image to a library image file.

Go to the first, previous, next, last section, table of contents.