Skip to content

Darklands Restoration Project

Arkana Mechanika Labs

Reverse Engineering the Classic 1992 DOS RPG

Bringing MicroProse's 1992 masterpiece to the modern world through AI-assisted reverse engineering and deep format documentation

⚡ Phase 1 complete  ·  Phase 2 active  ·  Key file formats documented
Darklands original box cover

The Project

Darklands is a 1992 MicroProse RPG set in a gritty, historically grounded medieval Germany, no elves, no high fantasy, just Raubritters, saints, alchemists, and the very real fear of dying of plague before you reach Nürnberg. It is one of the most ambitious RPGs of its era, and it has only ever been playable through DOS emulation.

The goal here is to change that. The project works in three phases: map the executable, understand it deeply, then rewrite it function by function into native C#, with the same game logic, same data files, same experience, running natively on modern hardware without a DOS emulator.

An AI agent (Codex) drives the analysis autonomously, session after session: naming functions, mapping data structures, and building a comprehensive knowledge base of how the game actually works.

Toolchain: Ghidra for static disassembly  ·  patched DOSBox-X for guided interactive runtime sessions  ·  Codex as the AI reasoning engine

The dos-re-agent dashboard showing game_main_loop decompiled alongside live agent tool calls
The dos-re-agent dashboard , named function list on the left, Ghidra decompilation in the centre, live agent tool calls at the bottom. The agent is reading game_main_loop and following cross-references to understand the state machine.
Custom DOSBox-X running Darklands on the world map with the debug socket active and register state visible
The runtime side: custom patched DOSBox-X halted mid-session on the world map. The debug socket reads DS:[0x7d10] (dispatch table segment) and dumps the full 99-entry state handler table , all entries pointing into the same RTLink overlay segment.

The Three Phases

Phase 1

Mapping the Executable

Complete

Before anything can be rewritten, every function needs a name. The AI agent worked through all 388 functions across 14 code segments, naming each one by analysing Ghidra pseudocode. The naming pass produced a segment map covering decompressors, a pack file reader, a renderer, and CRT-layer functions whose Borland origins show through in coding patterns, though these are static identifications, not runtime proofs.

The systems that have been runtime-validated are the ones that matter most: the custom record-driven loader (an RTLink-derived overlay system that packs the game's entire code into DARKLAND.EXE itself, with its stub table confirmed at 0x1b465–0x1b52d) and the 99-state game loop dispatched via a far function pointer table, with the dispatch mechanism confirmed live at 0x13cd1.

Runtime validation runs on a custom patched DOSBox-X instance: the agent sets breakpoints and captures register and memory state while a human pilot navigates the graphical menus. That hybrid workflow carried Phase 1 across the finish line and is now the primary tool for Phase 2.

Phase 2

Deep Analysis

In Progress

Having a name for every function is only the beginning. Phase 2 goes inside each subsystem to understand exactly what it does: how data structures are laid out in memory and on disk, how algorithms work, how the game state machine transitions between its 99 states.

On the disassembly side: the add-to-party overlay has been traced end-to-end through four layers: RTLink stub → far dispatcher (15DF:0329) → setup wrapper (15DF:0348) → slot writer (15DF:0D59) → UI finalization, all runtime-confirmed. The Create New World overlay worker is characterised: a four-slot reuse cache, a counted variable-length record blob at DS:A895, and slot/UI initialization. The setup/menu selector text system is a template engine with $-token substitution and jump-table dispatch. The loader resolver records (0x12-byte format) are decoded. The character hot-slot layout (DS:0x9C00, stride 0x80, in-party flag at +0x69) and the RNG (LCG, seed at 0x7B20) are confirmed.

On the format side: save files, the CAT archive system, world data (locations, cities, enemies, items, saints, alchemy), the wilderness map (328×932 RLE hex grid), the PAN animated sequence format, DGT audio, bitmap fonts, and dialog trees are all documented. Several formats remain undocumented. Everything documented is browsable in the DARK tool.

Still in progress: the full character struct base, save/load function mapping, and complete state handler identification across all 99 game states.

Phase 3

C# Rewrite via Spice86

Planned

Phase 3 has not started yet. It begins once Phase 2 has produced sufficient coverage of the game's core systems. The planned approach uses Spice86, a reverse engineering framework for 16-bit real-mode x86 programs. Its key capability: the original DOS executable runs alongside C# override functions in a hybrid execution model. You replace one function at a time, verify it behaves identically, and move on to the next. The game remains fully playable throughout.

This is exactly how Cryo's 1992 Dune game was reverse engineered in the Cryogenic project. Phase 3 will apply the same approach to Darklands: each system fully mapped in Phase 2 becomes a C# override, validated against the real executable.


Project Goals

Understand the Engine

Deep dive into the inner workings of Darklands, uncovering how MicroProse implemented combat, alchemy, travel, RTLink overlays, and a living world in 16-bit DOS.

Incremental Rewriting

Gradually replace x86 assembly routines with clean, documented C# code, one function at a time, maintaining 100% behavioral compatibility with the original executable throughout.

Document Everything

Create comprehensive documentation of game mechanics, data structures, file formats, and algorithms, preserving this knowledge for developers and gaming historians.

Preserve Gaming History

Ensure this landmark RPG remains playable on modern systems and provide a foundation for future enhancements, modding, and community ports.

AI-Assisted Analysis

Demonstrate what is possible when an AI agent drives reverse engineering, autonomous function naming, pattern recognition, and structured knowledge extraction at scale.

Native Cross-Platform

Leverage .NET's cross-platform capabilities to run Darklands natively on Windows, macOS, and Linux: no DOSBox, no emulation layer required.