**Draft**
Interactive Fiction XML metadata format
Version 1.0 (Draft) August 3, 2005 by Andrew Hunter Contents
1 Introduction 2 1.1 Who should use this format? ...... 2
2 The format 3 2.1 The root element: ifindex ...... 3 2.2 The story tag: story ...... 3 2.3 The story identification tag: identification ...... 3 2.3.1 Example ...... 4 2.3.2 Z-Code identification tag: zcode ...... 4 2.3.3 Glulx identification ...... 4 2.3.4 MD5 identification ...... 5 2.4 The metadata tags ...... 5
3 Optional modules 7 3.1 The feelies module ...... 7 3.2 The comments module ...... 7 3.3 The resources module ...... 7 3.4 The review module ...... 8
4 Parsing notes 9
5 Attaching metadata 10 5.1 To z-code games ...... 10 5.2 In filesystem metadata ...... 10 5.3 To archive sites ...... 10 5.4 To review sites ...... 10
1 1 Introduction
The original inspiration of this format is an improvement on the existing interactive fiction cataloguing system in Zoom. The original design for this used a text file with an arbitrary format, mainly designed for storing interpreter settings. It was also capable of storing some limited metadata along with stories, in particular a full title for the story, which was used in the interpreter’s title bar, and also to provide a simple menu of stories. This format is intended to provide a more advanced indexing system for stories. It deals specifically with metadata aspects of stories, leaving interpreter configuration issues up to specific interpreters. This release (1.0) will be implemented in the 1.0.2 release of Zoom. The initial emphasis is on Z-Code stories, but the intention is to allow the indexing of stories in any of the formats currently in use. A simpler format (0.9) was originally used by Zoom. This new version is based on the results of a discussion on the Inform-developers mailing list.
1.1 Who should use this format?
Initially, this format will be used by Zoom to provide a searchable list of stories. However, I hope eventually to encourage archive maintainers and other interpreter authors to make use of the format. In addition, story authors may want to provide an XML description file along with their stories.
2 2 The format
All metadata index files are in XML format, and so begin with a line. The namespace URI is http://www.logicalshift.org.uk/IF/metadata. The metadata may be extended by addi- tional modules, which must have their own unique namespace. Parsers must always identify namespaces by URI and not by prefix. The metadata for a story may come from many different files. For example, an archive site may provide an index of games, a review site may provide reviews, the game author may provide ’feelies’ (resources associated with the story), and the user may provide notes and comments. Modules are intended to be ’functionally unique’, providing the data for one of these specific domains. Therefore, when an application fetches metadata from multiple locations, it might use the entire resources module from one place and the review module from another, but won’t merge parts of the resources section from one site with those provided by another.
2.1 The root element: ifindex
This tag specifies the version of the IF metadata format with the ’version’ attribute (0.9 for a file con- forming to this document). Usually, this should also specify the namespace URI and XML schema location.
The tag contains
2.2 The story tag: story
The
2.3 The story identification tag: identification
The
zcode A Z-Code story of the type released by Infocom in the 1980s, or, more recently, compiled with the Z-Code version of Inform.
glulx A glulx story of the type compiled by the Glulx version of Inform.
The following additional types are reserved for other existing formats, and may have identification tags defined in the future:
3 tads A TADS story compiled by the TADS compiler. hugo A HUGO story compiled by the HUGO compiler. alan An Alan story adrift An Adrift story level9 A story in the Level 9 format AGT A story in the AGT format magscrolls A story in the magnetic scrolls format advsys A story in the advsys format
2.3.1 Example
2.3.2 Z-Code identification tag: zcode
The
2.3.3 Glulx identification
ULX format files do not contain any specific story identification information. However, those compiled by Inform may contain a short ’Info’ section located after the header. The
4 2.3.4 MD5 identification
Any story format may have an MD5 section. This is a hexadecimal representation of the MD5 checksum of a story file. In the case of a Blorb file, this is the MD5 checksum of the executable portion of the file (the Z-Code or Glulx code file that it contains) rather than the entire file. There are several utilities available for generating MD5 checksums, for example the ’md5’ utility that comes with OpenSSL. Any story
2.4 The metadata tags
Each metadata tag may appear zero or one times as a child of the
The ’Zarfian’ rating system is described by Andrew Plotkin as follows:
Merciful cannot get stuck
Polite can get stuck or die, but it’s immediately obvious that you’re stuck or dead
Tough can get stuck, but it’s immediately obvious that you’re about to do something irrevocable
Nasty can get stuck, but when you do something irrevocable, it’s clear
Cruel can get stuck by doing something which isn’t obviously irrevocable (even after the act)
Comments and teasers may contain newlines, specified by a
tag: all other tags are single line values. No tag may appear more than once. The genre can be any textual value, but Zoom suggests the following list of ’standard’ genres:
• Fantasy
5 • Science fiction
• Horror
• Fairy tale
• Surreal
• Mystery
• Romance
• Historical
• Humour
• Parody
• Speed-IF
• Arcade
• Interpreter abuse
6 3 Optional modules
3.1 The feelies module
This module can be used to specify ’feelies’: additional media associated with a game. The namespace URI for this module is http://www.logicalshift.org.uk/IF/metadata/feelies The tags supported by this module are:
All of these tags should have a ’title’ attribute, indicating a name that should be displayed in association with the feelie.
3.2 The comments module
This module is intended for data designed to be set by the user of a game, and should not appear in meta- data files generated by game or interpreter authors. Its namespace URI is http://www.logicalshift.org.uk/IF/metadata/comments The tags supported by this module are:
3.3 The resources module
Certain game formats allow for external resource files, and nearly all of them specify an external save game format. This module is used to describe the location of these files. The namespace URI for this module is http://www.logicalshift.org.uk/IF/metadata/resources The tags supported by this module are:
Resources may be provided in an archive file, but are typically overridden by an interpreter to point to local versions of the resources (particularly savegames). Tags may appear multiple times if a story has many resources of a particular type.
7 3.4 The review module
Review sites may wish to provide review metadata. Reviews can be provided as plain text or as an embedded XHTML document. Implementors might want to consider providing an interface to switch between reviews when multiple sources provide them. The namespace URI for this module is http://www.logicalshift.org.uk/IF/metadata/review The review tags are as follows:
8 4 Parsing notes
Zoom provides an implementation of this standard (actually, at present, the 0.9 standard) in the ifmeta- data.c file provided as part of the source code. This can easily be used in other projects: it depends on the expat library but nothing else. In addition to parsing the metadata, it handles managing the results: adding new stories, saving the results, etc. (MORE TO DO)
9 5 Attaching metadata
5.1 To z-code games
This section describes a technique by which XML metadata can be made part of a Z-Code game. Other file formats may already have methods for attaching metadata. This technique is similar to the ID3 tag method used with mp3 files. Z-Code files can be any length: file size limits are only imposed by the range of locations that can be addressed. As metadata does not need to be addressed by the game, it can be appended to a story file, even if that file is at the upper limit of the size permitted by the version (this is particularly important when large resources such as icons are provided). Some interpreters may not support this with large files however, and game authors should be made aware of this possibility (most I have inspected do, however). Metadata should be the last thing in a file. However, this format specifies lead-in and lead-out so that it can appear elsewhere if necessary. It’s expected that most implementations will only appear at the end. Metadata is preceded by a 12 byte lead-in, consisting of the 8-byte sequence ’IFMd0100’ indicating metadata and the version number, followed by a 4 byte big-endian length. The XML metadata itself follows this, followed by a 12 byte lead-out: the 4 byte big-endian length, followed by the sequence ’0100IFMd’. Implementations can look for the ’0100IFMd’ sequence at the end of a file to determine if metadata is present. (TODO: metadata and the story checksum?)
5.2 In filesystem metadata 5.3 To archive sites 5.4 To review sites
10