It started with one sentence: “Take this source code and create an emulator to run on my PC.” The source was OpenSpookyHouse, a GameMaker remake of Hugo's House of Horrors – a 1990 shareware adventure by David P. Gray in which you walk Hugo around a haunted house with the arrow keys and type things like take gold to rescue your girlfriend Penelope.
We ended up somewhere much more interesting: a Python port of the original 1990 engine that plays the entire game to 190 of 190 points, a robot that can finish it, three PC-speaker tunes rebuilt from their note strings, and a pile of discoveries about how games of that era actually worked. This is the write-up: what we built, what broke, what surprised us and what we would do again.
Spoiler warning. This post describes puzzles and solutions in detail. If you'd rather play first, the game is a fun hour or two.
The cast, in one minute
- The game: Hugo's House of Horrors, 1990, by David P. Gray (Gray Design Associates). EGA graphics (16 colours), a text parser, arrow-key walking, a score out of 190.
- The remake: OpenSpookyHouse by Skyline969, written in GameMaker. A modern reinterpretation.
- ScummVM: the open-source adventure-game engine project, whose Hugo engine reimplements all three Hugo games. Its authors were given the original Hugo source code privately; what is public is their engine and a data file extracted from the DOS executables.
- Us: a human with a plan and an AI pair-programmer doing the reading, writing, testing and a lot of experiment-running.
Part 1: A remake in a window
The remake is a GameMaker project, so job one was running GameMaker-style code without GameMaker. We wrote a small runtime that mimics just the parts the game uses (objects with events, collision masks, alarms, rooms, depth sorting) and wrapped it in a Tk window drawing at 60 frames a second.
Two decisions paid off every single time we checked something later:
- Extract, don't retype. Room layouts, sprite tables, collision boxes, door targets and animation speeds were pulled out of the GameMaker project by script. A typo in a retyped table is invisible; a script has no typos.
- Measure everything. The graphics are the original 1990 files:
.ARTbackgrounds and.PIXsprites, which are PCX images with four 1-bit colour planes (that is what EGA is). We decoded them ourselves and compared 175 images – 711,086 pixels – against an independent decoder. Not one pixel differed.
The DOS game ships no sound files and the remake never wired any in, so we wrote a synthesizer: about 28 effects and 13 music loops, generated by code, with two voicings (a single-voice PC speaker and a fuller software MIDI). Packaged with PyInstaller it became one 38 MB .exe you can double-click.
Then we tested it like a product rather than a toy:
- a scripted walkthrough that finishes with 198 of 198 points;
- geometry checks that every exit and item is reachable;
- a “monkey test” that mashed random keys for more than 600,000 game ticks, with hundreds of saves and restores, looking for crashes;
- an audit that every number in the remake's object code (all 99 of them) matched the port.
Part 2: “Is it the same as the original?” No.
The next request changed the whole project: “make sure it's the same as the original game.” The honest answer was a little awkward. The port was identical to the remake – but the remake is not the 1990 game. Its own readme says it was rewritten from scratch.

We put numbers on the gap by comparing the remake with the original game files:
| What | Finding |
|---|---|
| Walkable areas | the remake's hand-placed rectangles overlapped the original's by only 60% on average |
| Foreground masks (Hugo walking behind things) | 37% agreement; several rooms had none at all |
| Text | reworded throughout |
| Puzzle flow | different in places: the mummy only appeared after you took the gold, and the old man asked five questions where the 1990 game asks seven |
| Keys | the 1990 game has F1–F9 (including a boss key); the remake did not |
Lesson one: “faithful to X” is only a claim if you have X's ground truth to measure against. We had been rigorously faithful to the wrong thing.
Part 3: Where the real rules hide
Old games like this one did not ship as “a generic engine plus data files”. Hugo's executable has its objects, scripts, texts and parser tables compiled straight into it. Luckily, ScummVM's Hugo engine exists, and its team extracted all of that into a single file called hugo.dat, then reimplemented the game logic as open source (GPL-3).
The original source code is not public – ScummVM's developers received it under a confidentiality agreement – so we used the next best thing: hugo.dat as a database and ScummVM's engine as the specification for a Python port.
We wrote a parser for hugo.dat's binary layout (big-endian numbers, length-prefixed text blobs padded to four bytes, every table repeated once per game variant) and a tool that dumps the whole game as a readable script. What is inside:
| In the database | Count |
|---|---|
| Objects (the hero, doors, items, monsters, even the lips of a talking portrait) | 53 |
| Action scripts: timed lists of commands the engine runs | 156 |
| Kinds of action (START_OBJ, INIT_OBJXY, COND_R, TEXT, NEW_SCREEN, BONUS...) | 50 |
| Verb groups / noun groups the parser knows | 51 / about 78 |
| Exit hotspots | 27 |
| Text strings | nearly 300 |
| Score: 59 points from items + 131 from bonuses | 190 |
Reading that dump felt like reading the director's cut. Here is what happens when you smash the pumpkin on the lawn:
script 104 (verb "break" on the pumpkin)
BONUS point 0 +5 points, once only
TEXT "The pumpkin breaks open to reveal: A key!"
START_OBJ key make the key appear
START_OBJ pumpkin make the pumpkin vanish
INIT_CARRY pumpkin = not carried
INIT_HF_COORD key put the key at Hugo's feet
The whole game is like that: tiny, data-driven rules, a timer, and an interpreter.
Part 4: A room is a picture plus three invisible bitmaps
Each screen has a picture (.ART) and three more files that never appear on screen. Each is a 320×200 1-bit image, 40 bytes per line, most significant bit first:
.B– the boundary: where Hugo may not walk;.O– the overlay: scenery that things can hide behind;.OB– the overlay base: markers saying “but if something's feet are below here, it is in front of the overlay”.

