A matching decompilation

Eye of the Beholder, rebuilt from C.

Eye of the Beholder, the 1991 DOS dungeon crawl, came without its source code, so we wrote some, in C. The original compiler, Turbo C++ 1.00, turns it back into the game's own bytes, all 1,011 functions of it. Then we read it to see how the game actually works.

A brick corridor in the sewers under Waterdeep, with the four heroes' portraits beside it
Plate I. A corridor on the first level, the sewers under Waterdeep, in the original game.
1,011functions matched, in three programs
783of them in EOB.EXE, the game itself
166,686bytes of the game's code matched
4of 4 graphics drivers rebuilt identical

What this is

Eye of the Beholder is a real-time, first-person dungeon crawl, made by Westwood Associates for SSI in 1991 under the Advanced Dungeons and Dragons licence. It brought the Dungeon Master formula to the PC: four heroes, one first-person view, and monsters that don't wait around for you. I played it growing up, on a 486 with VGA graphics and an AdLib card.

The game is three programs, START1.EXE, INTRO.EXE and EOB.EXE, and no source code. This project wrote that source code in C, function by function, and the test is strict: Borland Turbo C++ 1.00, the compiler the original was built with, has to turn it back into exactly the same bytes.

All 1,011 functions match: 783 in EOB.EXE, 213 in INTRO.EXE and 15 in START1.EXE. Linked with TLINK 3.0, the programs rebuild from that source. START1.EXE comes out identical, the other two differ only in documented details like the link date, and recorded play sessions replay the same on the rebuilt programs as on the originals.

This is the second game done this way, after Pool of Radiance, with the same method and a team of AI agents doing most of the work. With readable source we can see how the game works inside: one big loop on a single clock, a dungeon made of cells with small scripts, a 3D view painted from pre-drawn pieces, and four graphics cards driven through one table.

One note: the copy studied is the fan patch called "1.9", not the retail release, so a quirk shown here may not match the copy you played in 1991.

Latest articles

All articles

The series

Seven pieces, each one a video and a written article, out one at a time.

  1. 1 Eye of the Beholder, decompiled: how it works Out now
  2. 2 Ten things Eye of the Beholder never told you Coming
  3. 3 Painting a dungeon Coming
  4. 4 One clock Coming
  5. 5 The second game in three days Coming
  6. 6 Faster on a Tandy 1000 EX, with new music Coming
  7. 7 Eye of the Beholder on the CoCo 3 Coming

Every level, from the game's own filesThirteen PDF maps of Eye of the Beholder, one for each of the twelve levels and one for how they connect. They are extracted from the game's level files, not from walkthroughs: walls and doors from the level maps, and switches, locks, traps, messages, items and quests from the level scripts.Download the maps