Z-machine

Last updated
Z-machine
Designer Infocom
Bits16
Introduced1979
Version1.1 (2014)
Design CISC
Endianness Big
OpenYes

The Z-machine is a virtual machine that was developed by Joel Berez and Marc Blank in 1979 and used by Infocom for its text adventure games. Infocom compiled game code to files containing Z-machine instructions (called story files or Z-code files) and could therefore port its text adventures to a new platform simply by writing a Z-machine implementation for that platform. With the large number of incompatible home computer systems in use at the time, this was an important advantage over using native code or developing a compiler for each system.

Contents

History

The "Z" of Z-machine stands for Zork, Infocom's first adventure game. Z-code files usually have names ending in .z1, .z2, .z3, .z4, .z5, .z6, .z7, or .z8, where the number is the version number of the Z-machine on which the file is intended to be run, as given by the first byte of the story file. [1]

This is a modern convention, however. Infocom itself used extensions of .dat (Data) and .zip (ZIP = Z-machine Interpreter Program), but the latter clashed with the widespread use of .zip for PKZIP-compatible archive files starting in the 1990s, after Activision closed Infocom. Infocom produced six versions of the Z-machine. Files using versions 1 and 2 are very rare. Only two version 1 files are known to have been released by Infocom and only two of version 2. Version 3 covers the majority of Infocom's released games. Later versions had more capabilities, culminating in some graphic support in version 6.

The compiler (called Zilch) that Infocom used to produce its story files has never been released, although documentation of the language used called ZIL, a Lisp-family language similar to MDL, still exists, and an open-source replacement "ZILF" [2] has been written. After Mediagenic moved Infocom to California in 1989, Computer Gaming World stated that "ZIL ... is functionally dead", and reported rumors of a "completely new parser that may never be used". [3] In May 1993, Graham Nelson released the first version of his Inform compiler, which also generates Z-machine story files as its output, even though the Inform source language is quite different from ZIL.

Inform has become popular in the interactive fiction community. A large proportion of interactive fiction is in the form of Z-machine story files. Demand for the ability to create larger game files led Nelson to specify versions 7 and 8 of the Z-machine, though version 7 is rarely used. Because of the way addresses are handled, a version 3 story file can be up to 128K in length, a version 5 story can be up to 256K in length, and a version 8 story can be up to 512k in length. Though these sizes may seem small by today's computing standards, for text-only adventures, these are large enough for elaborate games.

During the 1990s, Graham Nelson drew up a Z-Machine Standard based on detailed studies of the existing Infocom files. The standard also includes extensions used by his newer versions, as well as links to the "Blorb" resource format used by Infocom, and a "Quetzal" savefile format. [4] In 2006, Nelson expanded Z-machine to the 32-bit Glulx format for Inform 7. The Interactive Fiction Technology Foundation, founded 2016, manages all these standards. [5]

ZIL (Zork Implementation Language)

The ZIL is based on MDL from MIT. Here is the definition of Zork I's brass lantern:

<OBJECTLANTERN(LOCLIVING-ROOM)(SYNONYMLAMPLANTERNLIGHT)(ADJECTIVEBRASS)(DESC"brass lantern")(FLAGSTAKEBITLIGHTBIT)(ACTIONLANTERN-F)(FDESC"A battery-powered lantern is on the trophy case.")(LDESC"There is a brass lantern (battery-powered) here.")(SIZE15)>

A more complex example involving combat, along with its MDL Zork equivalent, is presented in an 2019 blog post by Andrew Plotkin. Notably, the Z-machine has no support for garbage collection and ZIL has no concept of Lisp's list system. [6]

Interpreters

An implementation of Frotz running on an iPhone, playing the MIT version of Zork. Zork on Frotz on iPhone.jpg
An implementation of Frotz running on an iPhone, playing the MIT version of Zork .

Interpreters for Z-code files are available on a wide variety of platforms. The Inform website lists links to freely available interpreters for 15 desktop operating systems (including 8-bit microcomputers from the 1980s such as the Apple II, TRS-80, and ZX Spectrum , and grouping "Unix" and "Windows" as one each), 10 mobile operating systems (including Palm OS and the Game Boy), and four interpreter platforms (Emacs, Java, JavaScript, and Scratch). According to Nelson, it is "possibly the most portable virtual machine ever created". [7]

Popular interpreters include Nitfol and Frotz. Nitfol makes use of the Glk API, and supports versions 1 through 8 of the Z-machine, including the version 6 graphical Z-machine. Save files are stored in the standard Quetzal save format. Binary files are available for several different operating systems, including the classic Mac OS, Unix-like systems, DOS, and Windows. [8]

