ShipBattle ZX: My Battleship Game for Pico-8… and why I made it

CW: Death/Family Loss

Long time followers will know that I’ve dabbled in making simple games for weird systems, and so the idea of me trying my hand to pull something together for the fun fantasy console, Pico-8, won’t be a huge surprise. But the story of why I decided to do it is a bit more personal, and probably more interesting than the finished product… it’s something that I’ve been meaning to do for a while, and it’s also something I’ve wanted to talk about for a while.

TLDR: Fine, here is the link to ShipBattleZX for Pico-8 that you can play through your browser if you just want to check out the goods and don’t want an endearing tale of discovery and Hundstrasse family history.

I lost my Dad a few years ago. I don’t mean to sound like I’m just blurting it out, but the story doesn’t make much sense without knowing it, so I thought I’d get it out of the way early on. Like me, he was a dabbler in tech things and is probably more responsible than he realised for my own interest in tech, engineering, and gaming. Some of my earliest memories are of him showing me games on his ZX Spectrum and trying to explain how simple BASIC programs could get the computer to ‘do stuff’. There’s one such memory that stands out for me and it went something like this:

He had recently (and presumably painstakingly) manually typed in a BASIC program for the game ‘Battleship’ that had been printed in a magazine (which was how games were shared in the days of early home computing) only to be disappointed with the final experience. Whilst the game functioned, the ‘AI’ played entirely randomly regardless if the remaining ships would fit in the space, or even if it had hit a ship on their previous turn. In short, not a great Battleship AI (I mean, if you could even call it that). I remember Dad telling me that he had decided to write his own version of ‘Battleship’ for the Spectrum that plays more intelligently, attacking suitable spaces for the units remaining and searching near a previous ‘hit’ to destroy that ship. He also mentioned that he’d included bits of code to make it feel more ‘human’ to play against such as an occasional random move and a slight preference to attack near the edges of the board. I even remember playing what I’m pretty sure was this version of Battleship on the Spectrum around that time…. I’m guessing sometime in the late 80’s

Skip forward to a family sort through of ‘stuff’ a couple of years ago where I called dibs on Dad’s ZX Spectrum. The system itself is in need of repair, but I was mostly interested in the tapes. Particularly that one just labelled ‘games’ that I remembered from my childhood with its handwritten inlay detailing the counter position of each of the programs. Not only was it there and intact, but the Spectrum’s tape player still worked well enough that I could use it to play the tape and record it digitally as a *.wav file on to my PC. A quick download of an emulator and I was once again playing all those simple blocky and bloopey games. Mostly of course, I was looking for Dad’s Battleship that I found on the B-side towards the end of the tape, and it looks something like this:

My Dad’s version of Battleship for ZX Spectrum

The other ‘random-playing’ Battleship was also present earlier on the tape, lending further support of my memory of the original story. But it was the more elaborate version I’ve shown here that I recall playing as a young child. Unfortunately there’s no indication in the game or even in the comments in the code that this was the game Dad wrote, and part of me began to doubt my own memory of the story. So I decided to do a little bit of detective work to confirm my recollection and came up with three pretty good bits of evidence supporting this being Dad’s game.

First up, I searched several online ZX Spectrum repositories for this version of Battleship. Although there are many versions of Battleship around for Sinclair’s Champion of 80’s home computing, none of them looked remotely similar to this version. Reassuring me that it wasn’t just some other common version of the game floating around at the time.

Secondly, I had seen something like this game elsewhere. Growing up I had played this pen-and-paper version of Battleship published in the early 1960’s which I later realised had been my Dad’s when he was growing up

1960’s ‘Pen & Paper’ Battleships by Waddingtons

To be clear, we weren’t a Battleship obsessed household or anything… it’s just that this whole story revolves a lot around Battleship.

The Spectrum game bears some remarkable similarities to this pen & paper version, such as the unit names, the use of Sea, Land, and Air units, the coastline map, and the titles S.E.L.F. and N.M.E. to differentiate between the two play boards. It kind of dawned on me that Dad hadn’t just made any version of Battleship; he’d based it on the version of Battleship that he grew up playing.

Finally, I found amongst the tapes, one containing several incomplete versions of the game with increasing elements added; presumably his development versions of the game. Combined with the other pieces of evidence I was satisfied that I had tracked down the right version of the game. Curious about what exactly Dad had meant all those years ago I jumped in to the code to see how the game logic worked….

… but then I suddenly had an even ‘better‘, and ultimately more time consuming, idea. I decided to ‘remake’ Dad’s version of Battleship. Given his fondness for the ‘self-contained’ and limited development environment of the ZX Spectrum, the Pico-8, a self-contained development environment with strict limitations, felt like the right platform to do it on.

Of course, Spectrum BASIC and Pico-8’s brand of Lua are quite different languages; the former being one of line numbers and gosubs, and the latter being functions and update loops… and I haven’t done any BASIC programming for a long time (again, I’m not really a coder). Technologically too, these are two very different systems. This meant that I needed to unpick the game logic of the BASIC programme and recreate it as closely as possible on Pico-8 rather than being able to ‘copy’ anything directly across. Visually they needed to look quite different too. Strictly speaking the Spectrum has a higher resolution display in pure pixel numbers, but the quirk of the colour system gives the games a very distinctive look. Pico-8 has a distinctive colour palette, but fewer limits on how you can build sprites, and an overall lower resolution. This all meant that I could make the gameboard look ‘fancier’, but wouldn’t have the pixels to display both boards on the screen at the same time, nor space for the additional text.

There were however a few things that I wanted to get as close to the original as possible. Firstly the ‘structure’ of the game should be the same, i.e. play area, logic for random coastline generation, unit types, placement rules etc. Secondly, and most importantly from my point of view, the enemy (of ‘Sincom’ as Dad had called it) AI should be reproduced as closely as possible. Finally I wanted to include some of the more quirky text and phrases. Essentially I wanted the game to be as close as possible to the original to play, even if I achieved that in a different way under the hood and accepting that I would need to put my own Pico-8 spin on the visuals.

My Pico-8 remake of Dad’s ZX Spectrum version of BattleShip. You can play it by clicking on the link at the end of this post if you’re interested.

This all started the best part of a year ago and I’ve been chipping away at it in little bursts of enthusiasm since then only to finally draw a line under it recently. Ultimately I think I did a pretty good job of getting the important things right, despite some very messy code. I also learnt a heck of a lot about the tricks of programming in Spectrum BASIC as well as how the Pico-8 worked. Chasing the logic of the original AI turned out to be a pretty epic task and probably the one that took the most sustained effort. Most of the difficulty was just in following the thread due to some of the more ingenious ways that lines of code were reused to reduce the program size. Maybe it was common practice at the time, but it took a while for me to get my head around sections where a block of code runs from start to finish or only alternate lines depending on what it is doing.

Outside of the programming exercise, this was the close for me of a 30+ year conversation with my Dad that began with me asking why the computer didn’t just cheat because ‘it must know where my boats are’ to picking apart and reconstructing the logic that he used. And to my 5 or 6 year old self I can confirm that there is at least one situation where the computer does cheat as a shortcut to target the final 4 of 9 squares for the ammo dump (as they are obvious by this point).

Anywho, if you’ve stuck with me this far, thanks for reading and you can check out my Pico-8 remake of my Dad’s ZX Spectrum version of BattleShip here: ShipBattle ZX

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at

Up ↑

%d bloggers like this: