Skip to content
Techniques & Technology

Z-Machine

The portable text adventure engine

Infocom's virtual machine that allowed text adventures to run identically on dozens of platforms, anticipating portable runtime concepts by decades.

cross-platform virtual-machineinfocomadventureinterpreter 1979–present

Overview

The Z-Machine was a virtual machine designed by Infocom for text adventure games, allowing a single game file to run on any platform with a Z-Machine interpreter. Created primarily by Marc Blank and Joel Berez, it let Infocom release games simultaneously on Apple II, Commodore 64, IBM PC, Atari, and dozens of other systems - all playing identically.

The concept anticipated Java and other portable runtimes by nearly two decades.

Fast Facts

  • Created: 1979
  • Designers: Marc Blank, Joel Berez
  • Company: Infocom
  • Versions: Z1 through Z8 (Z3 most common)
  • File extension: .z3, .z5, .z8, etc.
  • Modern use: Inform compiler targets Z-Machine

How It Worked

ComponentFunction
Story fileCompiled game data (platform-independent)
InterpreterPlatform-specific Z-Machine implementation
BytecodeInstructions for text, logic, world state
Memory modelEfficient use of limited RAM

Write the game once, compile to Z-Machine bytecode, run anywhere.

Technical Features

What the Z-Machine provided:

FeatureImplementation
Text handlingString compression, printing
ParserTokenisation support
Object modelRooms, items, NPCs
VariablesLocal and global state
StackSubroutine calls
I/OPlatform-abstracted input/output

Platform Support

Infocom released interpreters for:

  • Apple II, IIe, IIc
  • Commodore 64
  • Commodore 128
  • IBM PC and compatibles
  • Atari 400/800
  • Atari ST
  • Amiga
  • Macintosh
  • TRS-80
  • CP/M systems
  • Many more (25+ platforms total)

Version History

VersionYearCapability
Z11979Original (Zork)
Z21980Improved
Z31982Standard Infocom games
Z41985Larger games (A Mind Forever Voyaging)
Z51987Beyond Zork features
Z61988Graphics (Zork Zero)
Z8N/AExtended (community)

Modern Relevance

The Z-Machine lives on:

  • Inform 6/7 - Modern IF compilers target Z-Machine
  • Frotz - Popular modern interpreter
  • ZILF - Recreation of Infocom's ZIL
  • Thousands of games - New Z-Machine games still created

Comparison to Modern Runtimes

Z-Machine (1979)Java (1995)
Write once, run anywhereSame concept
BytecodeBytecode
Platform-specific interpreterJVM
Efficient memory useGarbage collection

Infocom solved the portability problem early.

Why It Mattered

The Z-Machine enabled:

  • Business model - One development, many platforms
  • Quality control - Same game everywhere
  • Focus - Designers could ignore hardware
  • Legacy - Games still playable today

ZIL — the Z-Machine source language

The Z-Machine wasn't designed in isolation — Infocom built ZIL (Zork Implementation Language), a Lisp-derived authoring language that compiled to Z-Machine bytecode. ZIL gave authors a high-level vocabulary for adventure-game concepts (objects, rooms, parser routines) while the compiler handled the low-level bytecode generation.

The ZIL → Z-Machine pipeline pre-figures modern compiler / VM architectures:

  • ZIL source files (.zil)
  • ZILCH compiler → Z-Machine bytecode
  • Z-Machine interpreter on target platform
  • Game runs identically anywhere with an interpreter

This was the same architecture Java would adopt 16 years later (Java source → bytecode → JVM → run anywhere). Infocom solved the portability problem far earlier than the industry recognised at the time.

Inform — the modern descendant

After Infocom's demise (1989), the format was reverse-engineered by the interactive-fiction community. Graham Nelson released Inform in 1993 — a free compiler that targets Z-Machine. Modern developments:

ToolNotes
Inform 6 (1996)C-style syntax; targets Z-Machine; still actively used
Inform 7 (2006)Natural-language syntax ("The book is in the library."); targets Z-Machine + Glulx
GlulxNewer VM by Andrew Plotkin; relaxes Z-Machine size limits
Frotz, Bocfel, ZMPPModern Z-Machine interpreters
Twine, ChoiceScriptDifferent tradition (web-native) but similar ethos

Hundreds of modern interactive-fiction games target the Z-Machine — the IFComp annual competition has run since 1995, with Z-Machine games as a major category each year.

See Also