There are a few Space Invader games available for Arduino. I got motivated to try and improve on the current ones. I wanted to use a larger screen so I decided to use a 2.7 Inch OLED. I increased the number of Rows and Columns to match the Original Taito Space Invaders. I have added a FPS display so you can see what it's running at.
I decided to use the Nano Every as I needed the Extra Ram for the extra aliens on the screen. It's also nice to have the increased Clock speed on the Nano Every. It has a 20 Mhz clock. I did have to go back to the Standard Tone.h library as ToneAC.h does not support the Nano Every yet.
I used Vero Board to assemble the project. I have included a Schematic which can be used to assemble one.
EXPANDED TECHNICAL DETAILS
Retrogaming on a Microcontroller
Nano_Vaders is a clone of the classic Space Invaders game, running entirely on an Arduino Nano.
- Graphics Engine: Uses a tiny 128x64 I2C OLED display. The game logic handles sprite rendering, collision detection, and screen refresh rates using the
Adafruit_SSD1306library. - Input System: Three pushbuttons (Left, Right, Fire) are managed using interrupts or debounced digital reads to ensure responsive gameplay.
Optimization Logic
To fit a full game into the 32KB of the Nano:
- Sprite Mapping: Graphics are stored as bitmaps in PROGMEM (program memory) rather than RAM.
- Variable Scaling: The game uses fixed-point math instead of floating-point to maintain a high frame rate (30+ FPS) on the 8-bit AVR processor.