DND#1 on a Commodore PET

Just over a year back there was a contest announced on the Shroud of the Avatar site to port Richard Garriott’s first DND game to web browsers. The story is provided in the link but in brief this was the first in a series of unreleased DND games written by Garriott, the final one of which would become Akalabeth and start the Ultima series.

While the code doesn’t exactly mask the fact that this is the high school project of a teenager, the historical significance can’t be denied. I’ve been meaning to have a look at the game for a while and somehow never got around to it. That was until my latest addition to the man cave arrived:-

Commodore Pet

Looking every inch the stereotype of a 70’s computer, the Commodore PET was the first computer I ever used more years ago than I care to admit to. My Dad brought one home from work when I was 5 or 6 and it’s fair to say I was hooked from the start. This was long enough ago that just being able to control things on a screen at all impressed the hell out of most people. It occurs to me that his employer must have been a whole lot more trusting back then to let him borrow it as one of these would have cost near half his years salary as a university lecturer at the time. The PET was still half the price of the Apple II though which does beg the question quite how Richard Garriott was able to afford his half of the price tag as a school kid. At any rate, in the case of my 2001 series model, that 6 months salary would have bought 32K of RAM, a 1 Mhz 6502 processor and a 9 inch 40×25 character based green screen display.

The PET first came out in 1977, the same year as DND#1 and it struck me that in the absence of a PDP-11 it was the perfect platform to port the game on to for an authentic 70’s gaming experience. Also since Commodore BASIC is extremely similar to the one used on the PDP-11 there should be minimal work involved. I took a lazier option still and started from an Applesoft BASIC port by Aaron Lanterman. Both Apple and Commodore BASIC were based on Microsoft BASIC making them almost entirely compatible and limiting the amount of work I had to do.

The changes I made were:-

  • Convert everything to lower case. Despite the PET only having uppercase it needs all the BASIC commands to be lowercase when pasting the code into the WinVICE emulator.
  • Remove most of the spaces from the code. Other than the one after the line number and those in strings, Commodore BASIC ignores spaces and since memory is in extremely short supply they needed to go.
  • Shrunk all the arrays. These all appeared to be unnecessarily large and caused out of memory errors in their original sizes.
  • Hardcoded a dungeon into the code. The original game allowed the user to pick 1 of 6 dungeons which were then loaded from a file. This wasn’t an option for me so I pinched the first dungeon from the winning javascript port at http://www.kirith.com/DND1/pure-js/ and load the data into the dungeon array. You get this dungeon no matter what number you pick.

With all that done, I shoved it on an emulator, saved to a virtual cassette file, converted this to a wav and played it into my PET via one of those headphone -> cassette adaptors that people used to use in car stereos.

DND#1 - 1DND1 - 2 DND#1 - 3

6 and a half minutes of loading later, DND#1 was ready to go. Surprisingly all of this works and the game is indeed playable on the PET, or at least just about playable. The code that is run between player moves, controlling monsters and the like is more than the PET wants to cope with and the game runs at about 1 move a minute. I expect this may not be all that dissimilar to the experience on the PDP-11 and the experience is still less drawn out that playing that Ultima 1 board game. I’m sure this could be optimised but I haven’t looked at that part of the code yet. I kind of prefer to leave it as it is.

Aside from the speed of the game, I could do with putting back a few spaces into the code here and there and there is no saving but I decided it was good enough for my purposes and tried my hand at a few games.The actual game involves moving around a 26×26 dungeon finding gold, falling into pits, searching for secret doors, fighting monsters – most of the usual tropes of dungeon crawling RPG’s back before they became tropes. The map is only partially shown when the player chooses to look and the graphics are simply numbers in a grid with 4 representing a door, 5 a monster, 1 a wall etc.. I kept it simple with a fighter character and combat just involved swinging my sword and hoping to hit. In hindsight a bow and arrow might not have been a bad idea.

My games proved to be quite short (or would have if the thing ran quicker) with my usual end coming when I’d fallen down more pits than my supply of rope and spikes would allow me to climb out of. There isn’t any winning target in the game as such. Gold could be seen as a score of sorts but the player is left to find their own goals.

DND1 is very basic and not all that playable but has to be worth a glance at least for anyone interested in the pre-Ultima dark ages of early video games. It’s not hard to see how this evolved into Akalabeth – convert it to 3D and they really wouldn’t be all that much different. As for playing it on the PET, it’s certainly an oldschool experience if nothing else. A bit of optimisation to get the speed up really wouldn’t hurt – I might take another look at it some time. Any of the modern ports would probably be preferable but for anyone wanting to try this out the code is here, the tape file is here, and the wav file for loading on real hardware is here. These should also work on later 8 bit Commodore machines (VIC-20,C64,C128) since they were all built on the same framework.

The game isn’t all that user friendly. If you do play it, don’t ask for instructions or it kicks you out, make sure your player name is shavs and enter 16 (or any higher number) once you have bought enough equipment at the start to go into the game proper.

2 thoughts on “DND#1 on a Commodore PET

  1. Hey Pix, nice to see you back posting.

    I did try this game myself from some of the contest versions, and it really feel quite unplayable, however everything needs a beggining and it’s nice to see the origins of Ultima.

  2. Pingback: » Pix Plays Richard Garriott’s DND#1 On a Commodore PETThe Ultima Codex

Leave a Reply to Natreg Cancel reply

Your email address will not be published.