PET Tower Defense 2021

Another New Game For My Forty Year Old 8-Bit Computer

In May 2020, I participated in a weekend game hackathon and created a clone of my favourite arcade game, Williams Defender, for my forty year old 8-bit Commodore PET computer. Programming the game was a tribute to Chuck Peddle, the inventor of the 6502 processor who had recently passed away. The 6502 chip essentially launched the personal computer industry and was the processor in the early Apple, Atari, Nintendo, Commodore and most other 8-bit machines (think of it as the “Intel inside” for the 8-bit era, although it was made by a different company called MOS which eventually got bought by Commodore). You can read about my Defender game here, and play it here.

I liken programming older machines in “machine code” to solving puzzles — sometimes you optimize for space since memory is limited, sometimes you optimize for performance since the processor is relatively slow, and sometimes you optimize for typing since editors are fairly primitive (no copy-and-paste for example so you end up creating more subroutines and loops to save typing time). But overall those little dopamine “hits” you get from writing a good subroutine or making something move just a little bit faster probably triggers the same paths as solving a Sodoku or crossword puzzle.

On a different topic, we recently saw the “passing” of another historical computer technology — Adobe Flash. If you don’t know Flash, it was the technology behind many (probably most) casual games on the internet and on Facebook (ie most casual games before iPhone). Flash was used in all kinds of games — Scrabble, Bingo, Farmville, etc. In July 2017, Adobe announced that it would cease support of Flash at the end of 2020, and as we head further into 2021 it seems that most browsers will soon prevent Flash from being installed (and hence stop Flash games from being played).

My favourite Flash game? Desktop Tower Defense, a game popular in the late 2000s that involved setting up “towers” to steer and shoot “creeps” before they exit. From Wikipedia:

In the game, the player must stop a set number of enemies, known in the genre as “creeps”, from reaching a set point on the playing field. This is accomplished by building and upgrading towers that shoot at, damage and kill the enemy creeps before they are able to reach their objective. Unlike many other tower defense games, the path of the creeps themselves is not set; instead, the towers built determine the path of the creeps, who take the shortest path they can find to the exit.

Programming a new version of Desktop Tower Defense for my 40 year old Commodore PET became my new 2020 holiday project. The graphics on these old machines is challenging at best, and the amount of CPU you have to implement stuff is definitely constrained. I had to simplify the game to have only two types of towers (a sniper and a rocket launcher, the original has eight different types) and creeps have only one entrance and one exit (in the main version of the original, creeps enter from the left and top, and exit at the right and bottom).

But, despite running on a 40 year old 6502 processor clocking at 1MHz with 32K of memory, the game plays reasonably well. All the “tricks” of the original are there :

  • earn currency by killing creeps,
  • spend your currency to place the cheapest towers around the playing zone to create corridors,
  • eventually set up a winding maze to maximize the creep kill-zone,
  • upgrade certain towers in key corner locations, and,
  • delete and add towers at key locations to force creeps to double-back where they came from, then do it again to have them return on their original path.

Here’s a video of a 2X speed play-through with a decent maze and decent score.

You can try out PET Tower Defence 2021 in an online simulator. (Thanks to Norbert Landsteiner for hosting it on his amazing retro PET website!) or download the game if you happen to use the Commodore PET Vice emulator or have your own PET kicking around.