🌈 ESP32-S3 Rainbow: ZX Spectrum Emulator Board! Get it on Crowd Supply →
View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

Fresh from resurrecting Tanks! Mayhem, I went digging for the other game I wrote back in the early App Store days: Invaders!, a 2009 Space Invaders homage for the iPhone. It wasn’t a straight clone - the aliens teleport in, some of them carry bubble shields, power-ups drift down on parachutes, and the score is displayed on glowing nixie tubes, because in 2009 I apparently thought everything looked better as a nixie tube.

The code that wasn’t there

There was one problem: I couldn’t find the source code anywhere. Tanks had been sitting safely in Dropbox for sixteen years. Invaders was on none of my drives, none of my backups, nowhere. It was written two laptops and at least three backup strategies ago, and I’d quietly written it off as gone forever.

Then I remembered that before GitHub ate the world, there was Bitbucket. I managed to log back into an account I’d forgotten I had, and there it was: the Objective-C, the sprite sheets, the Photoshop files, the .caf sound effects, even the original App Store screenshots. A complete time capsule from 2009.

I got lucky with one detail: Bitbucket deleted every Mercurial repository on the platform back in 2020. If nine-years-younger me had picked hg instead of git, this post wouldn’t exist.

The port

Same trick as last time: point Claude Code at the folder and ask it to get the game running in the browser. It read through the Objective-C classes, mapped out the sprite sheet, converted the .caf sounds to WAV with afconvert, and produced a plain JavaScript canvas game with no build step.

Invaders! running in the browser

Play it now at invaders.atomic14.com. Arrow keys or A/D to move, space to fire, 1-5 to toggle power-ups once you’ve caught them. It works on phones too, with the original touch controls.

And here’s the 2009 original for comparison:

The 2009 original

The clever bit of the port is the coordinate system. The original game logic all runs in OpenGL coordinates - origin at the bottom left, y pointing up. Rather than translating every constant and every bit of movement code to the browser’s upside-down coordinate system (and inevitably introducing a hundred off-by-one bugs), the web version keeps all the game logic in the original coordinates and flips everything in one place, at draw time. That meant the numbers from the 2009 code - the barrier positions, the alien grid spacing, the bullet speeds, the difficulty curve - could be copied across verbatim.

So what you’re playing is genuinely the 2009 game: the same 8x4 grid of aliens that speeds up as you thin it out, the same bubble-shielded aliens that start appearing from level 2 (that’s level 3 in the screenshot above), the same barriers that erode column by column (invader fire chews the top, your own shots chew the bottom), the same UFO trundling across every ten seconds.

A seventeen-year-old bug

The power-up system had a surprise in it. Each power-up is supposed to be gated by level - you shouldn’t see the laser blast until you’re a few levels in. Here’s Claude’s explanation of what the original code actually does:

The loop walks through the candidate upgrades looking for one that’s unlocked at the current level. But if none of them pass the check, it falls out of the loop with the last candidate still sitting in the upgrade variable - and then grants it anyway. The level gate compiles, runs, and has never once stopped a power-up from dropping.

Seventeen years that bug has been in the game, and neither I nor any player ever noticed, because the effect is just “you sometimes get a good power-up early”, which nobody complains about. The web version filters the candidates properly. It’s possible I’ve made the game slightly worse by fixing it.

The font that can’t say “dash”

One small improvement over the original: when you catch a power-up, the game now tells you what you got and which key fires it, in text along the bottom of the screen. The original just played a sound and lit up an icon, and you were left to work out what the mysterious fifth button did mid-firefight.

The text is drawn with the original 2009 bitmap font, which led to a very 2009 problem: the first version of the message said “Rapid fire - press 5”, and rendered with a hole in the middle. The font atlas contains the characters I needed in 2009 and not one glyph more: letters, digits, a period. No dash. No colon. Rather than regenerate a texture that’s been pixel-perfect for seventeen years, the message now reads “Rapid fire. Press 5”. The font wins.

Game over - you'll see this a lot

The code is on GitHub at atomic14/invaders-web: plain JavaScript, one file of game logic, every constant traceable back to the Objective-C it came from. The original source is in the repo too, safely somewhere that isn’t a forgotten Bitbucket account.

Two games rescued in one week. I’m starting to wonder what else I’ve written off as lost.

Related Posts

