Back to blog

Microsoft Releases Zork Code as Open-Source: The History of Text Games

Hello HaWkers, Microsoft surprised the developer and gamer community by releasing the source code of Zork I, II, and III under the MIT license. This move preserves a fundamental part of computing and video game history, making it accessible for study and modification.

Why does a nearly 50-year-old game still matter to modern developers? Let's explore the history, the code, and what we can learn from this classic.

What Is Zork

For those unfamiliar, Zork is a series of text-based adventure games created in the late 1970s. The player explores a vast underground world by typing commands in natural language.

Gameplay Example

West of House
You are standing in an open field west of a white house,
with a boarded front door.
There is a small mailbox here.

> open mailbox
Opening the small mailbox reveals a leaflet.

> read leaflet
"WELCOME TO ZORK!
ZORK is a game of adventure, danger, and low cunning..."

> go north
North of House
You are facing the north side of a white house...

Historical Importance

Milestones achieved:

  • One of the first commercial computer games
  • Pioneer in natural language processing
  • Influenced the entire adventure game industry
  • Sold over 1 million copies at the time

Timeline:

  • 1977: Original version created at MIT
  • 1979: Infocom founded
  • 1980-1982: Launch of Zork I, II, and III
  • 1986: Infocom acquired by Activision
  • 2023: Activision acquired by Microsoft
  • 2025: Code released as open-source

Why Microsoft Released the Code

The decision to make Zork open-source reflects a growing trend in digital heritage preservation.

Microsoft's Motivations

Stated reasons:

  • Historical preservation
  • Educational value of the code
  • Positive public relations
  • Zero maintenance cost

Benefits for the community:

  • Study of parsing techniques
  • Game design analysis
  • Base for educational projects
  • Preservation of computing history

💡 Context: Microsoft has gradually released historical code, including MS-DOS and GW-BASIC, as part of preservation initiatives.

Exploring Zork's Code

Zork's code was written in ZIL (Zork Implementation Language), a language derived from LISP created specifically for text games.

Project Structure

The repository contains:

Main files:

  • /zork1/ - Zork I source code
  • /zork2/ - Zork II source code
  • /zork3/ - Zork III source code
  • /zilf/ - Compilation tools
  • /docs/ - Original documentation

ZIL Code Example

