8-bit Space Shooter on ESP8266 & LED Matrix - DIY Arduino Gaming

by mircemk in Circuits > Arduino

66 Views, 0 Favorites, 0 Comments

8-bit Space Shooter on ESP8266 & LED Matrix - DIY Arduino Gaming

APH2.jpg

A retro-style space shooting game built using an ESP8266 microcontroller and a 32x8 WS2812B LED matrix display.


Supplies

Parts.jpg
  1. NodeMCU ESP8266 Breakout Board
  2. 8x32 matrix with WS2812B Leds.
  3. Pushbutton x 3
  4. Buzzer
  5. Resistor 10k ohm x 3

Description

arcade games.jpg
8 bit Space Shooter on ESP8266 & LED Matrix DIY Arduino Gaming

Arcade games are fast-paced, simple-to-play video games and Goal is usually to get the highest score, not complete a story. In this type of games you’re always doing something (shooting, jumping, etc.), often usingjust a joystick with 1–3 buttons.

From one of my projects I have an 8x32 Led Matrix with WS2812B leds so I decided to make a simple horizontal shooting game on it, somewhat in the style of the popular Space Invaders. On one side, spaceships constantly appear randomly and move towards us, and the goal is to destroy as many enemy ships as possible before they destroy us.


Parts

PCBWay kvadrat.jpg

This project is sponsored by PCBWay. They has all the services you need to create your project at the best price, whether is a scool project, or complex professional project. On PCBWay you can share your experiences, or get inspiration for your next project. They also provide completed Surface mount SMT PCB assemblY service at a best price, and ISO9001 quality control.

The game is extremely simple to make and consists of only a few components:

- ESP8266 microcontroller board

- 8x32 Led Matrix with WS2812B leds

- 3 Buttons

- and Buzzer

I simplified the device's construction as much as possible, the matrix was first glued to the substrate, and then I placed frosted glass in front of it for a better visual effect with some light diffusion. Then I made a simple two-dimensional joystick that contains three colorful buttons with built-in LEDs, but standard buttons can also be used.


Gameplay

Press Fire.jpg
Gameplay.jpg
Game Over.jpg
Score.jpg

First, let me explain how the game works. When you turn on the display, a scrolling text appears with the content "Press Fire to Start".

Now if we press the FIRE button, by generating characteristic sound the game starts.

Our weapon is located on the left side of the display and is green. With each press of the up or down buttons, the weapon moves one space. On the other side, on the far right, enemy ships marked in red appear randomly, with a magenta missile on their tip. If we destroy the enemy, the missile remains until the end and we must avoid it so that it does not destroy us.

At the bottom right of the display, as many green dots appear as we have destroyed enemy ships. If an enemy ship hits our weapon, the game ends and the Game Over message appears on the display with appropriate sounds.

If we press the Fire button, a Score appears where for each destroyed enemy ship we get 10 points. By pressing the Fire button again, we return to the beginning and pressing the Fire button again starts a new game.

The destruction of an enemy object is accompanied by a simple animation, and otherwise the entire game is accompanied by appropriate sounds. Honestly, I spent more time introducing these simple sounds than I did for the entire development before, because the sound generation caused more problems in terms of the graphic part of the game. Even at the expense of the sound, some glitches remained in the game.

Code Settings

Code.jpg

As for the code, it should be noted that it is not as simple as I initially imagined, but it is highly customizable and at the beginning of the code we can change many parameters, of which the most important for the gameplay are: PLAYER_SPEED, MISSILE_SPEED, ENEMY_SPEED and ENEMY_FIRE_RATE. Regarding the installation of the code, I used Arduino IDE v 1.8.16, and ESP8266 Core v 3.1.2.


Conclusion, Schematic,and Code

Schematic.jpg

And finally a short conclusion. This is a retro-style space shooting game built using an ESP8266 microcontroller and a 32x8 WS2812B LED matrix display, controlled by three push buttons for up/down movement and firing, with a buzzer for sound effects, and programmed using the Arduino IDE with the FastLED library.