Not My Best Try at Programming an Ultima Clone
My original idea for a ZX81 version of Ultima in BASIC.
I’ve talked about ZX-Ultima before. It was first attempt at building an Ultima like game on the ZX81 using BASIC. Written in 2012, it was a pretty ambitious project for me. I really enjoyed playing Ultima III on my C64 as a teenager. I always wondered what it would look like on my ZX81. It was bad. Yet, at the same time you could see the seeds of what would come later.
What was I thinking.
Writing a ZX81 Ultima game was always going to be a challenge. I mean, the ZX81 uses it’s z80 processor to display the screen. Right off the bat, that cost me 80% of the CPU. Add in that I’m using interpreted BASIC, and you realize I didn’t have a lot to work with. Yet, I had an idea!
The ZX81 is pretty fast at printing large amounts of text. As I’ve shown before, a large PRINT AT
statement allows you to quickly print a lot of text to the screen. Having played a bit with some double buffering arrays, I wondered if I could build the screen in an array and print it. In fact, I would create two arrays. This would allow me two frames of animation. Not much, but good enough!
Trying the game out.
With the idea in mind, I started to build out a graphic engine around that concept. I would use two screen arrays, J$ and K$, and splice in the tiles. The math wasn’t too complex and, after a few tries, I had the basic idea working.
The tile code looked like the following—I just removed the ZX81 graphics.
1490 REM ****WATER
1500 LET J$(SLOC TO SLOC+3)="XXX
X"
1510 LET J$(SLOC+32 TO SLOC+35)=
"XXXX"
1520 LET J$(SLOC+64 TO SLOC+67)=
"XXXX"
1530 LET J$(SLOC+96 TO SLOC+99)=
"XXXX"
1540 LET K$(SLOC TO SLOC+3)="XXX
X"
1550 LET K$(SLOC+32 TO SLOC+35)=
"XXXX"
1560 LET K$(SLOC+64 TO SLOC+67)=
"XXXX"
1570 LET K$(SLOC+96 TO SLOC+99)=
"XXXX"
1580 RETURN
Using the screen real estate I had, I ended up with a 5x5 grid of tiles. I had water, castles with flags, and your fighter avatar. You might notice that they aren’t too different from what I now have in Gem Quest. Reading from a world array, I would load in each tile and follow call the routine above for each location.
To my surprise, the graphics looked good. There wasn’t any noticeable little lag in the display. The animations, although simple, worked well. Although, for the water, I was limited to two frames versus the eight I use today. Still, the game had an overall Ultima vibe to it.
Quickly hitting a wall.
To my dismay, the similarities ended there. Although the black and white graphics could be pawned off as artistic, the game play couldn’t. I could move around the world map, but it was painful. Even using FAST
mode, it takes 6 to 10 seconds to build the new display. Once done, the display is fine. But just moving a few tiles is an exercise in extreme patience.
Even if this game had worked, I don’t think I’d have gone far with it. Since the array was the screen, I would have had to put all the text into the two arrays. That would have been slow and tedious. I also didn’t know how I would deal with locations yet. Maybe with time I could have improved the speed. It wasn’t to be. Like Tiles and the first version of Gem Quest, ZX-Ultima became a programming exercise.
As noted in an earlier article, I gave up on this version of the game. I found better and faster ways to get the display to work using MCODER. Of course, those attempts had their own limitations. Now in 2021, ZX-Ultima is now Gem Quest. Learning z80 assembler, I've programmed the game in machine code. Though it is still fun to look back on my original idea. The spark that lit a fire, so to speak.
Back to the present.
Speaking of fires. Two months in, I just finished adding in the last location today. The game is shaping up quite nicely, with a lot more graphics and game mechanics. I have about 645 bytes free at the moment. That doesn’t sound like much, until you realize I’ve packed in over a dozen locations, multiple NPCs, more graphic tiles, game text, and play mechanics. For contrast, compare the latest screen shot with the image above:
Screen Shot 2021-03-29 at 10.49.37 PM by Steven Reid, on Flickr
I’m not done with Gem Quest. I have a long laundry list of to do items. Some of those ideas I may reject or rework still. But I’m having a blast! I’m not sure if it is the longest I’ve spent on a ZX81 game, but it is pretty close. I do know that it is the most diverse and interesting game I’ve written. If only I’d done this back in the 80’s.