I thought it would be interesting to play an Inform 7 game on the Commodore 64. Due to the limitations of the interpreters available for the platform, it would have to be a rather small game, compiled to Z5 format. After some searching, I found “Countdown 1: The Body”, which had a Z5 file of just 126 KB. I used Paul David Doherty’s excellent tool “InfToD64” to procude the disk images, and launched the game in Vice, my favorite C64 emulator.
Result: The game loaded. Printing the initial text and then the first room description took about two minutes. I entered “U” to go upstairs. After 90 seconds, the game printed the new roow description, paused for 20 seconds, and tried to print what was on the bed, but died from a fatal exception.
I really can’t say I recommend the C64 as a platform for playing Inform 7 games. But it was fun to try.
Nice work! Does this mean I7 produces such terrible Zcode that it runs slowly, or is there another explanation. For example, a tiny game still taking 126k of Zcode?
I wouldn’t say “terrible”, but basically yeah. I7 games contain boilerplate code and extension hooks in places where I6 had hand-written code and less flexibility. There’s also compiled-in support for I7 features which are not used in every game (dynamic lists, tables, equations, etc etc).
This is the result of years of development in the Z8 regime and then Glulx. Tight optimization is just less important.
Interesting idea! I tried converting an I6 game of mine (Z5, resulted in two floppy images). It loads equally slowly. It’s unplayable, however, even afterwards, because absolutely no commands are recognised.
Edit: tried another I6 game I wrote. It’s bigger (still Z5), but it works. Very slowly, i.e. not seriously playable, but technically working.
Might be a bug in the C64 interpreter. Might be the game is using some feature of the modern Z-spec which didn’t exist in Infocom’s time. Or was poorly specified in Infocom’s time and has been tightened up in modern interpreters.
Inspired by this last night I tried converting curses.z3 into C64 format. It’s quite nippy in Vice, and was working well. The only problem I ran into is when I tried saving game state to a disk image, and it crashed! But up until then it was working well. Obviously an older zcode game, but still a large and complex game. But I guess it doesn’t have the same overhead of later Inform generations like 6 and 7.
Some other findings:
I-0 has a z5 file of exactly the largest size accepted by the conversion program. As it turns out, it seems to work just fine, but it’s incredibly slow. “TAKE ALL FROM PURSE” at the beginning takes about 7.5 minutes while running the emulator at 100% speed.
I tried converting a few different Inform 6 games. Some work well, running at a reasonable speed (i.e. comparable to the speed of Infocom games on the C64). Some just crash before displaying any text, and some are too slow to be bearable even for someone with a reasonably good patience. My conclusion is that games with a lot of code running in the background, like daemons, timers, each_turn etc, aren’t good candidates.
One interesting case: I tried to get The Temple to run. The game worked, but printed run-time errors which had to do with the adaptive hint system. The run-time errors said that object x didn’t have a property y to send a message to. As it turned out, y was a custom property. I modified the source so that it was an alias for one of the common properties used by the library, and after that it worked fine. I don’t know if custom properties (is that even the right term?) might be implemented in a way that breaks compatibility with one or more Infocom ZIP:s, or if this is just a random bug in the terp used here.
Somehow, I feel that getting a game to run on an actual C64, with the look and feel of the Infocom games that I started out playing on the C64, lends the game an air of… credibility perhaps. Or seriousness, or impressiveness. Even when running in an emulator, that’s partly present. I really enjoy that experience.
I have this wild idea of writing a special-purpose terminal program on a C64 specifically for playing interactive fiction which actually runs on a modern computer.
That sounds like a great idea, David. There should be some terminal program code you could reuse.
It seems you should be able to communicate with another computer at at least 2400 bps, possibly even up to 9600 bps.
I gave this same game a shot in the newer (in development) c64 z-machine interpreter, Ozmoo.
It runs at a playable speed in the vice emulator.
body-d64.zip (74.1 KB)
It would be possible in principle to transpile from the Z-Machine to machine code for the C64 or another CPU. Not a simple task of course.
I suppose that would be possible, but the strength of z-machine games is the z-machine being built for various platforms and the games themselves being byte-compiled to run on any z-machine running on any host machine.