Frotz was written in C by Stefan Jokisch in 1995 for DOS. Over time it was ported to other platforms, such as Unix-like systems, [9] RISC OS, [10] and iOS. [11] Sound effects and graphics were supported to varying degrees. By 2002, development stalled and the program was picked up by David Griffith. The code base was split between virtual machine and user interface portions in such a way that the virtual machine became independent from any user interface. This allowed more variety in porting Frotz. One of the stranger ports is also one of the simplest: an instant messaging bot is wrapped around a version of Frotz with the minimum I/O functionality creating a bot with which one can play most Z-machine games using an instant messaging client. [12]

Another popular client for macOS and other Unix-like systems is Zoom. [13] It supports the same Quetzal save-format, but the packaging of the file-structure is different.

See also

Related Research Articles

Infocom was an American software company based in Cambridge, Massachusetts, that produced numerous works of interactive fiction. They also produced a business application, a relational database called Cornerstone.

Interactive fiction, often abbreviated IF, is software simulating environments in which players use text commands to control characters and influence the environment. Works in this form can be understood as literary narratives, either in the form of Interactive narratives or Interactive narrations. These works can also be understood as a form of video game, either in the form of an adventure game or role-playing game. In common usage, the term refers to text adventures, a type of adventure game where the entire interface can be "text-only", however, graphical text adventure games, where the text is accompanied by graphics still fall under the text adventure category if the main way to interact with the game is by typing text. Some users of the term distinguish between interactive fiction, known as "Puzzle-free", that focuses on narrative, and "text adventures" that focus on puzzles.

<i>Zork</i> 1977 video game

Zork is a text adventure game first released in 1977 by developers Tim Anderson, Marc Blank, Bruce Daniels, and Dave Lebling for the PDP-10 mainframe computer. The original developers and others, as the company Infocom, expanded and split the game into three titles—Zork I: The Great Underground Empire, Zork II: The Wizard of Frobozz, and Zork III: The Dungeon Master—which were released commercially for a range of personal computers beginning in 1980. In Zork, the player explores the abandoned Great Underground Empire in search of treasure. The player moves between the game's hundreds of locations and interacts with objects by typing commands in natural language that the game interprets. The program acts as a narrator, describing the player's location and the results of the player's commands. It has been described as the most famous piece of interactive fiction.

Inform is a programming language and design system for interactive fiction originally created in 1993 by Graham Nelson. Inform can generate programs designed for the Z-code or Glulx virtual machines. Versions 1 through 5 were released between 1993 and 1996. Around 1996, Nelson rewrote Inform from first principles to create version 6. Over the following decade, version 6 became reasonably stable and a popular language for writing interactive fiction. In 2006, Nelson released Inform 7, a completely new language based on principles of natural language and a new set of tools based around a book-publishing metaphor.

Text Adventure Development System (TADS) is a prototype-based domain-specific programming language and set of standard libraries for creating interactive fiction (IF) games.

Quetzal is a standardised file format for the saved state of Z-machine games, invented by Martin Frost. Prior to the introduction of Quetzal, each Z-machine interpreter saved games in its own format; Quetzal enabled players to save a game using one interpreter and restore it with another. Use of the format is strongly recommended in Graham Nelson's Z-machine standards document, but not obligatory. Most modern Z-machine interpreters have the ability to save Quetzal files.

Glulx is a 32-bit portable virtual machine intended for writing and playing interactive fiction. It was designed by Andrew Plotkin to relieve some of the restrictions in the venerable Z-machine format. For example, because the Z-machine uses 16-bit integers its RAM is limited to 64KB, while Glulx natively supports 32-bit integers and has a 32-bit address space, allowing gigabytes of memory. Glulx programs typically use the Glk API for input and output. In recent years Glulx has overtaken the Z-machine in terms of published works in each format.

<span class="mw-page-title-main">Phoenix (computer)</span> IBM mainframe computer

Phoenix was an IBM mainframe computer at Cambridge University's Computer Laboratory. "Phoenix/MVS" was also the name of the computer's operating system, written in-house by Computer Laboratory members. Its DNS hostname was phx.cam.ac.uk.

MDL is a programming language, a descendant of the language Lisp. Its initial purpose was to provide high level language support for the Dynamic Modeling Group at Massachusetts Institute of Technology's (MIT) Project MAC. It was developed in 1971 on a PDP-10 running ITS and later ran on TENEX, TOPS-20, BSD, and AEGIS.

<span class="mw-page-title-main">Andrew Plotkin</span> Interactive fiction programmer and writer