Here is the part that surprised us. When something walks, the engine does not test the sprite's whole body against walls. Every sprite has a bounding box and a baseline – the bottom row of its feet – and only that single row is tested against the boundary bitmap, along with the baselines of other objects, which are temporarily drawn into the same bitmap each tick.

Drawing follows the painter's algorithm: objects are sorted by the row of their feet, and each pixel is hidden by the overlay unless an overlay-base marker lies below it. That one rule is why Hugo walks behind the balcony rail upstairs and in front of the table downstairs. The remake approximated it with rectangles and masks – the 37% we measured earlier.
Part 5: One tick at a time
The original runs at eight ticks a second (16 in turbo mode). Everything – walking, doors opening, the mummy giving chase, a text box timing out – happens inside one tick of a simple loop:


Blocking dialogs, without threads
The DOS game freezes while a text box is open: the code literally waits for a key in the middle of a function. Porting that line for line is awkward in a frame loop. The trick that made the engine easy to write and easy to test was Python generators. Any function that can show a box is a generator, and the blocking point is a yield from:
def notify_box(self, text, protect=False):
info = self._draw_box(text)
key = yield from self.get_key() # waits here - exactly like the DOS original
self._restore_box(info)
return key
The host (the window, or a test) just calls poll(); the engine runs until it needs input, then politely hands control back. A test robot can drive the whole game deterministically with no threads and no timing luck.
Part 6: How the game understands what you type
The parser is wonderfully small. For each line you type, the engine:
- lower-cases it and looks for any known verb anywhere in the sentence (so “take the gold” and “grab gold please” both work);
- looks for each known noun;
- for every object in the game, asks: is this the noun you meant, and is Hugo close enough to it? (every object has a radius; this is where “You're not close enough!” comes from);
- if so, looks the verb up in that object's own command list, checks you carry what the command needs and that the object is in the right state, then runs its action script;
- otherwise falls back to the room's background phrases, then the catch-all replies, then “Apparently our hero either doesn't understand what you mean...”
Matching is a plain substring search, which creates delightful quirks:
manmatches insidewoman, andoldinsidehold. The first matching noun group wins.- Verbs are tried in a fixed order, which is why
unlockis found beforelock, andget inbefore plainget. The order is the grammar. - A few aliases in the data start with a capital letter (
Hugo,Mummy,Igor). Since your line is lower-cased first, they can never match. Dead words, preserved for 36 years. xyzzyis a recognised word. It is a nod to Colossal Cave Adventure, and it earns you “We are getting desperate, aren't we!”
The scrambled quiz answers
When the old man on the lake quizzes you, the answers are not stored as plain text. They are scrambled with a cypher whose key is the game's own copyright line, Copyright (c) 1990, Gray Design Associates. Each typed character is shifted by the matching key character, wrapped modulo 126, and the result is compared with the stored string. It is not security – it just stops you reading the answers out of the file.
| You type | The engine computes | It matches the stored |
|---|---|---|
| bilbo | 'Z^]c | 'Z^]c |
| narnia | 3Rdi]L | 3Rdi]L |
| c | ( | ( |
The check is “does the stored answer appear anywhere in the scrambled reply?”, so extra words are harmless: the combination is 333 opens the shed just as well as 333.
Part 7: Playing the whole game with a robot
To prove the port we wrote a robot that plays like a person: it types commands, presses arrow keys and answers prompts. The only convenience is a route finder for long walks – itself a port of the original's recursive “fill a horizontal segment, then look above and below it” algorithm.

Getting that line to reach 190 was the real adventure. Four things nearly stopped us.
Boss fight 1: the bats
In the bat cave the bats chase you for a few ticks, then switch to “wander” mode – but a wandering bat keeps the velocity it had until a random timer kicks it. The whistle stops the cycle and turns all four bats to wander, but they are still fast and they bounce off walls. Whether you survive depends on the random numbers: with the engine's random generator seeded 12 different ways, about one in three got through.

Boss fight 2: the mummy
The mummy moves 10 pixels per tick horizontally and 8 vertically. Hugo moves 5 and 4. It cannot be outrun – but its “AI” is one line: head straight for Hugo, and if a wall is in the way, stop. No path-finding. So the 1990 solution is to trap it behind a rock. For a human that is a skill; for us it was a search problem.
We built an exact simulation: the same movement, collision and scheduling code as the game, with the drawing switched off, running at tens of thousands of ticks a second. Then a beam search: at every tick try “no key” plus the eight walking keys, keep the most promising 800 states (closest to the gold, then closest to the exit, nowhere near the mummy), and repeat. About half a minute later it printed a 20-keypress plan.


It did not work the first time, and the reason is the best lesson of the project. The “winning” plan died when replayed. The simulation had a bug: when a branch of the search walked through the bottom exit, the engine did change rooms – inside the simulation – and loaded the other room's wall bitmap, quietly poisoning every later branch. The fix was one line: in a simulation, a room change is a terminal state. A second mismatch: typing take gold runs on the next frame, and the gold's own baseline is a wall the mummy can bump into, so the timing of the command mattered as much as the walking.
Boss fight 3: the one-pixel corridor
The rubber bung that plugs the boat is on a table in the professor's lab, behind a sliding glass panel. A web walkthrough says only “walk around behind the glass panel”. Our robot could not get within reach: the glass panel's own baseline sits on row 163, the table's front edge is a wall on row 161, and you must stand on row 162 – a corridor one pixel high – to be “close enough”.

Remember the baseline rule: only the feet row is tested, so a corridor one pixel high is perfectly walkable sideways. The catch is getting in – Hugo's up/down sprites are one pixel too wide for the gap at the left, but his left-facing frame is narrow enough, and that frame is selected by pressing the up-left keypad key. We found the entry by brute force, and the way out by a breadth-first search over key presses that discovered a 10-step plan. A human player can do it too, by hugging the wall.
Boss fight 4: Hugo's ghost
In the very first moments of the game, Hugo could not walk left. He was blocked by himself. Every object's old position starts as a placeholder (90, 90) in the data; on the first tick the engine stored Hugo's baseline where he stood and then “cleared” it at the placeholder, leaving a ghost wall under his feet.

The ghost vanishes on the next tick, so no real player would ever notice. We left it in: it is what the original code does, and finding a bug that survived 36 years felt like a sign the port was right.
A small door puzzle
Several exits also need a second push. When Hugo first meets an exit's wall, the engine stops him (velocity to zero) before moving him the last bit, so the check “is he standing inside the exit zone?” runs at the wrong coordinates. Pressing the arrow again repeats the collision from the right spot, and the room changes. Players presumably learned this by feel in 1990.
Part 8: Rebuilding the music
The 1990 game has no music files and no sound card support. What it has is three little songs stored as text in the database, played on the PC's internal speaker: O3L1E.>E<EF.>F<FE.... A timer interrupt at 8 Hz reads the next token – a note letter, a rest, an octave or length command – and programs the PC's timer chip with a divisor; the speaker then clicks at 1.19 MHz divided by that number.
| Piece | How it works |
|---|---|
| Notes | A–G, with # sharp or b flat; a divisor table for octave 3 (A = 1352 gives 880 Hz) |
| Octave | On sets it; < and > move one up or down by halving or doubling the divisor |
| Length | Ln sets how many 1/8-second ticks a note takes |
| Articulation | any note longer than one tick sounds for one tick less than its length, leaving a tiny gap – this is the staccato |
We rendered those rules to 16-bit audio as a hard square wave, the way the speaker would have sounded. Here are the three tunes, and what they look like as a piano roll:


We have not heard what a real PC speaker made of that bass line; on modern speakers it is a growl. If you have an original machine, do tell us.
Part 9: Checking everything, and a referee
By the end the project had 13 automatic test suites, from graphics decoding to a full playthrough:
- The playthrough: types a whole game and ends on 190/190. It runs from source and inside the built exe – identically, down to the tick count.
- The engine tests: database counts, parser replies, walking and walls, overlay layering, save and restore, deaths, function keys and the songs.
- The real window: opens the actual app, sends it synthetic key presses and checks what the engine did.
- The old suites: remake graphics, geometry, saves, audio, the mummy route and the bats.
For an outside referee we set up a portable ScummVM with a launcher for the genuine DOS game. We did not wire it into the automated tests, so it is a reference for humans rather than part of the suite – which is worth saying plainly. The port follows ScummVM's documented behaviour; it cannot prove what the 1990 executable itself did in corners ScummVM does not reproduce.






The credits, in the original fonts
Even the opening credits use the game's own fonts: the DOS version shows its titles in “Tms Rmn” Windows bitmap fonts read from TMSRB.FON, so we wrote a small reader for that file format, too.

Secrets in the code
We went looking for hidden things. There are fewer than you might hope, but they are good ones:
PPG– a developer cheat the author left in the shipped game. Type it, thengoto lakeroom,fetch gold,find oldmanand friends. Despite the name it is not invincibility: the dog will still eat you. We found no explanation for the letters in the data, and they are not the author's initials (D.P.G.).- F9, the boss button – the screen instantly becomes a DOS prompt; type
exitto return. The manual says the game stays “lurking unseen in the background” using 280 KB of memory. - Dead text – three unused strings, plus leftovers from sister games (“You are in a maze of twisty little paths, which are all alike!” is from Colossal Cave).
- Jokes –
look moon(“You'll go blind!”),kissin the dining room,wash handsin the bathroom, and a kitchen broom held by magic. - ScummVM's console (Ctrl+Alt+D) has its own Hugo commands:
listscreens,gotoscreen,listobjects,getobject,getallobjectsand aBoundariesview that draws the invisible walls.
What we learned
- Port the data, not the look. The rules lived in a database; once we read it, most “behaviour” stopped being code we wrote and became data we loaded.
- “Same as the original” needs a ground truth. Measure against the real files, and be clear about what the ground truth itself is (here: ScummVM's reimplementation, not the lost source).
- The quirks are the content. A single-row baseline, substring matching, dead capitalised words, ghost baselines: every strange rule explained a puzzle's shape.
- Determinism makes games searchable. A fixed tick, a seeded random generator and an exact simulation turned “is it winnable?” into a computer-science problem with an answer.
- Beware your own simulator. Twice, what looked like “this puzzle is impossible” was our model leaking: a room change inside the search, a command that runs one frame late. Replay plans in the real thing.
- Generators are a gift for blocking UIs. They kept the port line-for-line with the original and the tests free of threads and sleeps.
- A test robot is the best spec. The 190/190 playthrough caught more mistakes than any amount of reading.
- Stay on the right side of the licence. The game is shareware: copyable for evaluation, not redistributable, and its author still sells the series. We used the data for our own machine, credited everyone, shipped no game files in anything public, and did not go hunting for source code that was never released.
- Working with an AI is mostly about keeping state. Long sessions get summarised, so scripts live in files, results are written down, and every claim is re-checked by running something. The funniest bugs were mundane: a carriage return sneaking into a string through a shell heredoc, and a screenshot of a locked screen.
What's next
Hugo has two sequels. ScummVM's engine and database already cover Hugo II: Whodunit? and Hugo III: Jungle of Doom! – the same data file holds all three games – so a port is possible in principle. It would need those games' own data files, which are separate downloads of a still-commercial product, plus the sequels' extra engine pieces. That is a project for another day, and one to approach carefully.
In the meantime Hugo is out of the 1990s and in a window on a modern PC: arrow keys to walk, typed words to act, eight ticks a second, 16 colours and a speaker that goes blip.
Credits and links
- David P. Gray / Gray Design Associates – author of Hugo's House of Horrors (1990). The game belongs to him; please support the series if you enjoy it.
- OpenSpookyHouse by Skyline969 – the GameMaker remake that started this.
- ScummVM – its Hugo engine and
hugo.datmade the original-engine port possible. - The Internet Archive – for preserving the 1990 shareware release.
- Screenshots, diagrams and animations on this page were generated by the port itself.

