Worlds Smallest RPG with a Haiku

Developers Notebook #2
How things came about (by v*)

Here is some background related to creating DH…

The game was a project for me to do with my 11 year old daughter, I wanted to show her about programming on a very old and slow computer – so I went to the beginning, the Commodore PET! (because I still have one that I collected out of a dumpster in 1988)

But pure assembly wasn’t really interesting to her, so I found the cc65 C compiler and decided to see what it could do. Step by step I created my own core libraries (as the standard libraries have so much overhead), and in a few parts I am using inline assembly.

After an initial “proof of concept” that we could get cc65 generated code to run on the PET and do interesting things, then my daughter went into full “story mode” and sketched out some maps and creatures. We decided to make “the smallest RPG ever” – because I wanted to show her loading the program using a cassette tape, and old friends with original PET 2001 could also play. So for these reasons, we had to keep the game very simple. In a way, it is like an “electronic board game” with just a few simple rules.

But my daughter requested only one thing: “at the end, it must have a fire breathing dragon!” And we did it! That was a lot of fun seeing it actually work the first time.

Some C64 owners might be disappointed in DH. Just I remind them, it is a PET game that happens to cross-compile easily to the C64.. But, I understand it doesn’t truly take advantage of the C64 capabilities – I am working on adding SID support, maybe another week for that. But for example, I got the PRG to the C64 game “1942”, and noticed it is only 32K also. So for 32K, it has very excellent graphics and sound. It must be a pure assembly language game, they pack in a lot of capability with very precise code. Contrast to something like Ultima I which uses a full 170K disk – Richard certainly packed a lot of capability into his game, but it’s not something you’d load from tape.

But I think there is a distinction between a game that just lives purely in the CPU and RAM, versus more extensive games that “pulls more in” from a disk. Maybe it’s not an important distinction (and a moot point today), but (to me) that was the essence of the 1970s arcade games: they lived only on chips (ROMs) and were a self contained system. There is just a kind of purity about it, versus later games with files — where those files could become corrupted or modified.

The MapEditor for Destiny Hunter uses external files, to save and load maps as we were designing them. But the maps are then exported into source code, which then gets directly compiled into the game, not read as an external file. So I do know how to work with file systems, just for this particular game I chose not to. The game would naturally be as extensive as the 32K RAM would allow me to do, and I was glad to get 8 levels out of it (combined also with the normal overhead of C vs assembly).

I am happy with the performance of my game Destiny Hunter overall (especially just earlier today, I doubled the performance of the animation parts, making the game much more “crisp”). But it was not easy – I used BeyondCompare on .s files (assembly file results of the C code), to stay on top of what my C was getting compiled into between changes. To make trades on when something should be a function versus a #define macro, or what should be declared as register variables. To get acceptable performance on a 1MHz processor, even use of the stack becomes a luxury (cc65 defaulted to 2K stack, which I dropped down to 50 bytes). So I highly respect the pure assembly programs that are very optimal in their use of registers, it is a difference you can really “feel” in control response times and overall “feel” of a game.

My daughter is already drafting up a sequel for DH, and in that one we will probably “pull more in” (from files) to be a much larger game.

