Friday, February 27, 2026

Tiny Text Adventure Engine

The tiny text adventure engine is intended for Z80 systems of the 70s like my reZet80 PIONEER.
It also runs on systems of the 80s like my reZet80 SENTINEL.
The game size of my first release of the Haunted House text adventure was 2236 bytes. For the second release I managed to squeeze out another 42 bytes but with 2194 bytes it's still too big for a 2 KiB ROM.
The size excludes the keyboard and display handling that need to fit in the same ROM, so for Haunted House at least 3 KiB of ROM are needed.
But depending on the descriptive text and the dictionary a text adventure that fits in 2 KiB is feasible.
So what to expect from a 2 KiB text adventure?
  • It runs on a 16-character LCD display.
  • The descriptive text is short and the dictionary is limited.
  • It uses a simple parser that understands one and two word commands made of a verb and a noun.
  • The focus lies on solving puzzles.
  • The atmosphere is secondary.
  • There is no time limit and no score.
And how to achieve this with so little space?
  • It is written entirely in Assembler.
  • I use 5-bit packed chars.
So the texts are 37,5% smaller. Unfortunately only 32 characters can be used.
That's 26 capital letters, 4 punctuation symbols (" ", ".", "," and "'") and 2 special codes: ENTER (used as delimiter after 16 characters) and EOS (end of string).
  • Only the first letter of verb and noun are distinguished.
So to open a door enter "OPEN DOOR". Or just "O D".
You could also enter "OPEN DRAWER" and the door will still be opened.
The trick ist to use unique, unambiguous verb / noun combinations for each location.
So you won't find a door and a drawer at the same location.
In order to overcome this unpleasant behaviour the parser has to check for "O DO" and "O DR".
This increases code size and leads to my tiny text adventure engine becoming a text adventure engine.
BTW, I started coding my second text adventure The Lighthouse.
I will add support for more LCD displays (40x1, 16x2, 16x4, ...).
Releases of both games for a 16-char 14-segment display are also in the pipeline.