Zork (Dungeon) built with Zig 0.17, wrapping the C port of the MIT mainframe game in one executable with its game data embedded.
README.md
<!-- SPDX-FileCopyrightText: 2026 Jeffrey C. Ollie <jeff@ocjtech.us> SPDX-License-Identifier: MIT --> # zig-zork Zork (a.k.a. *Dungeon*), built with the Zig build system. This project packages [devshane/zork](https://github.com/devshane/zork) — the C port of the original 1977–1981 MIT mainframe Zork — using `zig build` in place of the original Makefile. The game source is pulled in as a Zig package dependency; no code is vendored here. One file of it is replaced. Upstream's `dinit.c` sets up the game by reading the database `dtextc.dat` from a path compiled into the binary; `src/dinit.zig` exports the same C symbols but embeds the database with `@embedFile`, so the executable is self-contained and runs from anywhere, with no data file to install. ## Source The repository lives at <https://git.jcollie.dev/jeff/zig-zork>: ```sh git clone https://git.jcollie.dev/jeff/zig-zork.git ``` It is mirrored on Tangled at <https://tangled.org/jcollie.dev/zig-zork>. ## Requirements - [Zig](https://ziglang.org/) 0.17 - termcap (headers and library) - A C compiler is *not* needed separately — Zig compiles the C sources. ## Building ```sh zig build ``` The results land in `zig-out/`: - `zig-out/bin/zig-zork` — the game, with its data built in - `zig-out/share/man/man6/dungeon.6` — the manpage To build and play in one step: ```sh zig build run ``` `zig build test` plays a few moves and checks that the game answers them. ### Build options | Option | Default | Description | | --- | --- | --- | | `-Dallow-gdt` | `false` | Enable the in-game debugging tool, invoked by typing `gdt`. Not much use except for debugging. | | `-Doptimize=...` | `Debug` | Standard Zig optimization mode, e.g. `ReleaseSafe` or `ReleaseFast`. | | `-Dtarget=...` | native | Standard Zig cross-compilation target. | ## Nix A flake is included: ```sh # Play the game nix run .#zig-zork # Build the package nix build .#zig-zork # Development shell with Zig, termcap, and tooling nix develop ``` The flake builds with Zig's `--system` mode using …