Meanwhile, as a technical interest – since DH is in C, I’m thinking I may try to cross-compile to the Apple ][, x86, and Z80. However, I have ordered an actual C64 (a rebuilt original, with the user-port), perhaps we’ll make the sequel using proper graphic and sound capability of the C64!

  • Arrows (and the bow) get inverted when over BEACH, this was a sort of “special effect” on the PET version to make things look a little nicer It didn’t look as nice on the C64 version, so it was taken out there.
  • Sound was added just a couple days ago, and the performance was updated substantially, so be sure to always get the newest PRG
  • The 40th column isn’t used (long story about that- it was sort of a mistake on my part, and I didn’t go back to fix it because I’d have to update my MapEditor! it was a side-effect of the early printf function I used in cc65, but when I replaced that with my own direct screen-print, I didn’t update to then use the last column)
  • I’m not sure if it is really is the “worlds smallest RPG ever”; I call it RPG because there are stats and a random number generator is used to decide hit/defense, and there is a full story on why you’re defeating these creatures. BUT, I don’t have “cut scenes” and no “shop purchases” (no money), so maybe it’s not an RPG?
  • remember the PET has no graphics capability, so right away we knew we would have to use PETSCII symbols to depict things in the game. The PET does have a “graphics mode” that removes the gap between rows, so we are using that. All the same PETSCII symbols carried over to the C64 version, which will be one challenge for any Z80 or x86 port.
  • There is a LORE section at the DH website, which talks about some of the decisions at each stage, and things we had to take out. But also describes what the overall story of the game is.

During the development, we started naming all the creatures in the game. For one thing, I found this made it easier to SEARCH for them in the source code, if I wanted to make adjustments (what they looked like, how fast they moved, what direction they spawned from, etc). All the names are in the LORE section of our DH website, but as an inside joke we decided to name them all starting with the letter-J. No real reason, it was just something funny my daughter and I started doing with these names.

But then at some point, the game Sonic Hedgehog came to my mind – and I recalled at the end of those levels of that game, a bunch of animals would jump out of the boss ship, because you had rescued them. And my daughter and I played some old-fashion Genesis-style Sonic, I showed her about that.

So then she said: what if the creatures in our game were cursed, and were actually animals? So she came up with this backstory:


The story here is that the HYDRA (at the end) is reborn every few centuries. What you see scattered along the right side of STAGE 8 are the bones of past HYDRAs. As usual, it is a sad story: JASMINE is actually a triplet of three sisters who were cursed forever to perform this cycle of rebirth and enragement (due to having broken the heart of another maiden, who out of jealousy then hired the services of a sorceress to conjure up this wicked enchantment for eternity). As it so happened, the JASMINE sisters had many pets, and these were cursed as well to become the CHALLENGES you see on this island (except the CROCS, STRZYGA and SLUAGH – those are just vile creatures within the area for other reasons). Clearly, no way has been discovered to remove the curse, only that a brave adventurer must arise to place them all back to rest until the next cycle. But a merchant once claimed to have over-heard these words from the traveler with the orb: “She lives!”

(presumably the sorceress who came up with the curse lives…. TBD)

(and within the game there is actually a secret orb that can be found – which essentially gives you no STAMINA penalty {sort of like the Pac Man power pellet}, but it is one time use only and you can save it for later stages; the traveler mentioned above had accidentally dropped it {we wanted an intro screen to describe this, but ran out of memory for it — and I really wanted to avoid depending on external files})

So, that explains the hunting: they’re cursed animals resurrected as monsters.

Oh a little thing I wanted to quickly add: originally we wanted the story to flip between YOU and your PERSONA, since the PERSONA is supposed to be your ancestor. And originally we had a level where you would encounter your “opposite” PERSONA – we wanted a game to try to stress the concept of “balance” or “opposites” or yin/yang, but with 32K RAM we couldn’t fit all the ideas we had. One thing I really miss about modern games are things like the Virtues mentioned in Ultima – I think just saying those words, those ideas, it gets people thinking about it. What is Compassion, what is Spirituality, what is Honor, etc. They are frequency things in Norse mythology as well. Obviously this game doesn’t reach that plateau, as frankly it is more of a practice on just how to use the cc65 tool to build something. But I hope in future work we can explore these ideas further, to get games back into story-telling and less about cash-shops.

Also, I really wanted to avoid the typical concept of HEALTH POTIONS, so I came up with PERSISTENCY instead. It’s not as cool as an Ultima Virtue – but it is a word that I think gets people thinking about the concept: we might get knocked down now and then, but by our “mettle” and grit, we PERSIST in achieving our objectives.

Also, perhaps we are the only game with a Haiku (5-7-5 style), which is as follows (upon putting the HYDRA back to rest, it is customary to speak out this haiku):

Be at peace again,
Till the next cycle begins,
You three stay within.

(the three being the three sisters – the thing is, all the inhabitants of the island have long forgotten about the curse– they just want to be rid of the creatures– but the sequel might be about finding that mysterious traveler and helping to unlock the curse! we’re debating on whether to have a twist that maybe the 3 sisters deserved what they got… not sure yet)

I was able to fit this Haiku at the very end of the game!

CHIMES were my idea. Bottom line is, I wanted a way to initialize the random number generator (and I hadn’t yet figured out how to access the time counter, Jiffies, of the PET). I didn’t want the game to really use MALE/FEMALE, instead I used the word DIRECTION. And really, the “direction” does decide whether your random numbers are ADDED or SUBTRACTED, that’s really where the word DIRECTION came about. But in ancient Hindu, Yoni/Langa are sort of precursors to Yin/Yang – and originally I thought they were male/female oriented, but turns out they aren’t really (as the Hindu gods would morph between genders). I’m not trying to send any particular message here – except maybe a subtle reminder that there does seem to be some kind of natural “duality” in the universe — things have opposites — and these aren’t bad or opposing forces, but should be viewed as complementary/balancing forces (i.e. that’s the essence of diversity itself, to have these differences, instead of trying to force everything to be the same),

Anyhow, Asian cultures (and perhaps many others) have temples to pray and honor to ancestors – so I tried to theme something around that, and came up with the CHIMES. As your spirit is being created, you have an opportunity to ring CHIMES. And your ancestors (or whomever is responsible for crafting your being) can respond to those CHIMES (like gongs) in different ways. My daughter did come up with the art for these beings (in the DH LORE page).

I wanted BLESSINGs to be like those emergency power ups you get in the game 1942 – maybe not to wreck the entire field, but to be a rare item that helped in a big way when you needed it. So there is a rare chance to get those from BLESSINGS. There is no real-precise trick about it, it is all mostly random — but I will say, the earlier CHIMES have a higher chance of giving a blessing than the later ones (your DIRECTION initializes a MOD value, which then gets “normalized” back to 5 the more CHIMES you ring — it sounds complicated but it’s not all that, the code is there in github 🙂 ).

Think that covers it all 🙂 For such a “tiny RPG” we did try to put a lot of depth into the story.

%d bloggers like this: