🌈 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.
Creating an OpenGL game for both the Palm and iOS - I've made a triumphant return to the blogosphere with the release of my new game, 'Tanks!' developed for Palm Pre/Pixie and soon for iPhone devices. The game, an experiment to learn OpenGLES 2.0, is a testament to the feasibility of porting C++ or C code from iOS to Palm PDK, despite minor challenges with UI interaction and audio. So gear up, folks! Download 'Tanks!', step onto the battlefield and let the mayhem begin! Next stop on my coding odyssey - Android!
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!
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!
NeHe OpenGL tutorial 2, 3 and 4 ported to ES 2.0 - As I strove to learn OpenGLES 2.0 for new gaming projects on iPhone and Palm Pre, I faced certain challenges due to the introduction of a programmable graphics pipeline in OpenGLES 2.0. With this mechanism, we are responsible for writing the code to generate our graphics, which was overwhelming at first. To help others, I ported some of the NeHe tutorials over to OpenGLES2.0 on iPhone in an easily-digestible way. In this post, you will find a walkthrough of the first 4 tutorials, complete with codes, explanations and screenshots to make learning easier.

Related Videos

Laser Projected Asteroids: ESP32 Reinvents Classic Arcade Game! - Learn how to create a classic Arduino ESP32 Asteroids game with laser projection, including a tour of the system hardware and a look at its firmware and game engine. Watch a demonstration and comparison of fonts, as well as an overview of the audio output. Dive into the schematics and try out the game for yourself!
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]
AR Sudoku Solver in Your Browser: TensorFlow & Image Processing Magic - Discover how to recreate a Sudoku app using browser APIs and ecosystem advancements, and explore the image processing pipeline technique for extracting Sudoku puzzles and solving them.
Surprisingly Simple! - “16-bit" Mini Handheld Arcade - In this video, I explore and dissect a 16-bit handheld gaming machine that hosts 160 Sega games. This interesting gadget priced at twenty dollars is surprisingly accurate to the original Sega console. After unboxing and testing the game Golden Axe, I opened it up to check out the internal components like the pcb, chips, battery pack and controls. Although it's not very hackable, as the functionality lies under an epoxy blob, this little machine was a treat to disassemble and reassemble, all while still keeping its functionality intact. With a dash of nostalgia and quality gaming in a handheld package, the machine is certainly an intriguing find.
Wio Terminal Audio Visualizer - Learn about porting an audio monitor to the WiiO terminal, featuring a built-in microphone, gyroscope, accelerometer, light sensor, and infrared emitter. Check out the simple base class used for the display and the efficient template class implementation to swap out between two different display libraries.
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