MEGA65 Adventures
MEGA65 Adventures! Dan’s MEGA65 Digest for October 2022.
Personal computers in the early 1980s ignited the home video gaming industry with their ability to display animated color graphics. Even so, the games with the best images were the ones with no graphics at all. Text adventure games told tales of fantasy, mystery, and suspense with you as the protagonist, rendering entire worlds using only the written word and your imagination.
The effectiveness of the medium and the limited hardware requirements have made text games the longest living and most widely supported form. Archivists, hobbyists, and game authors have reverse engineered and ported vintage text games to modern computers, and evolved the form into the modern day. Thanks to members of our community who have continued that work, you can play a vast legacy of interactive fiction—everything from classic games to new releases—on your MEGA65.
Hibernated 1: Director’s Cut
A Cold Dark Place
You wake up. A feeling of nausea grips you as you slowly
regain control of your senses. You should open your eyes.
>open eyes
Blurred shapes slowly morph into a clear picture. It
takes a moment for you to find your way back to reality.
Has the Polaris-7 reached its destination? Still a bit
shaky on your legs you climb out of the hypersleep tube.
Hibernation Chamber
The room is lit by a gentle blue light. A glance through
the porthole reveals nothing but the endless vastness of
the Centaurus constellation. Proxima Centauri must be
very close now. But there is no planetary orbit in sight.
It seems an incident has interrupted your journey to
Proxima C1. The only exit is starboard.
The status monitor of the hypersleep tube flashes
intrusively.
>examine monitor
If this information is correct, then you have spent
nearly 20 years in hypersleep. During this time a
distance of about 4.1 light-years was covered. Proxima
Centauri is 4.24 light-years away from Sol, which
confirms the assumption that you haven't reached the
target system yet. What's going on here?
In Hibernated 1 by Stefan Vogt, you play Olivia Lund, a space-faring explorer whose long voyage to Alpha Centauri is interrupted by a mysterious alien vessel. With your artificial intelligence companion Io, you must board the vessel and learn its secrets to break free of its tractor beam.
To play a text adventure game, you describe the actions of your character in abbreviated English commands. The story proceeds with each action, so you can take your time to read descriptions for clues and work out solutions to puzzles. In Hibernated 1, you navigate around spaceships (yours and theirs) with commands like starboard
, port
, fore
, and aft
. You can also examine
objects to investigate your surroundings.
>starboard
Lower Corridor
Flashing red warning lights are reflected on the
palladium glass. From here, you're able to reach every
section of the ship. The hibernation chamber is port,
while your private area is starboard. The docking bay
lies aft.
The passage fore, leading to the Polaris-7 command unit,
is barred by a massive security door. It divides the
narrow corridor into two halves.
>examine lights
Looks like we have a problem.
Some objects can be taken, carried, and used at various points in the story. Others are fixed in place, and you must remember where they are and come back to them when needed. When playing text adventures, it is critical to take notes and draw maps in a paper notebook so you don’t lose your way.
>aft
Docking Bay
You stand in a desolate hall. This is the section where
raw materials and samples of foreign origin must be
stored, according to the Terran Alliance directive.
Fore you get back to the corridor. An airlock aft allows
you to leave the Polaris-7.
A laser rifle is leaning against the wall.
You also notice your spacesuit.
>take rifle
Taken.
>take spacesuit
Taken.
>wear spacesuit
You are now wearing the spacesuit.
Stefan originally released Hibernated 1 for the Commodore 64 and several other systems in 2018. In 2021, he rewrote the game with a revised story and puzzles, and published the “Director’s Cut” for a whopping twenty-eight (28) microcomputer platforms. You can even play it on a modern computer. Hibernated 1: Director’s Cut is available for the MEGA65, with an 80-column text display and the ability to save your progress to disk.
You can download Hibernated 1 from 8bitgames.itch.io. The download is free of charge; donations to the developer are welcome.
For an authentic vintage software experience, you can purchase a physical boxed edition of Hibernated 1 for the MEGA65 from publisher poly.play. The physical edition comes on a 3-1/2" floppy disk that you can use with your MEGA65’s floppy drive, in a gorgeous display box designed to resemble the games we used to buy in computer stores. And just like Infocom games back in the day, the box is packed with extras.
The physical edition of Hibernated 1: Director’s Cut qualifies as the first commercial title for the MEGA65. If boxed software appeals to you, you might also be interested in the second qualifying title, Showdown by Badger Punch Games, a two-player action game for the MEGA65 available in a display box from poly.play and as a download from badgerpunch.itch.io.
What is the Z-machine?
The most famous name in text adventures is Infocom, an American software company founded in 1979. Their most famous game was Zork, a treasure hunting adventure that begins in a boarded up cottage in the woods. Infocom published 36 original text adventures over ten years, including several Zork sequels and an adaptation of The Hitchhiker’s Guide to the Galaxy by Douglas Adams.
Key to Infocom’s early success was the ability to publish versions of their games for multiple microcomputer platforms simultaneously. All games were written in a custom programming language that ran on a common engine known as the Z-machine (Z for Zork). Infocom made versions of the Z-machine for every major microcomputer from the Apple II to the Amiga. This effectively erased the difference between each type of computer as far as the game’s Z-machine code was concerned: the story could be written once, compiled to Z-code, then interpreted by each platform’s Z-machine to play the game. When a new kind of computer came to market, Infocom simply built a new Z-machine for it, then re-released their entire catalog.
The longevity of this strategy continues to this day, over 40 years later. After Infocom ceased operations, hobbyists reverse engineered and documented the Z-machine standard. It’s a fun coding exercise to build your own Z-machine that can run Infocom story files, and implementations exist for nearly every modern computer. This is how Stefan released Hibernated 1: Director’s Cut for twenty-eight computers simultaneously: it’s a game written for Z-machines.
The Z-machine is a popular target for modern authors thanks to its ubiquity. The annual Interactive Fiction Competition gets new entries in this format every year, and you can find plenty more via the Interactive Fiction Database. Be sure to look for game files with names with endings such as .z3
, .z5
or .z8
. (There are several other formats used for interactive fiction, including Glulx, TADS, Twine, and more.)
Ozmoo
Ozmoo is a Z-machine player by Johan Berntsson and Fredrik Ramsberg for the MEGA65, Commodore 64, Commodore 128, and Commodore Plus/4. It’s a modern take on the idea, capable of taking advantage of each machine’s capabilities to their fullest extent, especially when extra memory is available. Ozmoo can run pretty much any game written for the Z-machine, including nearly all Infocom games and most modern Z-machine games.
Infocom experimented with sound effects and still graphics for a few of their games. Ozmoo supports the ones with sound effects, but not the ones with graphics (“v6” files).
The best way to get Ozmoo games for your MEGA65 is with Ozmoo Online, a web-based utility that can convert any compatible Z-machine game file into a playable D81 disk image. Ozmoo is free and open source, and you can learn more about it from the Ozmoo Github repository.
Fredrik, known as fredrikr on the Discord, has done a ton of great work to make interactive fiction available to the MEGA65 community. For starters, Ozmoo Online has every classic Infocom game available for download. Simply select one of the provided story files from the menu instead of uploading one.
Be sure to select MEGA65 as the platform, and “81” as the build mode. I also recommend enabling the scrollback buffer, a handy feature of Ozmoo that works well with the MEGA65’s “AtticRAM” extended memory.
Fredrik has packaged the two Infocom games with sound files as a separate MEGA65 download. You can find it on Filehost:
If you’re playing Infocom games, you’ll also want the original game manuals. You can download PDF scans of these from infodoc.plover.net. Some of the manuals contain information required to finish the games.
The interactive fiction community has been developing new Z-machine games for decades. Fredrik has bundled a selection of the best of these, using Ozmoo for the MEGA65. These are also on Filehost:
- The MEGA65 Z-code Text Adventure Collection Pack #1
- The MEGA65 Z-code Text Adventure Collection Pack #2
- Game Book Collection
Need more? Try these text adventures written by MEGA65 owners, including two by Fredrik himself:
- The Job, by fredrikr
- Vacation Gone Awry, by fredrikr
- Arthur’s Day Out, by WauloK
- Brotquest 2, by EgonOlson71
Writing a Z-machine game
Infocom used their own custom language called “ZIL” to write their games. Contemporary authors use a family of languages called Inform, specifically Inform 6 and Inform 7. A newer language called Dialog is also worth a look, especially when writing games for microcomputers.
Inform 6
Inform 6 is a programming language for writing Infocom-style adventure games for the Z-machine. Typically, you use it with the Inform 6 standard library, which implements a wide range of useful object properties (doors, keys, containers, food) and player verbs (open, unlock, put in, eat). The Inform 6 compiler is a command-line tool that takes an Inform 6 source file and produces a Z-machine game file.
Here’s a tiny excerpt of how a bit of the Docking Bay in Hibernated 1 might be implemented. (This is not the actual code. Among many things, I’ve omitted code that replaces “north” and “south” with shipboard directions “fore” and “aft.”)
Object docking_bay "Docking Bay"
with description "You stand in a desolate hall. This is
the section where raw materials and samples of
foreign origin must be stored, according to the
Terran Alliance directive. Fore you get back to the
corridor. An airlock aft allows you to leave the
Polaris-7."
n_to lower_corridor,
s_to airlock,
has light;
Object rifle "laser rifle" docking_bay
with
name 'rifle' 'laser' 'gun',
initial "A laser rifle is leaning against the wall.",
description "The rifle supports two modes: paralyze and
disintegrate.";
Even though Inform 6 is intended to build to the Z-machine format, its standard library was written with modern computers in mind, and tends to produce game files too large to run on vintage microcomputers. Ozmoo co-author Johan Berntsson produced PunyInform, a replacement for the Inform 6 standard library optimized for low memory computers like the Commodore 64. You use PunyInform with the Inform 6 compiler.
macOS and Linux users can download the Inform 6 source bundle with everything you need, including the Inform 6 compiler, standard library, and PunyInform. The Interactive Fiction Archive also has pre-built versions of Inform 6 for many platforms, library add-ons, and plenty of example code. I recommend using Visual Studio Code to write Inform 6 games: there are extensions available that allow you to compile and play your game directly in the editor.
The definitive book about the Inform 6 language is The Inform Designer’s Manual by Inform’s creator Graham Nelson. It’s exceptionally well written and includes general information about interactive fiction and game design, as well as a tour of the language and its library. I consider it a classic text, and recommend it to anyone with even a casual interest in the subject. Read it online, or buy it in hardcover or paperback.
Inform 7
Inform 7 is a newer language and authoring system for narrative game writing. It’s a radical departure from Inform 6, using a logical programming paradigm and a natural language syntax, so source code reads like English prose. Inform 7 also includes a friendly authoring application where you can write an Inform 7 game, test it, read high quality documentation, and even develop automated tests that put your game through its paces.
Here’s how that Docking Bay example would be written in Inform 7 (again, not the actual code):
Docking Bay is a room. "You stand in a desolate hall.
This is the section where raw materials and samples of
foreign origin must be stored, according to the Terran
Alliance directive. Fore you get back to the corridor.
An airlock aft allows you to leave the Polaris-7."
The Docking Bay is south of the Lower Corridor. The
Docking Bay is north of the Airlock.
A laser rifle is in the Docking Bay. Understand "rifle"
and "laser" and "gun" as the laser rifle. "A laser
rifle is leaning against the wall." The description of
the laser rifle is "The rifle supports two modes:
paralyze and disintegrate."
Inform 7 is designed to be accessible to authors without a computer programming background, but it doesn’t skimp on computational power or expressiveness. Some programmers prefer Inform 6 because it looks more like a programming language. Most new language innovation is happening with Inform 7.
The only reason I didn’t give Inform 7 top billing in this section is that games made with Inform 7 tend to run slowly on microcomputers. The MEGA65 version of Ozmoo can handle simple Inform 7 games with the “Inform 7 XL Stack” option enabled in Ozmoo Online, but they tend to be too slow to play.
For making Z-machine games for the MEGA65, stick with Inform 6. If you also want your game to run on smaller machines like the Commodore 64, use PunyInform instead of the Inform standard library.
Dialog
Dialog is another modern take on writing interactive fiction by Linus Åkesson. It borrows ideas from Inform 7 and the Prolog programming language, with an emphasis on minimalism, clarity, and performance. Dialog brings some of the best language design ideas to games that can be played on vintage microcomputers with Z-machine players. Like Inform, Dialog includes a rich standard library that makes starting new stories easy.
Here’s my novice attempt at describing the Docking Bay in Dialog:
#docking-bay
(room *)
(name *) Docking Bay
(look *)
You stand in a desolate hall. This is the section where
raw materials and samples of foreign origin must be
stored, according to the Terran Alliance directive.
Fore you get back to the corridor. An airlock aft
allows you to leave the Polaris-7.
(from * go #north to #lower-corridor)
(from * go #south to #airlock)
#rifle
(item *)
(name *) laser rifle
(descr *) The rifle supports two modes: paralyze and
disintegrate.
(appearance *) A laser rifle is leaning against the wall.
(dict *) rifle laser gun
(* is #in #docking-bay)
Dialog includes a command-line compiler and a handy interactive debugger. The software bundle includes pre-built tools for Windows and Linux, and it’s easy to build them from source on macOS. Linus also has his own alternative to the Z-machine, which he calls the Å-machine, optimized for converting Dialog games to playable web pages and Commodore 64 disk images.
Adventures in BASIC
I’ve always been interested in how computers can be used to tell stories. One of my favorite books as a kid was Creating Adventure Games on Your Computer by Tim Hartnell (1983, Ballantine Books). In fewer than 200 pages, Hartnell covers game design, BASIC coding techniques, and several fully playable adventure games that you can type in, play, and modify.
I love the title of the kid’s book Creating a Database Adventure Game by Steve Rodgers and Marcus Milton (1985, Aladdin Books). It’s a genuine insight that adventure games are like explorable databases: tables of values that describe the state of the world, and long strings of text that become the game’s narrative based on the player’s actions.
Write Your Own Adventure Programs by Jenny Tyler and Les Howarth (1983, Usborne Publishing) is another, with excellent visualizations of how BASIC programs are structured. Both of these books use a grid structure to represent the game world, with each cell a location with potential exits in the four cardinal directions (north, east, south, west).
Compute!’s Guide to Adventure Games by Gary McGath (1984, Compute! Books) only dedicates a few chapters at the end to authorship, but it includes useful advice on structured programming and a short type-in. Most of the book is a catalog of the state of adventure games of the era, summarizing their stories and reviewing their features. Infocom gets its own chapter.
Of all the books on BASIC that came out of the 1980s, the ones about adventure games were some of the most informative and inspirational. They described how to organize large programs, how to design and implement data structures beyond simple variables, and how to build a game engine as much as a game. And they showed how evocative text games can be, even with no graphics, simple command parsers, and short text descriptions. You can read these vintage BASIC books and others on Archive.org.
I was going to write up a bunch of tips for coding adventure games in MEGA65 BASIC for this Digest, but we’re running a little long. Instead, here’s a brief example of a technique for representing a world map that’s common to most vintage BASIC books on the subject: the travel table.
Let’s say our game takes place on the Polaris 7, Olivia’s ship from Hibernated 1. At the beginning of the game, Olivia can access five rooms: the Hibernation Chamber, the Lower Corridor, the Private Area, the Docking Bay, and the Airlock. Olivia can navigate these rooms by traveling fore, aft, starboard, or port, according to the entrances and exits to each room.
For this example, we’ll go with the simplest possible command parser. We’ll use an INPUT
statement to accept the command, and compare the value against the four directional commands. If a command is recognized, it is converted into a number from 0 to 3 in the C variable, and processing continues on line 380. Otherwise it is rejected with a message, and control loops back to the INPUT
statement.
100 DIM CM$(4):FOR I=0 TO 3:READ CM$(I):NEXT
110 DATA FORE,AFT,STARBOARD,PORT
300 INPUT C$
310 PRINT
320 C=-1:FOR I=0 TO 3
330 IF C$=CM$(I) THEN C=I
340 NEXT I
350 IF C<>-1 THEN 380
360 PRINT "I DON'T UNDERSTAND."
370 GOTO 300
The travel table is a two-dimensional array, with one row for each room, and one column for each movement direction. The value of a cell represents the exit for that room in that direction. If the value is a room number, that is the destination of the exit. If the value is 0, then there is no exit in that direction. We reserve room #0 for this purpose, so room numbering starts at #1. For example, the Docking Bay has an exit fore to the Lower Corridor (room #2). Fore is direction 0, so the Docking Bay’s zero-th column in the travel table is 2.
We initialize the TT(room, direction)
array by reading the map data from DATA
statements. For convenience, we put the room names on the same lines in the DATA
statements and read them into the RO$(room)
array.
120 DIM TT(6,4):DIM RO$(6)
130 FOR I=1 TO 5
140 FOR J=0 TO 3:READ TT(I,J):NEXT J
150 READ RO$(I)
160 NEXT I
180 DATA 0,0,2,0,"HIBERNATION CHAMBER"
190 DATA 0,4,3,1,"LOWER CORRIDOR"
200 DATA 0,0,0,2,"PRIVATE AREA"
210 DATA 2,5,0,0,"DOCKING BAY"
220 DATA 4,0,0,0,"AIRLOCK"
Olivia begins the game in the Hibernation Chamber, room 1. The PL
variable stores her location. At the top of the game loop, we tell the player where they are, and which directions from the current room have exits—that is, are non-zero in the travel table.
230 PL=1
240 PRINT CHR$(13)+"YOU ARE IN THE "+RO$(PL)+"."
250 PRINT "EXITS: ";
260 FOR I=0 TO 3
270 IF TT(PL,I)<>0 THEN PRINT CM$(I)+" ";
280 NEXT I
290 PRINT
Now we can finish processing the command. With a valid direction command in the C variable, we can determine whether there is an exit from the player’s current location in that direction by consulting the travel table. If not, we inform the player. Otherwise, we move the player to that location, then return to the top of the game loop.
380 IF TT(PL,C)<>0 THEN 410
390 PRINT "YOU CAN'T GO THAT WAY."
400 GOTO 240
410 PL=TT(PL,C)
420 GOTO 240
That’s a complete albeit not very interesting game. It might be more interesting if there’s an object that the player can find to open the security door fore of the Lower Corridor. We might update the room description routine at the top of the game loop to announce whether the object is in the player’s current location. It might also describe the security door when the player is in the Lower Corridor, and whether it is open or closed. A new command could allow the player to pick up the object, when appropriate. When the player opens the security door, the game logic would update the travel table to allow passage between the Lower Corridor and what lies beyond.
50 Years of Text Games, by Aaron Reed
This isn’t MEGA65 specific but I can’t close this out without recommending 50 Years of Text Games by Aaron Reed, a historical deep dive on the genre and its many unusual twisty passages. Well researched and compellingly written, Reed originally published this as a serial newsletter, then crowdfunded a book version. The project raised over $640,000.
The Kickstarter has ended, but there is a limited number of extra print copies available for pre-order. If you’re still reading this Digest, you’ll love Aaron’s book.
The MEGA65 might be my favorite text adventure gaming platform. With the distraction-free 80-column display and quality mechanical keyboard, I can shut off the Internet and immerse myself in an interactive story. And the large amount of memory, fast disk access, and ability to store a giant library on an SD card mean I can play modern text games without the limitations of other microcomptuers.
I hope you give at least a few of these games a try, and maybe write one of your own. Happy adventuring!
— Dan