Build your own 8BitG
The games are ordinary Python. You can run them on a laptop in a minute, or build the handheld. Pick the route that suits you.
Laptop or desktop
needs only pygame
Run the same files in a window with your keyboard.
The handheld
reference build
Raspberry Pi Zero W with a Waveshare GamePi13 board.
The reference build (what the code was developed on)
| Part | Notes |
|---|---|
| Raspberry Pi Zero W (with header) | It needs the 40-pin header fitted so the board plugs in. A pre-soldered "WH" model avoids soldering. The Zero 2 W should work too and be quicker, but it has not been tested. |
| Waveshare GamePi13 | 1.3 inch IPS LCD, 240x240, ST7789 controller over SPI, 12 game buttons, speaker and audio jack. Sold as the board alone or with a case kit. A Pi is not included. |
| microSD card | Raspberry Pi OS Lite is enough. |
| Power | 5 V through the Pi's micro-USB port. The GamePi13 page does not list a battery, so check the board's own page if you want it portable and plan a battery pack. |
The games draw on a 120x120 canvas which is doubled to fill the 240x240 screen.
Setting up the Pi
- Flash Raspberry Pi OS Lite, enable SSH and Wi-Fi in the imager, and boot the Pi with the GamePi13 fitted.
- Enable the SPI interface:
sudo raspi-config, Interface Options, SPI. - Install the libraries the Pi needs:
pygame,numpy,spidevandgpiozero. The install script expects a Python virtual environment at~/8bit-venv. - Copy the game folder to the Pi, for example
scp -r 8bit pi@raspberrypi.local:~/ - Try it by hand:
cd ~/8bit && ~/8bit-venv/bin/python main.py --pi - Start on boot:
sudo bash install_service.sh(remove with--remove). Restart later withsudo systemctl restart gamepi.
Button wiring (GamePi13, BCM numbers)
| Button | GPIO | Button | GPIO |
|---|---|---|---|
| D-pad up | 5 | X | 15 |
| D-pad down | 6 | B | 20 |
| D-pad left | 16 | Y | 12 |
| D-pad right | 13 | A | 21 |
| L | 23 | Start | 26 |
| R | 14 | Select | 19 |
Buttons connect the pin to ground when pressed (the code turns on the Pi's internal pull-ups). The LCD uses SPI0 chip-select CE0 (GPIO 8), data/command on GPIO 25 and reset on GPIO 27. These are the values at the top of hardware.py.
Other hardware the code can run on
The code keeps hardware in one file, hardware.py, with a small "input" part and a "display" part. That makes other setups possible, but only the first three below have actually been run. The rest are my reading of the code and of each maker's product page, so treat them as starting points.
| Setup | Status | What it takes |
|---|---|---|
| Laptop / desktop (Linux, Windows, macOS) | works | Python 3 and pygame. Run python3 main.py. A 480x480 window opens. Keys: arrows or WASD to move, J K U I for A B X Y, Z and X for L and R, Enter for Start, Backspace for Select. |
| Web browser (this site) | works | Nothing. The same files run under Pyodide, with touch buttons for phones. |
| Pi Zero W + GamePi13 | works | The reference build above. |
| Pi Zero 2 W + GamePi13 | expected | Same board and pins; Waveshare's page shows this combination. Untested here, but the code is unchanged. |
| Any Pi on a monitor or TV | likely | On a Pi desktop, python3 main.py runs in a window with a USB keyboard. A USB gamepad would need mapping to those keys with a tool such as a gamepad-to-keyboard mapper, as the games read the keyboard only. The --fb option is meant for Waveshare's own system image, where the screen is copied to the LCD. |
| Other 240x240 ST7789 screens (Adafruit 1.3 inch breakout and similar) | DIY | The display driver is plain SPI and should suit any 240x240 ST7789. Wire it to SPI0, then set LCD_DC, LCD_RST and the BUTTON_PINS table to your pins. The driver does not switch a backlight pin, so tie the backlight to 3.3 V. If the picture is rotated or the colours are swapped, change ROTATION or BGR in St7789Display. |
| Fully home-built | DIY | A Pi, an ST7789 240x240 screen and 12 push buttons wired from GPIO pins to ground. Fewer buttons works for most games; Start, Select and the D-pad are needed to use the menu. |
| Pimoroni Display HAT Mini | poor fit | It is 320x240 with only 4 buttons, and the games need a D-pad. You would have to change the screen size in the driver and add buttons, so a different board is easier. |
| Waveshare GamePi15 / GamePi20 | unknown | Older Waveshare handhelds (GamePi15 is listed as discontinued). They may run through their own screen-copy system, which the --fb mode was written for, but this is untried. |
| Pico / RP2040 / microcontrollers | no | The games need full Python and pygame, which these boards do not run. |
Performance notes
- Games run at 30 frames per second. A Zero W copes by sending only the parts of the screen that changed.
- If you see sparkles or noise on the LCD, lower
SPI_HZinSt7789Displayfrom 62,500,000 to 40,000,000 or 24,000,000. - Audio is not started, which saves CPU on the Zero.
Sources
Waveshare GamePi13 · Waveshare GamePi15 · Pimoroni Display HAT Mini. Specs and stock change, so check the maker's page before you buy.