Castle Quest Was My Late-Night ZX81 Adventure with AI


A look at how Castle Quest, a simple ZX81 text adventure, came together using vibe coding, AI prompts, and a lot of hands-on tweaking.

With little time lately, I decided to explore some Generative AI ideas to flesh out new concepts. I’ve dabbled in vibe coding for some time now and thought I’d see how the models would do with adventure-style games. One of the results of that was Castle Quest, a small text adventure for the ZX81.

# Finding the vibe.

I find the whole concept of vibe coding a bit funny. For me, getting into a vibe is when coding comes naturally. It’s the feeling you get when your program comes together. You forget the time and just code. Last night was one of those times.

This was actually my second program. I first started with ChatGPT, playing with a more RPG-style game. Although I was making progress, I kept losing the code I was building, and it got annoying trying to piece it all together. I decided to shift gears and use Gemini to build an Infocom-like text adventure instead.

Castle Quest, ZX81 Start Screenshot, 2025 by Steven ReidCastle Quest, ZX81 Start Screenshot, 2025 by Steven Reid

Using more guided prompts and carefully tracking the code, I was more successful this time. Usually, my forays into ZX81 coding involved Z80 assembly. A great way to test an LLM’s capabilities, but not a great way to code — there’s just not enough code to build real proficiency. This time, I stuck to BASIC, and it worked better.

# Building the game.

With this different approach, I focused on building something that worked. My prompts focused on generating code that ran correctly. The game, small and light, wasn’t fully ZX81 BASIC-specific — it was just BASIC code. That worked well enough, though not perfectly.

My biggest challenge is that Sinclair BASIC is much simpler than other BASICs — and in other ways, more complex. Once you get comfortable with how it works, you can do some pretty crazy stuff. With the ZX81, just because you can do something doesn’t mean you should.

Castle Quest, ZX81 Take Action Screenshot, 2025 by Steven ReidCastle Quest, ZX81 Take Action Screenshot, 2025 by Steven Reid

Because of that, I spent a good amount of time correcting and adjusting the code. I’d iterate on the data structures to get to a workable solution. Along the way, I also fixed syntax issues and worked around how the ZX81 managed variables. It might not sound like fun, but it was. I got into it, lost track of time, and stayed up way too late.

In the end, however, I had a game. I kept a lot of the original logic that was generated. Although simplistic, it fits the style of the vintage ZX81. Not only does it work, but it is playable. There’s something to be said for focusing on form over function. Castle Quest works for what it is.

# But is it yours?

For the purist, you might say it isn’t my game. To an extent, that’s true for most ideas. I wrote a lot of programs based on other ideas. I built plenty of games that were my versions of Pac-Man or Dragon’s Lair. Even for my original programs, they borrowed elements I learned from others. That’s the nature of coding. There is balance. The fun is in the doing. How you get there doesn’t matter as much.

Looking at the code, you’ll see flavors of others. There are parts where I would have taken a different approach. A good portion, though, is still me. I’d tweak and rewrite sections to fix issues. I’d get Gemini to build a routine for me that I would then adjust to my needs. That was the way to make things work.

Much of the evening, after getting the first code base to run, was spent polishing it. I spent a good amount of time tweaking the output. I like to focus on look and feel. Although the LLM did okay, it needed some personal touch. I spent much of that evening making things work well and feel right.

Castle Quest, ZX81 East Action Screenshot, 2025 by Steven ReidCastle Quest, ZX81 East Action Screenshot, 2025 by Steven Reid

In the end, that makes this program mine. The game may seem weak or simple, but it is functional and playable. It looks and plays well. I had fun fixing little challenges around the string arrays. Castle Quest is a collaboration.

# More to it.

I’ve written text games before. As such, it’s easy to say there’s a better way. With the ZX81’s limited memory and the speed of BASIC, an assembly version would be better. But that wasn’t the point. I wanted to build something I’d have fun with. Mission accomplished.

If I had more time, I’d redo the room structure and add more detailed descriptions. I thought about building a more Infocom-like display engine. That would be a fun challenge on the ZX81, but not overly hard. I got to the point last night that I needed to wrap up. There is always tomorrow. But this program is done.



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive