DIY Arcade Machine

May 31, 2026 · View on GitHub

Python MicroPython PyGame Deploy to GitHub Pages

Short video of the DIY Arcade Console in action (on YouTube)

A complete mini arcade system that runs on hardware, desktop, and in the browser: play a collection of classic-inspired games on a 64×64 RGB LED matrix (HUB75 + MicroPython), on your computer with a PyGame emulator, or directly in the browser via WebAssembly (pygbag).

Features

  • Triple Runtime Support
    • MicroPython + HUB75 LED Matrix: Runs on RP2040-based boards (Interstate 75)
    • Desktop (CPython) + PyGame: Full emulator for development and testing
    • Browser (WebAssembly) + pygbag: Play directly in any modern browser, no install needed
  • 40+ Built-in Games: Classics, puzzle games, racers, shooters, reflex challenges, and compact original arcade games built for the 64×64 matrix
  • Intro Screen: Animated logo display on startup
  • 64×64 Display Layout
    • 58-pixel playfield (rows 0-57)
    • 6-pixel HUD at bottom (score + clock)
  • High Score System: Persistent scores with 3-letter initials entry
  • Memory-Optimized: Buffered framebuffer, packed grid storage, lazy font loading
  • Controller Support
    • MicroPython: Wii Nunchuk-style I2C controller (with auto-detection for variants)
    • Desktop: Keyboard emulation (arrow keys + Z/X)

Table of Contents


Quick Start

Run on desktop

pip install pygame-ce        # or: make install
python main.py               # or: make run

Test in browser locally

pip install pygame-ce pygbag==0.9.2   # or: make web-install
python -m pygbag .                    # build + serve at http://localhost:8000
# Safari: make web-safari (adds required COOP+COEP headers)

Deploy to GitHub Pages

Push to main — the GitHub Actions workflow builds the WebAssembly bundle with python -m pygbag --build . (Python 3.11) and deploys it to GitHub Pages automatically.


Web build (Pygbag)

