**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 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 -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. (2.1)

The tag contains tags, one for each story that is defined in the file.

2.2 The story tag: story

The tag is used to specify the data associated with a particular story. It must contain at least one section, and may contain one or more metadata tags. It appears only as a child of the ifindex tag. The section may be omitted if the metadata is associated with a game in some other fashion (for example if it is contained in a file).

2.3 The story identification tag: identification

The tag appears as part of a section, and must contain a tag identifying the format of the story, and some data providing a unique ID for the story. It appears only as a child of , which must contain at least one of these tags, but may contain many if a story has several different versions. The tag is a synonym for the tag. The tag contains textual data identifying the format of the story. This version of the specifica- tion defines identification tags for the following formats:

zcode A Z-Code story of the type released by 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

zcode 871125 52 (2.2) 4b37 d82484e664a8c328364e9814d1f73c60

2.3.2 Z-Code identification tag: zcode

The tag is used only when the value is ’zcode’. In that case, it must appear exactly once as a child of an tag. It should contain the following elements:

The textual serial number of the story. This is usually a six-digit string specifying the date of release, such as 871125. The release number of the story (for example, 52). (Optional, but recommended) The checksum of the story, in hexadecimal format, as spec- ified in the header of the story (for example, 4b37). This field is optional, but note that the se- rial/release numbers are not guaranteed to be unique, especially with more recent stories.

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 section is therefore optional, and only applies to stories compiled with Inform. An section should be used to more precisely identify a Glulx story. The section may contain the following tags:

The textual serial number of the story. This is usually a six-digit string specifying the date of release, such as 030501. The release number of the story (for example, 2).

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 may have an section, although the format-specific identification should be used for preference as it will be easier to write for a story author.

2.4 The metadata tags

Each metadata tag may appear zero or one times as a child of the tag. The following tags are defined:

The title of the story (for example, Zork 1, Solid Gold Edition)</p><p><author> The author of the story</p><p><genre> The genre of the story (Fantasy)</p><p><published> The date the story was first published in YYYYMMDD format (19810505)</p><p><revision> The revision number of the game</p><p><headline> The headline of the story (Infocom interactive fiction - a fantasy story)</p><p><group> The ’group’ the story is in (for example, ’Infocom’, ’Competition 1998’, etc)</p><p><zarfian> The story’s rating according to the ’Zarfian’ scale (’Merciful’, ’Polite’, ’Tough’, ’Nasty’, ’Cruel’)</p><p><teaser> The story’s teaser text</p><p><series> Specifies the series that a game is part of</p><p><seriesnumber> Specifies the number in the series the game is</p><p><serieslength> Specifies the length of the game series</p><p>The ’Zarfian’ rating system is described by <a href="/tags/Andrew_Plotkin/" rel="tag">Andrew Plotkin</a> as follows:</p><p>Merciful cannot get stuck</p><p>Polite can get stuck or die, but it’s immediately obvious that you’re stuck or dead</p><p>Tough can get stuck, but it’s immediately obvious that you’re about to do something irrevocable</p><p>Nasty can get stuck, but when you do something irrevocable, it’s clear</p><p>Cruel can get stuck by doing something which isn’t obviously irrevocable (even after the act)</p><p>Comments and teasers may contain newlines, specified by a <br /> 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:</p><p>• Fantasy</p><p>5 • Science fiction</p><p>• Horror</p><p>• Fairy tale</p><p>• Surreal</p><p>• Mystery</p><p>• Romance</p><p>• Historical</p><p>• Humour</p><p>• Parody</p><p>• Speed-IF</p><p>• Arcade</p><p>• Interpreter abuse</p><p>6 3 Optional modules</p><p>3.1 The feelies module</p><p>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:</p><p><icon> A miniature picture associated with the game. This should be a base 64 encoded PNG file of 128x128 size, and can be used by an interpreter to display an image associated with a game file. <image> A URL of an image associated with the game. Images should be of PNG or JPEG format. <pdf> A URL of a PDF document associated with the game. Can have an optional ’page’ attribute to indicate that the pdf file should be opened to a particular page (intended to be used with the masterpieces CD documentation).</p><p>All of these tags should have a ’title’ attribute, indicating a name that should be displayed in association with the feelie.</p><p>3.2 The comments module</p><p>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:</p><p><comment> Any user comments on the story <rating> The user rating, a value between 0 and 10 where 0=worst and 10=best. <feelies> External files, images and data associated with the game</p><p>3.3 The resources module</p><p>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:</p><p><story> The URL of a file containing the story itself <graphics> The URL of a file containing graphics for the story (in the case of a format like blorb, may be identical to <sounds>) <sounds> The URL of a file containing sounds for the story (in the case of a format like blorb, may be identical to <graphics>) <savegame tag="Something" date="savedate"> The URL of a savegame for the story (multiple saveg- ames are permitted.). The tag is a tag associated with the savegame (Zoom uses a summary of the status bar contents here), and the date specifies when the savegame was created.</p><p>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.</p><p>7 3.4 The review module</p><p>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:</p><p><url> A URL of a web page associated with this review.</p><p><author> The name of the author(s) of the review</p><p><rating> (Optional) A decimal value from 0-10 indicating the overall review rating</p><p><text> The text of the review</p><p><xhtml> (Optional replacement for text) The review as an XHTML format document</p><p>8 4 Parsing notes</p><p>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)</p><p>9 5 Attaching metadata</p><p>5.1 To z-code games</p><p>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?)</p><p>5.2 In filesystem metadata 5.3 To archive sites 5.4 To review sites</p><p>10</p> </div> </article> </div> </div> </div> <script type="text/javascript" async crossorigin="anonymous" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8519364510543070"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script> var docId = '28063e3683ad91471cd78790926e4bf6'; var endPage = 1; var totalPage = 11; var pfLoading = false; window.addEventListener('scroll', function () { if (pfLoading) return; var $now = $('.article-imgview .pf').eq(endPage - 1); if (document.documentElement.scrollTop + $(window).height() > $now.offset().top) { pfLoading = true; endPage++; if (endPage > totalPage) return; var imgEle = new Image(); var imgsrc = "//data.docslib.org/img/28063e3683ad91471cd78790926e4bf6-" + endPage + (endPage > 3 ? ".jpg" : ".webp"); imgEle.src = imgsrc; var $imgLoad = $('<div class="pf" id="pf' + endPage + '"><img src="/loading.gif"></div>'); $('.article-imgview').append($imgLoad); imgEle.addEventListener('load', function () { $imgLoad.find('img').attr('src', imgsrc); pfLoading = false }); if (endPage < 7) { adcall('pf' + endPage); } } }, { passive: true }); </script> <script> var sc_project = 11552861; var sc_invisible = 1; var sc_security = "b956b151"; </script> <script src="https://www.statcounter.com/counter/counter.js" async></script> </html>