Fork me on GitHub

Project Notes

#100 ArdWinVaders

An Arduino & OLED version of a classic game.

Here’s a quick video of the game in action:

ArdWinVaders

Or see this earlier video before the screen optimisations or sound. There’s a huge performance difference!

Notes

Since playing around with driving an OLED with an Arduino (see the SSD1306BareBack project for example), it doesn’t take long for the mind to wander into gaming territory…

So here’s the first version of a retro classic: Space Invaders in full 128x64 mono resolution running on an Arduino Pro Mini at 8MHz!

For details and discussion of the hardware setup, see the SSD1306BareBack project. This build is mainly about the software.

The software is organised into a number of classes. You can see the code for more details, but here is the overview:

  • ArdWinVaders.ino - main program, also handles all the controls input (fire, movement)
  • game_board.h/cpp - implements the main game controller class, responsible for orchestrating actions and sequencing gameplay
  • buffered_display.h/cpp - implements a logical display interface that GameBoard talks to. It maintains the screen buffer and handles movement, collision detection and so on.
  • oled_driver.h/cpp - implements the OLED-specific display driver. It goes direct to the hardware via SPI.
  • sound_system.h/cpp - music and sound effects support.

Game performance/screen refresh is pretty awesome even with the processor at 8Mhz. The big improvement came from switching to direct port manipulation for SPI rather than using the standard library methods (digitalWrite, shiftOut).

TODO

  • put it in a hand-held form-factor

Construction

The Breadboard

The Schematic

The Build

Credits and References

About LEAP#100 ArduinoOLED
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.