Project Dungeo

Porting Mainframe Zork to the Sharpee Interactive Fiction Engine

December 27, 2025 - February 12, 2026 | 48 Days of Development
191+ Rooms 616 Max Score 455/616 in Walkthroughs 12 Walkthrough Chains 30+ Puzzles 89+ Transcript Tests Canonical MDL Combat

Project Overview

Project Dungeo is an ambitious effort to port the complete 1981 Mainframe Zork (MDL source: mdlzork_810722) to Sharpee, a modern interactive fiction engine. All 191+ rooms are implemented, with 32 treasures, canonical MDL combat, and the game is playable in browser, CLI, and Tauri desktop clients. The project has driven massive platform improvements including action interceptors, state machines, plugins, and a complete text pipeline.

191+
Rooms
32
Treasures
616
Max Score
7
NPCs Active
30+
Puzzles Working
89+
Transcript Tests
12
Walkthrough Chains
127+
ADRs Total

Progress Meters

Rooms: 191+ implemented

100%

Score Achieved: 455 / 616 points in walkthroughs

74%

Transcript Test Pass Rate: ~96% (1291 / 1333)

96%

What's New Since January 9

Key Accomplishments (Jan 10 - Feb 12)

  • 6-Phase Parser Refactor: hasTrait API, 4-tier scope, disambiguation, implicit takes (PR #49)
  • Frigid River Region: 5 river rooms + 5 shore rooms, boat navigation, rainbow puzzle
  • Complete Maze Rewrite: Twisty maze (15+4 rooms) and coal mine (7 rooms) matched to 1981 MDL source
  • Canonical Scoring System: OFVAL + OTVAL + RVAL + LTSHFT = 616 points verified against FORTRAN
  • Troll Logic Complete: 3 states, exit blocking, wake-up daemon, axe mechanics, Universal Capability Dispatch
  • Tea Room Region: 8 rooms, 4 cake mechanics, cage/sphere puzzle, Low Room carousel
  • Canonical MDL Combat: 7-phase melee engine matching melee.137, fight-strength scaling, 9 outcome types
  • 20+ New Traits: Eliminated all 467 ad-hoc (entity as any) property patterns
  • Action Interceptors (ADR-118): 8+ stdlib actions support trait-based interception
  • State Machines (ADR-119): 5 machines (trapdoor, death-penalty, rainbow, reality-altered, victory)
  • Plugin Architecture (ADR-120): Scheduler, State Machine, and NPC extracted to plugins
  • Zifmia Runner: .sharpee bundle format (147KB), browser + Tauri desktop clients
  • 56+ Issues Tracked: Across 3 issues lists, majority resolved
  • 35+ New ADRs: From ADR-093 through ADR-127+

Canonical MDL Combat System

7-Phase Melee Engine

Matching MDL melee.137 and dung.355 exactly

Complete rewrite of combat to match the original 1981 MDL source. The fight-strength formula scales from 2 (score=0) to 7 (score=616). Nine outcome types per blow, three result tables (DEF1/DEF2/DEF3), wound tracking with 30-turn cure clock.

PhaseImplementationStatus
1. Melee Tables6 raw result arrays, fight-strength scalingDone
2. Melee Messages5 message tables, 3-7 variants per outcomeDone
3. Melee InterceptorADR-118 attacking interceptor with preValidate/postExecuteDone
4. DisengagementVillain heals on flee, cure-daemon (30 turns/wound)Done
5. Thief BehaviorCanonical WINNING? function, engrossed stateDone
6. DIAGNOSECanonical MDL wound descriptionsDone
7. NPC CombatPluggable NpcCombatResolver, NPC-to-PC attacksDone
// DO/UNTIL transcript syntax for robust combat testing
[RETRY: max=5]
[DO]
> attack troll with sword
[UNTIL "troll breathes his last" OR "You have died"]
[ENSURES: not entity "troll" alive]
[END RETRY]

New Puzzles & Regions

Puzzle / RegionMechanicStatus
Frigid River 5 river rooms, boat navigation, launch action, shore landings New Jan 11
Rainbow Bridge Wave sharp stick at Aragain Falls to solidify rainbow New Jan 11
Maze Topology Complete rewrite: 15 rooms + 4 dead ends + 5 self-loops from MDL Fixed Jan 12
Coal Mine Maze 7 rooms fully corrected against MDL source Fixed Jan 12
Dam Controls Instant toggle matching FORTRAN objects.f (not multi-stage) Fixed Jan 27
Riddle Room ANSWER "a well" opens passage to Pearl Room New Jan 14
Trap Door Auto-Close State machine: slams shut and bars when player descends New Jan 14
Tea Room Cakes Eat-me (shrink/teleport), Blue (enlarge), Red (dissolve pool), Orange (explosion) New Feb 6
Cage/Sphere Puzzle Robot raises cage, 10-turn poison countdown, sphere taking interceptor New Feb 6
Low Room Carousel Scrambled navigation; triangular button fixes both carousels New Feb 7
Gas Room Entry ADR-126 destination interceptor blocks flame sources New Feb 9
Exorcism Ritual Bell + Book + Candle sequence in Entry to Hades Fixed Jan 23

Troll Logic (Complete)

👾

All Canonical MDL Features Implemented

Matching act1.254 and dung.355 exactly

  • Three states: Alive, Unconscious (2-turn recovery daemon), Dead (smoke disappears)
  • Exit blocking: Blocks north passage when alive, unblocks when defeated
  • Axe mechanics: White-hot (untakeable while alive), visibility toggle, 75% weapon recovery
  • Player interactions: TAKE (spits), ATTACK unarmed (laughs), TALK TO, GIVE/THROW (catches/eats)
  • Sword glow daemon: Level 2 (bright) same room, Level 1 (faint) adjacent, Level 0 no enemies
  • Universal Capability Dispatch: TrollTrait claims if.action.taking, if.action.attacking, if.action.talking

Platform Architecture (ADRs 093-127)

35+ New Architecture Decisions

Major platform evolution driven by Dungeo requirements

ADR-093

I18N-Aware Entity Vocabulary — adjective system for disambiguation

ADR-094

Event Chaining — cascade/override/keyed modes for container reveals

ADR-095/096

Text Service Architecture — FyreVM channels, message templates, formatters

ADR-097

Domain Event Migration — meta/platform actions use domain events

ADR-104

Implicit Inference — pronoun-only single-candidate inference

ADR-106

Domain Events are Immutable Records — not pub/sub

ADR-110

Debug & Testing Extension — 24 $commands, playtester annotations

ADR-114

Browser Platform Package — reduced dungeo browser-entry from 1631 to 279 lines

ADR-117

Three-Tier Mutation Model — Actions, Daemons, Extensions

ADR-118

Stdlib Action Interceptors — 8+ actions with 5-hook interception

ADR-119

Declarative State Machines — states, transitions, guards, effects

ADR-120

Engine Plugin Architecture — priority-based turn processing

ADR-124

Entity Annotations — illustration/media metadata system

ADR-126

Destination Interceptors — room entry conditions (gas room)

Clients & Deployment

🌐

Multi-Platform Support

Play Dungeo in CLI, browser, or desktop

PlatformDetailsStatus
CLINode.js, transcript testing, --play interactive modeDone
BrowserInfocom-style CSS, 4 themes (DOS, Modern, Retro, Paper), menu barDone
Zifmia Runner.sharpee bundle (147KB), delta saves (~4KB), story libraryDone
Tauri DesktopElectron-alternative, 8 IPC commands, native file I/ODone
WebsiteAstro + Tailwind, docs, games showcase, Play Dungeon pageDone

Development Timeline

January 3, 2026

Feature Complete — 650/650 Points (original scoring)

All 33 original treasures, 636 tests, published to npm.

January 10, 2026

6-Phase Parser Refactor

hasTrait API, 4-tier scope (AWARE/VISIBLE/REACHABLE/CARRIED), disambiguation, implicit takes. 266 parser tests. PR #49 merged.

January 11, 2026

Frigid River, Scoring Audit, Sceptre Removal

10 new river/shore rooms. Rainbow puzzle. FORTRAN scoring decoded (616 max). Sceptre removed (not in MDL). 20 treasure values fixed. Test pass rate: 74.7% to 88%.

January 12, 2026

Maze Rewrite, Scoring Complete, Adjective Disambiguation

Complete maze topology from MDL (22 rooms). Room visit scoring (215 pts, 13 rooms). LIGHT-SHAFT (10 pts). Death penalty. Fixed hard-coded empty adjectives. Pass rate: ~93%.

January 13, 2026

Event Chaining & Text Pipeline

ADR-094/095/096. FyreVM channel I/O. Message templates with formatters. Perspective placeholders. 33 formatter tests.

January 14, 2026

Playtest-Driven Fixes (TR-001/TR-002)

Trap door auto-close. Riddle room answer. 14+ room descriptions matched to 1981 MDL source exactly. Dynamic exit management pattern.

January 16-18, 2026

Browser Client, Pronoun Fix, 17+ Issue Fixes

Infocom-style browser client (1.0MB). Pronoun "it" pipeline fix. ADR-104 implicit inference. Engine remediation (-21%). Save/restore in browser. Egg protection. Sword glow daemon.

January 17, 2026

Troll Logic Complete + Universal Capability Dispatch

All canonical MDL troll features. 3 states, axe mechanics, recovery daemon, player interactions. Capability dispatch white paper. 104 troll tests.

January 22-23, 2026

Testing Infrastructure & React Client

89 transcripts baselined. ext-testing extension (24 $commands). React client with map, events, notes. 4 themes. Walkthroughs 1-6 all passing (165 tests). Pass rate: 46% to 86%+.

January 24-26, 2026

Trait Migration & Action Interceptors

467 ad-hoc property instances audited, ~20 new traits created. 0 remaining. ADR-118 interceptors on 8+ stdlib actions. Browser platform package (1631 to 279 lines). 4 browser themes.

January 27-29, 2026

Plugins, State Machines, Zifmia Runner

ADR-119/120. 5 state machines. 3 plugins (scheduler, state-machine, npc). .sharpee bundle format (147KB). Tauri desktop. Delta saves (~4KB).

February 6-7, 2026

Tea Room Region & Canonical Combat

8 new rooms, 4 cake mechanics, cage/sphere puzzle, carousel. 7-phase melee engine from MDL. Fight-strength scaling. 9 outcome types. 9 walkthroughs, 216 tests passing.

February 9-11, 2026

Coal Mine, Thief Fight, Combat Fixes

Gas room via ADR-126 destination interceptors. wt-10 coal mine (59 tests). wt-12 thief fight. UNCONSCIOUS bug fix. DO/UNTIL transcript syntax. Score: 455/616.

Testing Infrastructure

🧪

Comprehensive Test Coverage

12 walkthrough chains + 89 unit transcripts

WalkthroughDescriptionTests
wt-01Get Torch Early (troll fight)35
wt-02Bank Puzzle16
wt-03Maze & Cyclops25
wt-04Dam & Reservoir17
wt-05Egyptian Room10
wt-06Exorcism Ritual19
wt-07River & Rainbow37
wt-08Egg from Tree9
wt-09Tea Room44
wt-10Coal Mine59
wt-11Scattered Treasures~30
wt-12Thief Fight~50

Test infrastructure features: $save/$restore checkpoints, DO/UNTIL loops for combat, RETRY blocks, NAVIGATE directives, contains_any assertions, $teleport for walkthrough reliability.

89+
Transcript Files
1333
Total Tests
96%
Pass Rate

Key Lessons Learned

1981 MDL Source is Canonical

mdlzork_810722 is the ground truth, not the 1994 FORTRAN port. Room descriptions, treasure values, maze topology, combat tables, and puzzle mechanics all verified against MDL line numbers.

Traits Replace Ad-Hoc Properties

467 instances of (entity as any).property were audited and eliminated. Custom properties are NOT serialized by the checkpoint system. All mutable entity state must live in proper traits.

Action Interceptors for Entity-Specific Behavior

ADR-118 interceptors replace event handlers for "one entity + one action" patterns. Handlers remain for time-based daemons, multi-entity coordination, and custom event orchestration.

DO/UNTIL for Combat Testing

Pre-check loops (WHILE) check state. Post-check loops (DO/UNTIL) check output. Combat testing needs post-check because the condition ("enemy died" vs "player died") only appears in command output.

Build Resolution Matters

esbuild can resolve stale dist-npm/ files over current dist/. Explicit --alias flags in build.sh ensure the correct module versions are bundled.

Score Progression

DateScoreMilestone
Jan 3650/650Original scoring system (pre-FORTRAN audit)
Jan 11616 targetFORTRAN scoring decoded, values corrected
Feb 9 (before fix)20/616Scoring bug discovered (ISSUE-053)
Feb 9 (after fix)281/616TreasureTrait moved to platform, scoring fixed
Feb 9291/616Exorcism achievement fix (+10)
Feb 9328/616Coal mine treasures (+37)
Feb 10~455/616Scattered treasures + thief death

Open Items

CategoryItems
Combat Blocker meleeOstrength=0 initialization bug (troll starts dead); meleeWoundAdjust=-1 (player starts wounded)
Missing Walkthroughs Coal mine volcano, well/tea room edge cases, mirror rooms, royal puzzle, endgame sequence
Platform Bugs ISSUE-052 (capability registry cross-module), ISSUE-054 (template placeholders), ISSUE-055 (nested container scope)
Remaining Score 161 points remaining: room visits, remaining treasures, endgame achievements
Test Failures 28 pre-existing: basket(7), trophy case(7), troll recovery(5), flooding(4), other(5)

The game is fully playable across CLI, browser, and desktop!
191+ rooms, 32 treasures, canonical MDL combat, 12 walkthrough chains, 455/616 points achieved. Original Mainframe Zork lives again.