If youíve been following me the last couple of months, you know Iíve been revisiting Gem Quest. Intended to be an Ultima style game for the ZX81, outside of a few demoís I really hadnít gotten far. That isnít the case now. Iíve spent the last month learning z80 assembly code and hacking my way through the game. Tracking my progress, Iíve been capturing that journey in pictures and movies, which Iíve uploaded into a Flickr album.
Getting everything organized and working.
A good part of my early journey was learning z80 assembler and finding a way to compile it. I ended up landing on a pretty rapid development workflow. I started by downloading Visual Studio Code, and a few add-ins, as my editor. I figured out that I could use JSZeddy to quickly compile code and see the results. Although not great for debugging, I use z80asm and ZXSP for that, it is nice having the debugger and emulator together. By the middle of February, I was ready to start coding again.
To get started, I managed to get my first attempt at creating the Gem Quest screen working. JSZeddy is picky, preferring everything to be lowercase. Once I figured that out, I found I could just copy the code from my editor into JSZeddy, then assemble and run it. With my development environment figured out, I was ready to start building the game.
Beginning to make progress.
Another advantage of using JSZeddy is that I could keep all my documentation open next to it. I have the online version of ďMastering Machine Code on Your ZX81,Ē by Toni Baker. I use the annotated version by Thunor. I also keep a copy of the ďSinclair ZX81 BASIC Programming,Ē by Steven Vickers, up for character code and some memory references.
Given I was learning z80 assembler at the same time Iím trying to develop a game, I started slow. My first goal was to poke a tile into the display. Once I got that working, I then poked a screenful of the same tiles. I then got them to animate, using some variables.
My first thought, when I started, was add in the functionality from my previous attempts. I was thinking baby steps, trying to get my mind to think in assembler. I envisioned another tech demo, not sure how far Iíd get in the project. After a few days, I had the world map working, having a lot of fun figuring things out.
Development was progressing smoothly.
My next focus was on movement. I had to figure out how to read the keyboard and then act on it. That took a bit of trial and error on my part. Once I figured it out, though, I was rapidly iterating. At this point, I got the message window working, including scrolling. I added in some stats, even if just fake. Movement was working, along with some place holders for other commands.
At this point, Gem Quest started to look like a game. And, at this point, I started to move away from just creating a tech demo to making something you could play. I dug out my old game notes and started adding new ideas to them. My mind started to fill with game ideas beyond what I had originally planned. And, looking at my memory consumption, I was pretty sure I had room for them.
I had been using Excel to build out the graphics. I know youíre probably asking why. To be honest, it was convenient and I could use the cells as a graph paper. I could also copy sheets into tabs, keeping all my ideas in one file. I should look for a better program, but it has been working for me. I started to clean up old tiles and build new graphics.
Going for something new: monsters, people and more.
At this point, development was going much faster. I was finishing up adding in the features from my first Gem Quest. I figured out how to add in statistics, with health and food now changing as you moved. It was at this point that I began moving beyond what Iíd coding in my original games. I now had monsters!
They werenít super exciting yet, but it was fun seeing different items now in the world. I started to add more graphics, such as the royal castle and chests. Ah, chests! You could now open them. But beware, they could be trapped and cause you pain. I also started to add in game elements such as the shrine and gems. Those will become a key part of the game play in the future.
From the end of February until this weekend, but development was full of fits and spurts. I didnít have a huge amount of time to work on the game, but it filled my thoughts. I spent a lot of time thinking about how the game will progress. Iíll really should capture some of that in my developer diary.
But the bigger challenge was thinking through more difficult challenges. Getting the NPCs added to the world was iterative. I created and refactored ways to add them into the game. I worked on combat, which to my surprise was pretty easy. The cool factor for me was when I got a chest to drop. I was so excited! Gem Quest was starting to play like a real game.
The biggest challenge was trying to get the NPCs to move. I found that random movement was easy, but getting them to follow was a pain. I couldnít quite get the math right. And then, it hit me! I figured out how to clear the current row using an
AND. The algorithm just fell into place, and was much shorter than I had envisioned.
Dynamic graphics engine and the future.
Emboldened by my accomplishments, I started to add in more advanced functions. I wanted a more dynamic world, one that would give it an Ultima feeling. I really wanted to add darkness to the game. Reworking my the original graphic engine, I took a different approach to building the screen. Not only was I able to add in line of sight code, but I tightened it up quite a bit.
That brings us to the present where I have most of the game mechanics in place. I have a functional and fast graphics engine. My next task is to start building in the game locations such as castles and dungeons. In my notes, I have most of the story laid out. But I need to finish the final couple of game elements before I can piece it together.
I expect it will take me most this month to get that done. If all goes well, I might have the fist draft of the game by this Spring. For now, Iíll leave you with some game play video. Let me know what you think!