Local preview (build + serve at http://localhost:8000):

pip install pygame-ce pygbag==0.9.2
python -m pygbag .

CI / offline bundle (writes to build/web/):

python -m pygbag --build .

GitHub Pages: in your repo go to Settings → Pages → Source and select GitHub Actions. Every push to main triggers the workflow which builds and deploys automatically.


Hardware Requirements

For Physical Arcade Machine


Software Requirements

MicroPython Hardware

  • MicroPython Firmware (Pimoroni build recommended)
  • Optional: Thonny IDE for uploading files
  • Optional: mpy-cross for compiling to bytecode (reduces boot RAM usage)

Desktop

  • Python 3.7+
  • pygame-ce 2.x (Community Edition — drop-in replacement for pygame)

Installation

Desktop Setup

  1. Install dependencies:

    pip install pygame-ce
    
  2. Run the game:

    make run
    # or manually: python main.py
    

A 640×640 window will appear showing the emulated LED matrix (10× scale).

Browser Setup (pygbag)

pygbag packages the game as WebAssembly so it runs in any modern browser — no Python installation needed.

  1. Install dependencies:

    pip install pygame-ce pygbag==0.9.2
    # or via make: make web-install
    
  2. Build and serve locally:

    python -m pygbag .    # build + serve at http://localhost:8000
    make web              # same, via Makefile (Chrome / Firefox)
    make web-safari       # Safari (adds required COOP+COEP headers)
    
  3. Controls in browser: same keyboard mapping as desktop — Arrow Keys, Z/Space to confirm, X/Escape to cancel.

Browser support: Chrome and Firefox work out of the box. Safari requires Cross-Origin-Isolation headers (make web-safari handles this automatically).

Automated deployment: every push to main triggers the GitHub Actions workflow which builds with python -m pygbag --build . (Python 3.11) and deploys the result to GitHub Pages automatically.

Note: High scores are stored in-memory while the page is open and reset on page reload.

MicroPython Setup

The project now uses a tiny bootstrap approach to avoid on-device compilation memory errors:

  1. Install mpy-cross (optional but highly recommended):

    brew install micropython  # macOS
    # or: pip install mpy-cross
    
  2. Connect your Interstate 75 via USB

  3. Upload with Make:

    make upload
    # or manually: ./upload.sh
    

    The script will:

    • Auto-detect connected devices
    • Compile arcade_app.pyarcade_app.mpy (if mpy-cross available)
    • Upload both main.py (tiny bootstrap) and the compiled module
  4. Reboot the device - games start automatically

Manual Method

If you prefer manual upload via Thonny or ampy:

  1. Flash MicroPython firmware to Interstate 75
  2. Upload main.py (tiny bootstrap file)
  3. Upload arcade_app.py or arcade_app.mpy (the main application)
  4. Optional: Upload highscores.json if you want to preserve scores

Make Commands

For ease of use, a Makefile is provided with the following commands:

  • make install: Installs desktop dependencies (PyGame)
  • make run: Runs the PyGame emulator locally (python main.py)
  • make web-install: Installs pygbag for browser/WebAssembly builds
  • make web: Builds the WebAssembly version and serves it at http://localhost:8000
  • make upload: Compiles and uploads the code to the hardware (./upload.sh)
  • make build: Precompiles arcade_app.py into bytecode (arcade_app.mpy)
  • make clean: Cleans up previous build artifacts and pycache
  • make clean-all: Cleans up all files and the python virtual environment

Game List

The arcade includes demo animations and over 30 games. Each game is documented in detail in the Game Documentation with gameplay notes and technical descriptions.

Detailed per-game documentation is available in docs/games.

Game IDNameDescription
DEMOSDemo ShowcaseZero-player demos: Snake, Life, Cube, Spark, Plasma, Orbit, Warp, Bounce, Tunnel, Matrix, Fire
20482048Sliding tile puzzle with merge scoring
ARENAArenaTop-down wave survival with movement and shooting
ARTILLArtillery SimulatorTurn-based angle-and-power shell duel with wind and deforming terrain
ASTRDAsteroidsRotate, thrust, shoot asteroids in space
BEJWLBejeweledMatch-3 gem swapping puzzle
BOMBERBomberTimed bombs, block clearing, and maze enemies
BRKOUTBreakoutBrick breaker with rainbow bricks and optional powerups
BTLZONBattlezoneAtari-style vector tank combat with radar, rocks, projectile shots, and waves
CATCHCatchCatch stars, avoid bombs, and keep the basket moving
CAVEFLCave FlyerTunnel navigation (starts wide, narrows progressively)
CENTICentipedeAtari-style segmented shooter with mushrooms and waves
CGOLGConway's Game of Life GameCompetitive Life battle with directed gliders and spaceships
CLIMBClimberPlatform-jumping tower climb with scrolling height
DEFUSEDefuseCut colored wires in sequence before the timer expires
DODGEDodgeAvoid falling blocks, dash to dodge
DOOMLTDoom LiteMini raycaster FPS with rotating levels and enemy sprites; also powers the WINMAZE demo renderer
FLAPPYFlappy BirdNavigate through moving pipe gaps
FROGGRFroggerHop across traffic lanes and advance through harder levels
GOLFGolfTiny minigolf courses with aim, power, bounces, and obstacles
INVADRInvadersShoot marching alien waves, protect shields, hit saucers
KEENKeenPlatformer with jumps, gems, keys, enemies, and exit doors
LANDERLunar LanderMulti-level landing challenge plus optional scrolling v2 route mode with fuel powerups
LASERLaserMirror-rotation puzzle: guide the beam into the target
LOCOLocoMotionRotating railway puzzle with train routing
MAZEMaze ExplorerFog-of-war maze with gems, enemies, shooting
MINESMinesMinesweeper-style reveal puzzle for the LED matrix
PACMANPac-ManCollect pellets, avoid ghosts, power pellets
PAIRSPairsMemory card matching on a 4x4 board
PINBALPinballPlunger launch, flippers, bumpers, targets, and multipliers
PITFALPitfall RunnerEndless runner with snakes, pits, treasures (safe start zone)
PONGPongPaddle vs. AI or optional 2-player paddle duel
QIXQixTerritory capture, avoid the enemy
RAYRCRRay RacerRaytrace-style anti-grav racing with boost, energy gates, and rival hovercars
REVRSOthello/ReversiBoard game with simple CPU opponent
RTYPER-Type ShooterSide-scrolling endless shooter
SABOTRSaboteur StealthSneak through multiple patrol maps and reach the objective
SIMONSimon SaysMemory sequence game with colored quadrants
SKYWARSky WarHelicopter battlefield shooter with air and ground targets
SNAKESnakeClassic snake with red/green targets, wraparound
SOCCERChampionship SoccerAtari-style soccer with direction-based passes and shots
SOKOSokobanMulti-level crate-pushing puzzle campaign
STACKStackerTiming game: trim and stack moving blocks
TETRISTetrisFalling blocks with line clearing
TRONTron LightcycleLeave a trail, steer 90° turns, dodge CPU or optional second player
TWRDEFTower DefenseBuild towers across rotating road and open-field layouts
UFODEFUFO DefenseMissile Command-style defense with turret/base and wave/time settings
WINGSWingsCarrier strike game with fuel, ammo, targets, and landing

Each game tracks high scores with optional initials entry.


Controls

Common Controls

Menu Navigation:

  • Up/Down: Navigate menu
  • Z (or Space/Enter): Start/Confirm
  • C (or X/Escape): Open game options when available; otherwise Back/Cancel

In-Game:

  • Directional movement: Arrow keys / Joystick
  • Primary action (jump/shoot/rotate): Z button / Space / Enter
  • Secondary/Back: C button / X / Escape

Desktop Keyboard Mapping

ActionKeys
MoveArrow Keys
Confirm/ActionZ, Space, or Enter
Back/CancelX or Escape
Player 1 Move in 2PW, A, S, D
Player 1 Action in 2PShift where used
Player 2 Move in 2PArrow Keys
Player 2 Action in 2PZ, Space, or Enter where used

Game Settings Highlights

  • PONG: PLAYR switches between 1P and 2P.
  • TRON: PLAYR switches between CPU opponent and 2P.
  • LANDER: MODE switches between classic V1 and scrolling V2 with route pads and fuel pickups.

MicroPython Controller

  • I2C Address: 0x52 (standard Nunchuk)
  • Pins: SCL=21, SDA=20 (configurable in code)
  • Buttons:
    • C button: Back/Cancel
    • Z button: Confirm/Action
  • Analog stick: 8-directional movement (includes diagonals)

The code auto-detects controller variants including the "new signature" controllers (A0 20 10 00 FF FF).