<ROOM WHITE-HOUSE
    (DESC "West of House")
    (IN ROOMS)
    (LDESC "You are standing in an open field west of a white house,
            with a boarded front door.")
    (EAST TO BEHIND-HOUSE IF WINDOW IS OPEN)
    (WEST TO FOREST-1)
    (NORTH TO NORTH-OF-HOUSE)
    (SOUTH TO SOUTH-OF-HOUSE)
    (FLAGS OUTSIDEBIT ONBIT)
    (GLOBAL WHITE-HOUSE BOARD FOREST)>

<OBJECT MAILBOX
    (DESC "small mailbox")
    (IN WHITE-HOUSE)
    (SYNONYM MAILBOX BOX)
    (ADJECTIVE SMALL)
    (FLAGS CONTBIT)
    (ACTION MAILBOX-F)
    (CAPACITY 10)>

<ROUTINE MAILBOX-F ()
    <COND (<VERB? OPEN>
           <COND (<FSET? ,MAILBOX ,OPENBIT>
                  <TELL "It's already open." CR>)
                 (T
                  <FSET ,MAILBOX ,OPENBIT>
                  <TELL "Opening the small mailbox reveals a leaflet." CR>)>)>>

This code defines the starting room and mailbox, showing how objects and interactions were programmed.

The Natural Language Parser

One of Zork's most impressive aspects was its natural language parser, advanced for its time.

Parser Capabilities

Commands that worked:

  • "open the mailbox" (basic)
  • "put the sword in the case" (prepositions)
  • "give the treasure to the troll" (indirect objects)
  • "take all but the lamp" (exceptions)
  • "examine the painting carefully" (adverbs)

Parser Architecture

Zork's parser worked in layers:

Processing steps:

  1. Word tokenization
  2. Verb and noun identification
  3. Pronoun resolution (it, them)
  4. Object disambiguation
  5. Action execution

Known limitations:

  • Finite vocabulary (~1000 words)
  • Some constructions not recognized
  • Generic responses for unknown commands

🔥 Fun fact: Many techniques used in Zork's parser influenced the development of chatbots and virtual assistants decades later.

Lessons For Modern Developers

Zork's code offers valuable insights about software design, even 50 years later.

Timeless Principles

1. Resource economy:
Zork ran on computers with 64KB of RAM. Developers were forced to optimize every byte.

2. Data-oriented design:
Rooms, objects, and actions were defined declaratively, separating data from logic.

3. User experience:
Despite technical limitations, the game prioritized clear feedback and natural responses.

4. Modularity:
The code was organized to allow expansion and maintenance.

Modern Applications

Concepts we still use:

  • State machines for game flow
  • User input parsing
  • Inventory systems
  • Procedural world building

Areas that evolved:

  • Modern NLP uses transformers, not rules
  • Graphics replaced text in mainstream games
  • RAM and storage are abundant
  • But elegance still matters

How to Run and Modify Zork

If you want to experiment with the code, here's how to get started.

Prerequisites

Required tools:

  • Git to clone the repository
  • ZILF (Zork Implementation Language Formatter)
  • Frotz or another Z-machine interpreter

Step by Step

1. Clone the repository:

git clone https://github.com/microsoft/zork.git
cd zork

2. Install ZILF:

# On macOS with Homebrew
brew install zilf

# On Ubuntu/Debian
sudo apt-get install zilf

# Or compile from source
git clone https://github.com/zilf/zilf.git
cd zilf && make

3. Compile the game:

cd zork1
zilf zork1.zil

4. Run with Frotz:

frotz zork1.z5

Modifying the Game

Try adding a new room:

<ROOM MY-ROOM
    (DESC "Developer's Den")
    (IN ROOMS)
    (LDESC "You are in a cozy room filled with vintage computers.
            The glow of CRT monitors illuminates ancient code.")
    (NORTH TO WHITE-HOUSE)
    (FLAGS LIGHTBIT)>

The Legacy of Text Games

Zork represents an era where the player's imagination completed the experience. This legacy lives on.

Interactive Fiction Today

Active community:

  • IFComp (annual IF competition)
  • Modern tools like Inform 7, Twine
  • Thousands of free games available
  • Use in education and therapy

Recommended tools:

  • Inform 7: Natural language for IF
  • Twine: IF with hyperlinks, visual
  • Ink: Inkle's engine (80 Days, Sorcery!)
  • ChoiceScript: For "choose your adventure" style games

Industry Influence

Games that inherited Zork's DNA:

  • LucasArts adventure games
  • Japanese visual novels
  • Modern walking simulators
  • Text-based RPG elements

Concepts that persist:

  • Command parser in games
  • Atmospheric descriptions
  • Inventory-based puzzles
  • Non-linear narrative

The Future of Code Preservation

Zork's release raises questions about preserving historical software.

Why Preserve Old Code?

Arguments in favor:

  • Computing history deserves preservation
  • Old code has educational value
  • Techniques can be rediscovered
  • Digital cultural heritage

Challenges:

  • Complex licensing
  • Proprietary code from defunct companies
  • Dependencies on obsolete hardware
  • Lack of documentation

Preservation Initiatives

Active organizations:

  • Software Preservation Network
  • Internet Archive (archive.org)
  • Computer History Museum
  • GitHub Archive Program

Conclusion

The release of Zork's code is more than nostalgia. It's an opportunity to study how past developers solved complex problems with limited resources. Parsing techniques, interaction design, and resource economy are valuable lessons even in the era of teraflop GPUs and terabytes of RAM.

For curious developers, exploring Zork's code is a time travel that illuminates the present. The foundations of interactive computing are there, written in LISP, waiting to be discovered.

If you're interested in programming history and how we got here, I recommend checking out another article: Introduction to Modern JavaScript ECMAScript 6 where you'll discover how the most popular web language evolved over the years.

Let's go! 🦅

Comments (0)

This article has no comments yet 😢. Be the first! 🚀🦅

Add comments