Jump to content

Z-machine

From Wikipedia, the free encyclopedia
(Redirected from .z3)
Z-machine
DesignerInfocom
Bits16
Introduced1979
Version1.1 (2014)
DesignCISC
EndiannessBig
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.

History

[edit]

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)

[edit]

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

<OBJECT LANTERN
  (LOC LIVING-ROOM)
  (SYNONYM LAMP LANTERN LIGHT)
  (ADJECTIVE BRASS)
  (DESC "brass lantern")
  (FLAGS TAKEBIT LIGHTBIT)
  (ACTION LANTERN-F)
  (FDESC "A battery-powered lantern is on the trophy case.")
  (LDESC "There is a brass lantern (battery-powered) here.")
  (SIZE 15)>

A more complex example involving combat, along with its MDL Zork equivalent, is presented in a 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

[edit]
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

[edit]
  • Glulx – Similar to the Z-machine, but relieves several legacy limitations
  • Inform – A computer language that can produce Z-machine programs
  • SCUMMScript Creation Utility for Maniac Mansion by LucasArts, a graphical system similar to Z-machine
  • TADS – Like Glulx, made to address some of its limitations
  • Motorola 68000 series – The base architecture used for virtual machines in Magnetic Scrolls' adventure games

References

[edit]
  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.
[edit]