There is a text adventure program that I have been wanting to convert to MC-10 for some times. It's by Jason Dyer. The name of the game, "The Night of the Vampire Bunnies" is what intrigued me. Such a playful title. I was able to get my hands on the BASIC source fairly easily. There were versions in Microsoft GW Basic in various places on the Net. GW BASIC is very similar to Microsoft Micro Color BASIC for the MC-10. It's usually fairly easy to translate such programs. I was able to get the slight differences between BASICs fixed up without much fuss.
Then I converted most of the print statements to use my standard 32 character word-wrap subroutine, so that things would print nicely on the small 32X16 screen of the MC-10. The problem was, I needed to use the maximum extended memory of the MC-10 emulator to test and run the program. Depending how you configure things on VMC10 you can get up to almost 32K of emulated RAM memory. In other words, more than 12K more than an MC-10 with the standard memory pack. I did this all a few years back. The program was running, but not able to run on a standard machine. I was daunted by the prospect of paring it down by more than 12K, so I put it aside as a specialty program and promised myself to get back to it to defeat the demonic bunny I assumed lurked at its heart.
Well as things go, of course, I got distracted by the endless number of other BASIC programming projects that I have going at any time. In the meantime I learned all kinds of techniques, many I have written about in this blog, for condensing programs, especially text intensive programs such as text adventures. In my last project I translated a classic Hungarian Language text adventure "A Hos Lovag." It whetted my appetite for working on text adventures again. So I thought I would return to Vampire Bunnies.
The most basic technique I have found for making text adventures smaller so they will fit in the 20K of the ordinary MC-10, is to simplify the text messages. These messages can often be boiled down to something much less complex. The trade-off is losing some of the unique flourish of the original author's writing. Often this is not a terrible loss as many of these games were written by very young programmers back in the early 80s. As a result they are often filled bad grammar and spelling mistakes. I can report that this was not the case with Bunnies. But there was quite a bit of repetition of the same messages or similar messages in different parts of the code. This was likely a result of the larger memory that a PC provides under GW BASIC. Programmers in the late 80s had room that those of the early 80s using simpler 8-bit home computers did not. So I was able to consolidate a lot of those messages into a subroutine and then simply GOTO or GOSUB to it.
Another technique I have found useful is to consolidate very common sequences of subroutine calls into their own subroutines. Then you simply have to make a single call to a routine that runs multiple subroutines. This is common in text adventures, in which you often have a bunch of actions being done at the end of player command sequences. It might be to reset variables, check player status, tally scores, display formatting, such as lines on the screen to demarcate a new turn etc. Jason (again likely because of the memory largess of GW BASIC) had lots of places where multiple subroutines sequences occurred at the end of the different possible player command sequences. This programming technique would have been prohibitive in 16K or 32K machines of the early 80s, but as I discovered later, Jason was inspired by the these early 80's BASIC games but was not creating his own games until the end of the 80s-- when he was 11! (I later found out he went on to become one of the most influential bloggers on early IF fiction with his well respected Renga in Blue blog). Bunnies is interesting because it plays like an early Greg Hassett, Scott Adams or Tim Hartnell adventure, but Jason was writing it in 1989. My technique of creating subroutines of subroutines can be even further improved (and make for more speedy execution) by putting the routines at the top of the program. So a line like this,
GOSUB 12000:GOSUB13000:GOSUB950:GOTO100
which might occur multiple times throughout the program (at the end of IF statements or command sequences) could be replaced by a single call to a subroutine containing all those routines:
6 GOSUB 12000:GOSUB13000:GOSUB950:GOTO100
And all references to these sequences can be triggered by:
GOTO6
or
THEN6
That's a lot of memory savings when you are counting your bytes. Sometimes these routines were not in the exact same sequence, so I did a little reordering (where it made no difference) before doing a global search and replace.
The real damage done to Jason's program, beyond condensing his descriptions, was that he had a fairly complex parser which I removed. It is clear that he did not simply use a standard existing two-word parser example program like "Tower of Mystery" from Compute't Guide to Text Adventures (1984). He created his own unique system for parsing command input. He had a complex system for removing extra article words like THE and ON and TO. He had ways of breaking the sentences input not just into VERB NOUN, but also W1$ and W2$. He had the ambition to have his players type in more complete English sentences and then to try to parse the input into coherent instructions that could be handled by the program.
This ambition would bite him in the buttocks when it came to the reception of his program years later in the hostile era of the Internet. The reviews of the program on various retro IF sites tend to complain about its departure from the standards of two word VERB-NOUN parsing. Some of the puzzles involved having to figure out 4 word command sequences. For example JUMP OVER THE RIVER rather than JUMP RIVER. To be fair, in the context of 80s hobby BASIC programming, this convention was not sacrosanct. It was with a little regret that I stripped out this unique parsing engine and put in its place an extremely simple 2-word parser. However, it did allow me the get the program down to about 20K. Then all I had to do was replace some multi-character variables with single or double variable names, take out extra spaces between commands, and renumber the program by an increment of 2, to get rid of the large line numbers, which just hog memory in interpreted versions of BASIC.
I now have a working version of "The Night of the Vampire Bunnies." I spiffed up the title page a little by adding an ASCII text graphic of a Vampire Bunny. I originally used a W to symbolize the nose and fangs but switched to an M, which I thought worked better. Then I also added some screen flickering using the different SG4 screen color sets in an attempt to evoke lightning flashes, which I think is in keeping with the B-horror movie feel Jason was attempting to evoke (along with Monty Python's Quest for the Holy Grail). Hopefully that will make up a little for the loss of his more detailed location descriptions.
Bunny now with downward pointing fangs |
Next project: I'm currently working on a BASIC program called "X-Rated Adventure" by V. K. Supersoft (1984), which was recently posted on the Coco Archive. So far, I've got it working on the MC-10. Not sure if I am going to release it. Have to try to play through and test it, both for function, and for appropriateness. Still it might be useful for psychologists to gain insight into an aspect of macho (teenage boy) culture in the early 80s.