Arduino BITNINJA 09/09/2018
This game is a small platform game, like Super Mario Bros, designed by me. After my nomination in the IOCCC 2014 Contest, i have ported some of the logic of the SMB Engine that i have developed for the Contest.
BITNINJA implements these features:
- input controller LEFT+RIGHT+JUMP with three buttons
- cutscene for splash screen, credits, introduction and epilogue
- background music for cutscene
- 5 playable levels
- collision detections
- 6 max enemies in each level
Becouse VGAX uses 1800 bytes of RAM and the Arduino UNO ATMEGA328 MCU has only 2048 bytes of RAM, the game is optimized to use only 41 bytes of global RAM. All the images, sprites, songs and level definitions are stored in the MCU FLASH ROM. Doing the math: 2048-1800-41=207 bytes are "free", used for the MCU STACK where local variables and parameters are stored.
The 41 bytes required for BITNINJA to run are subdivided like this:
- 11 bytes for player movement and game cutscene
- 24 bytes for 6 enemies (4 byte for each enemy)
- 6 bytes for music
The hardware required is pretty cheap:
- a DSUB15 male connector (VGA)
- 2 68ohm resistors
- 2 470ohm resistors
- 2 22pf capacitors
- 1 16Mhz oscillator
- 3 passive buttons
- 1 audio buzzer
- 1 microusb female connector
The wiring and soldering is documented inside VGAX library documentation, except for the wiring of the standalone ATMEGA328 MCU but you can easily find online How to run ATMEGA328 standalone.
Here you can see a video of BITNINJA testing running on the Arduino UNO, before the standalone board creation. The level you see in the video is a test. The 5 levels inside the final version are different than the one in the video.
This is the final board, with a piece of plexi on the bottom:
I am planning to take a video of all 5 levels, running on the final standalone board. When i will do the video i will post it here!