Updated

Pocket Rally

A two-player pixel racer for two pocket-sized ESP32 touch screens, linked straight to each other by radio.

Status: Version 0.6. Both boards are flashed and boot with touch and radio initialised, but pairing and a full race between the two boards have not been tested yet.

Pocket Rally: the browser preview mid-race, with the blue and coral players' screens side by side, each glider colouring its own stretch of a sand-yellow ribbon, and a minimap in the corner

What it is

An abstract top-down racer for two Guition JC2432W328C boards: an ESP32 with a 240×320 capacitive touch screen. Both boards run the same firmware. One hosts, the other joins, and they pair over ESP-NOW, with no router, Wi-Fi password or MAC addresses to type in. Each screen has its own camera that rotates around its player.

A lap is not a finish line. Glide over all 192 sections of the ribbon to colour them, in any order or direction, and the lap completes at 100%. Three laps win. Turbo gives a two-second burst with a five-second recharge, and magenta chevrons raise your top speed by 12% each, up to three. Practice runs against a bot that makes mistakes, drives off the ribbon, and turns back for the sections it missed.

How it works

  • The firmware is C++17 on the Arduino framework, built with PlatformIO, drawing to the ST7789 display through LovyanGFX and reading the CST820 touch controller.
  • Slide a finger anywhere to steer in proportion to how far it is from the centre; the strip along the top is the turbo button. Acceleration is automatic.
  • The boards exchange inputs and coverage over a versioned protocol that rejects duplicate, lost, reordered, stale and out-of-range messages. The onboard RGB LED shows the link: solid green when paired, blinking red while searching.
  • A browser preview ports the physics and the rotating-camera renderer to JavaScript, using sprites, font and track geometry exported from the firmware itself. Race a bot, play two players on one keyboard, or watch two bots race.
  • Portable C++ tests cover coverage, laps, turbo, upgrades, the camera and the link protocol. The game uses 32% of the ESP32's RAM and 64% of its app flash.

Built with

  • C++
  • ESP32
  • ESP-NOW
  • LovyanGFX
  • PlatformIO
  • JavaScript

Started