Arduino Fan Builds the World’s Smallest Space Invaders Game
Shock. Disbelief. Somehow an Arduino hobbyist built a Space Invaders arcade game that was just 3.1 inches tall. A mere 80 millimeters in height — its joystick made from a tiny hypodermic needle.
A video on YouTube proudly proclaimed it “the smallest fully-functional Space Invaders model in the world.”
But it’s also an example of that special magic that geeks do — and an inspiring tale of applied geekery from a very determined tinkerer.
A Mad Steampunk Does It Himself
It turns out that the world’s smallest Space Invaders cabinet is the work of Nicholaus D. Cranch, a developer, UNIX/Linux sysadmin and engineer based near Brighton, England. Cranch describes himself as a “programmer, engineer and polymath” in his profile on the projects site Hackaday, and according to his professional webpage he’s been working with computers since the 1980s.
On his web page, he recalled it as “a time without drop-in libraries to do the complicated stuff. A time when you had to do everything yourself. A time when you had to squeeze the last drop of processing power out of the machine and fit everything into the tiniest space.”
So not too surprisingly, Cranch now works as a technology consultant.
But it’s also brought some fascinating side projects into his life.
“Some years ago, I bought a couple of these very cheap I2C OLED screens, just to play with,” Cranch said in the video about his Space Invaders project. The tiny screen measures just 25 millimeters across — about the same width as a U.S. quarter — offering just 128 by 64 pixels. “They’re dirt cheap, around $4,” Cranch told me in an email.
But you never know when a creative project will come along requiring a tiny, 25-millimeter screen.
Cranch is also a steampunk aficionado, and began fashioning one of the tiny displays into a steampunk accessory quaintly dubbed the “Cybernetically Enhanced Ocular Prosthetic.” It has to be seen to be believed — a device that mechanically lowers a vision-magnifying loupe into position, using ultrasonic soundwave-detection to calculate distances and a light-responsive resistor controlling the aperture of its built-in iris.
Mechanical servos then position an appropriately-powered, vision-enhancing monocle — and it’s all controlled by an Arduino, an open source electronic prototyping platform. The OLED screen provides a miniature display of its data (encased in a prism).
Cranch called it one of his “mad Arduino steampunk projects.” And it’s not his only crazy scheme. He told me he’s now planning a mechanically-powered sundial — and a gentleman’s hat with a built-in cuckoo clock.
But the teeny-tiny screen seemed to call out with its own implicit challenge.
Could he turn it into a tiny video-game cabinet?
A Flash of Inspiration
Cranch started by grabbing a tiny Arduino Pro Micro board to power SSD1306 OLED screen.
Arduino enthusiasts traditionally turn to two popular libraries for graphics-displaying drivers — but unfortunately, Cranch discovered that both the Adafruit GFX and U8Glib libraries were way too slow, and gobbled up too much of the available memory. At this point he described the experiment as “a total failure,” according to his video, and moved on to the rest of his life.
But he was later able to revive the project later with an ingenious hack. Cranch realized there’s a simpler library just for displaying letters (rather than graphics) called SDD1306_text. And he discovered its performance was “much faster and used less system resources,” he told me — though it ultimately still wasn’t fast enough.
But using it as a kind of framework, Cranch realized in a flash of inspiration that he could treat all of the game’s symbols as a kind of letter. “All of the glyphs (including the aliens, base, etc.) in this game are 5 pixels high, so I stripped the library down to only the essentials and hardcoded it to deal with 5 pixel high characters.”
Or, as he put it in a later email, “It is an ASCII library, but you don’t have to make an ‘A’ look like an ‘A.'”
He also modified the graphics driver so it was only performing an update on the parts of the game that have changed position. (“At the end of every iteration of the main program loop … the altered region is sent to the screen,” Cranch said in a comment on the project site Hackaday.)
But alas, even it was still too slow — until he then discovered a second workaround. The driver would accept a different clock rate, a speedier 800KHz rather than its default 100KHz.
At this point, Cranch was down to just 512 bytes of memory to work with — for implementing the entire game of Space Invaders. But like any good do-it-yourself programmer, he simply hacked up the appropriate code, and fit it into the space available to him.
“The game code is completely my own,” Cranch told me. “I found videos of the original game and just coded it.”
To finish things off, Cranch crafted his own tiny cabinet using hand-cut 1.5-mm plywood. (The “Fire” button and joystick are controlled with microswitches “scavenged from an old mouse,” Cranch explained in the video.) He enclosed the screen with an old CD case, covered with appropriately-sized graphics that he’d printed out on a color laser printer and then pasted into place.
In between games, it even displays the original 1978 animations when awaiting the next quarter, including a display with the initials of its highest scorers.
Reactions are surprisingly mild when he describes it in print or shares a photo. But seeing the tiny cabinet in real life — and then being invited to play it — brings a reaction he describes fondly as “childlike excitement: That is why I created the video.”
The remarkable video includes footage of the game being played — capturing the sound of its teeny-tiny beeps. “Excuse my fingers in the way,” Cranch says at one point, “but it really is that small.”
Seeing that final labor of love, I had to ask Cranch, was there some special fondness that drove him to Space Invaders, out of all the classic video games of yesteryear?
When the original Space Invaders was released in 1978, he’d been just 12 years old, he recalled: “I used to go to the amusement arcades, but was always very careful with the limited £2.80 per week I earned as a paperboy.”
His mother, he said, was “also quite strict about ‘wasting money on stupid video games.'”
Space Invaders didn’t enter Cranch’s life until his school purchased a couple of Commodore PETs, which they were allowed to play with on rainy days — and which he remembers had had only one game installed: Space Invaders. And even then, he said, “being small, quiet and not part of the ‘in-crowd,’ I never got the opportunity to play.”
Now he’s got one of his very own machines — though Cranch insists he’s not driven by bitter nostalgia. (In 1984 his family had purchased a second-hand Sinclair home computer, the ZX81, which “came with a whole bunch of games,” Cranch pointed out in his email. “But, I soon discovered that I preferred programming to playing.”)
Instead, he recalled that Space Invaders “was such a classic. An iconic game that wowed people and pushed the boundaries of 1970s hardware.” So when it came to a side project, he saw it as the perfect choice — “complex for the era, but within the realms of possibility for the Arduino.”
He’s been touched by the widespread appreciative reaction that his project has received from his new fans online. “It’s quite humbling to have such interest in what was essentially a Sunday afternoon distraction.”