Andrew Plotkin, also known as Zarf, is a central figure in the modern interactive fiction (IF) community. Having both written a number of award-winning games and developed a range of new file formats, interpreters, and other utilities for the design, production, and running of IF games, Plotkin is widely recognised for both his creative and his technical contributions to the homebrew IF scene.

<span class="mw-page-title-main">Cornerstone (software)</span> Relational database for MS-DOS

Cornerstone is a relational database for MS-DOS released by Infocom, a company best known in the 1980s for developing interactive fiction video games. Initially hailed upon release in 1985 for its ease of use, a series of shortcomings and changes in the market kept Cornerstone from achieving success. It is considered a key factor in Infocom's demise.

<i>The Lost Treasures of Infocom</i> 1991 video game

The Lost Treasures of Infocom is a 1991 compilation of 20 previously-released interactive fiction games developed by Infocom. It was published by Activision for MS-DOS, Macintosh, Amiga, and Apple IIGS versions. It was later re-released on CD-ROM, and in 2012 on iOS.

<span class="mw-page-title-main">Level 9 Computing</span> Video game developer and publisher

Level 9 was a British developer of computer software, active between 1981 and 1991. Founded by Mike, Nicholas and Pete Austin, the company produced software for the BBC Micro, Nascom, ZX Spectrum, Commodore 64, Oric, Atari 8-bit computers, Lynx 48k, RML 380Z, Amstrad CPC, MSX, Amiga, Apple II, Memotech MTX, and Enterprise platforms and is best known for its successful text adventure games until a general decline in the text adventure market forced their closure in June 1991.

Tim Anderson is an American computer programmer best known for co-creating the adventure game Zork, one of the first works of interactive fiction and an early descendant of ADVENT.

<i>Enchanter</i> (video game) 1983 video game

Enchanter is an interactive fiction game written by Marc Blank and Dave Lebling and published by Infocom in 1983. The first fantasy game published by Infocom after the Zork trilogy, it was originally intended to be Zork IV. The game has a parser that understands over 700 words, making it the most advanced interactive fiction game of its time. It was Infocom's ninth game.

Blorb is a package format for interactive fiction games. Many such games incorporate resources such as sound effects, music, or pictures. Blorb's purpose is to bind these together into one file. The format was devised by Andrew Plotkin and is used in both the Z-machine and Glulx virtual machines, as well as by the Glk library.

<i>Beyond Zork</i> 1987 video game

Beyond Zork is an interactive fiction computer game written by Brian Moriarty and released by Infocom in 1987. It was one of the last games in the Zork series developed by Infocom. It signified a notable departure from the standard format of Infocom's earlier games which relied purely on text and puzzle-solving: among other features, Beyond Zork incorporated a crude on-screen map, the use of character statistics and levels, and RPG combat elements.

<i>Zork: The Undiscovered Underground</i> 1997 video game

Zork: The Undiscovered Underground is an interactive fiction video game written by former Infocom Implementors Marc Blank and Michael Berlyn and implemented by G. Kevin Wilson using the Inform language. The game was commissioned by Activision as a free promotional product to coincide with the release of Zork: Grand Inquisitor. It was released on August 28, 1997.

<i>The Witness</i> (1983 video game) 1983 video game

The Witness is an interactive fiction video game published by Infocom in 1983. Like Infocom's earlier title Deadline, it is a murder mystery. The Witness was written in the ZIL language for the Z-machine, which allowed it to be released simultaneously on many systems. It is Infocom's seventh game.

A Change in the Weather is a 1995 interactive fiction (IF) video game.

References

  1. "The Z-Machine Standards Document". inform-fiction.org. Retrieved 26 March 2018.
  2. McGrew, Jesse. "ZILF". zilf.io. Retrieved 22 November 2020.
  3. "Inside the Industry: Infocom's West Coast Move Stirs Controversy". Computer Gaming World . No. 63. September 1989. p. 10.
  4. "Inform - ZMachine - Standards". inform-fiction.org. Retrieved 26 March 2018.
  5. "Glk, Glulx, and Blorb Specifications". Interactive Fiction Technology Foundation. 16 November 2022.
  6. Plotkin, Andrew (April 17, 2019). "What is ZIL anyway?". Zarf.
  7. Nelson, Graham. "About Interpreters". Inform website. Retrieved 2009-11-07.
  8. "if-archive/infocom/interpreters/nitfol" . Retrieved 2016-10-29.
  9. "Frotz README file on Gitlab" . Retrieved 2019-02-19.
  10. "The RISC OS Frotz Home Page". 1999-09-18.
  11. "Frotz on the App Store". App Store.
  12. "Frotz DUMB file on Gitlab" . Retrieved 2019-02-19.
  13. "Logical Shift Zoom" . Retrieved 2016-10-29.