Today, I’d like to share about another of my projects. A space invaders arcade game!
It was done as part of UT.6.01x Introduction Embedded Systems, which teaches the basics of micro-controllers such as how to interface external components, how to read analog inputs like switches & produce analog outputs like sound, how to use timers & interrupts, etc.
This MOOC culminated in an optional final project where we were required to build a 80’s styled arcade game. I decided to go with the teachers’ recommendation of Space Invaders and it resulted in the game below.
There is a short 1 minute demo embedded above to demonstrate basic game-play. The player simply controls the ship & shoots 3×2 enemy hordes which gets faster & shoot more often with each new wave. The best thing is the levels never end & there is theoretically unlimited game-play.
However, the feature I am most proud of & put most effort into is making the code easily editable. I’ve used several
#define which allow several parameters to be changed easily, ranging from graphical options, like the dimension of the enemy hordes & vertical layout of the battlefield, to game-play options, such as the number of bunkers and UFO spawn rate. Even the learning curve of the game is purposely encoded in 2 explicitly labelled recursive mathematical formulaes, and this can be completely changed if desired.
Here is a picture of the physical circuit which I built. It’s a simple circuit really. The micro-controller is on the right, a 4-bit DAC at the top & a swtich and potentiometer near the bottom. Do note that I don’t have a physical screen & instead used a virtual one.
If you’d like to tinker with the code, it is already up on my GitHub.
If you’d like to build the physical system yourself, here is a parts list:
- Texas Instruments TIVA launchpad (STELLARIS might work too)
- Nokia5110 LCD Screen (or the VirtualScreen which can be found in my GitHub)
- 4 resistors of n, 2n, 4n, 8n (for a 4-bit sound DAC)
- 1 audiojack (unless you don’t want sound)
- 1 potentiometer (for movement)
- 1 switch (fire button)