Tanks! Mayhem is back: 16 years later, in your browser - I dusted off my 2010 wireframe tank shooter, Tanks! Mayhem—pulled from the US App Store after an Atari complaint—and asked Claude Code to bring it back on the web. About half an hour later I had a faithful browser port: original models and sounds, Box2D physics via planck.js, and my neon line glow rebuilt with quad-expanded edges. A forgotten procedural radar shader finally shipped, multiplayer and the hated attack chopper stayed out, the code’s on GitHub, and it’s free to play at tanks.atomic14.com.
Updating Sudoku Grab - Currently, I am revitalizing Sudoku Grab, my first app ever, published in 2009. The plan involves updating the code, upgrading to ARC, simplifying the menu system, accommodating iOS7, and supporting 4-inch display sizes. Future updates may include iCloud syncing features for universal access to puzzles. This endeavor also gives me an excuse to switch to an iPhone5s!
Failing to solve Manic Miner with RL - I was never any good at Manic Miner, so I asked Claude Code to build something that could finish it for me on my ZX Spectrum emulator. We started with reinforcement learning, and failed. What actually worked was search - first on the emulator, and then on a model of the game Claude built from the disassembly.
Shoot3D for the iPad/iPhone - I'm thrilled to have introduced my first 3D game on the app store. The entire process served as a real learning curve, with some elements still appearing obscure, yet adding to the intrigue. The games section of the app store is known for its fierce competition, but challenging the status quo by doing something different from the regular utility apps is quite a welcome change. I'm generally proud of how the game has turned out and look forward to its reception. You can download the game on the app store.
Messing around with the XBOX Kinect - During my recent trip to Scotland, I teamed up with my friend, Rob, to integrate Kinect with my game, Aliens Invade. We worked with OpenNI and NITE for person tracking and pose detection after the initial hurdles with raw depth data. The game now requires the player to physically run left or right to dodge bullets, and fire by waving their hands. It not only works well but adds a lot of fun to the classic space invaders game!

Related Videos

ESP32-S3 ZX Spectrum - Full Color Silk Screen is really cool! - Super stoked to share this creation – an ESP32 ZX Spectrum emulator! Although it's still very much a proof-of-concept, it's looking pretty rad. I've got the classic games like Manic Miner, and yes, you can program in basic too! In perfect Sinclair fashion, I'm planning on selling this key piece of nostalgia for just £99. Work still needs to be done before the production phase, but rest assured, I'm meticulously working out the kinks, including tweaking the keyboard to ensure even better user experience. And on the technical side - a single ESP32S3 runs the show and we’ve multiplexed the keys exactly like the OG Spectrum. It's been great fun designing this piece of kit with the new full color silk screen printing from PCB way. Stay tuned for further updates!
Forget the Arduino Serial Plotter - try this instead! - Hey everyone! So, you're probably familiar with the Arduino serial plotter, right? It's useful for basic stuff, but I wanted something better, more cross-platform, and runs right in the browser. Enter the web serial plotter, using the web serial API! It's super flexible with zoom, export options, and light/dark mode. You can even pan through history or switch to absolute time. Plus, it's all secure and runs locally. It's open source, and I'd love your contributions or bug reports on GitHub. It's still a work in progress, but I think you'll find it pretty handy!
But does it run DOOM? ESP32 ZX Spectrum update - All right, it's time for an update on my ESP Rainbow, the ZX Spectrum emulator with stunning full-color silk screen printing. I've been testing the latest boards, and PCB Way did a fantastic job. The enhancements include upgraded firmware, a 128k ZX Spectrum emulator, and a new 2-watt speaker replacing the old 7-watt buzzer. You can enjoy great sound with PWM and even play 128k games like The Never Ending Story. I've also added a snapshot feature and ported my video player over. Hardware upgrades include new capacitors and a slick power control chip for seamless battery and USB mode switching. We're gearing up for a commercial release, hopefully by Christmas, so stay tuned. And yes, it does run Doom! [Laughter]
ESP-IDF 6 Setup in VS Code: Blink & Debug an ESP32-S3 - Time to get with the program and jump to ESP-IDF v6.0.1 in VS Code. I show you how to install the prerequisites (I’m on a Mac with Homebrew), run the ESP-IDF Installation Manager, spin up a Blink example for an ESP32-S3, tweak menuconfig (GPIO21, 500 ms), then build and flash—switching from stubborn USB JTAG to trusty UART when things fail. We check the monitor, bump CPU to 240 MHz, fix flash to 16 MB, peek at PSRAM, and give PCBWay a quick shout-out.
Surprisingly not CR*P - Vibing hardware - Well folks, what an adventure! After vibe coding our vibing button, I took up the challenge to vibe code the actual hardware for an ESP32 S3 dev board. Used a tool called at pile and gave it a whirl with some AI help from Claude. Interestingly, it handled everything from sourcing components with LCSC part numbers to wiring them up. Had a wee hiccup with missing capacitor in the RC circuit, but overall it was a thrilling ride watching the AI process! A bit of tweaking here and there, and we're good to go! Can't wait to see it in action.
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening


Published

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts