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.
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
| Component | Function |
|---|---|
| Story file | Compiled game data (platform-independent) |
| Interpreter | Platform-specific Z-Machine implementation |
| Bytecode | Instructions for text, logic, world state |
| Memory model | Efficient use of limited RAM |
Write the game once, compile to Z-Machine bytecode, run anywhere.
Technical Features
What the Z-Machine provided:
| Feature | Implementation |
|---|---|
| Text handling | String compression, printing |
| Parser | Tokenisation support |
| Object model | Rooms, items, NPCs |
| Variables | Local and global state |
| Stack | Subroutine calls |
| I/O | Platform-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
| Version | Year | Capability |
|---|---|---|
| Z1 | 1979 | Original (Zork) |
| Z2 | 1980 | Improved |
| Z3 | 1982 | Standard Infocom games |
| Z4 | 1985 | Larger games (A Mind Forever Voyaging) |
| Z5 | 1987 | Beyond Zork features |
| Z6 | 1988 | Graphics (Zork Zero) |
| Z8 | N/A | Extended (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 anywhere | Same concept |
| Bytecode | Bytecode |
| Platform-specific interpreter | JVM |
| Efficient memory use | Garbage 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