The ESP32 Goes 3D: Retro Racing on a Chip

Who needs a beefy PC or GPU when you can squeeze a full 3D arcade racer onto a tiny ESP32?

Nick Bild
5 hours agoGaming
This 3D racing game runs on an ESP32 (📷: David Montero Crespo)

Everybody knows microcontrollers are far more powerful than they used to be. For under a dollar, you can now do a whole lot more than log data or flash an LED. But just how far can you push these little chips? David Montero Crespo wanted to find out, so he decided to build a video game that runs entirely on an ESP32-S3 microcontroller with 8MB of PSRAM.

And we’re not talking about a game of Snake — Crespo developed a complete 3D racing game. That is one of the last things one would expect to work well on a resource-constrained system. 3D racing games require heavy processing to generate the graphics, and this has to happen fast. If the frame rate is too slow, this style of game is about as fun as watching paint dry.

The hardware itself is very modest: a dual-core ESP32-S3 clocked at 240 MHz and a 320×240 pixel ILI9341 SPI TFT display using 16-bit RGB565 color. By modern PC or console standards, this is right next to nothing. Yet Crespo’s game delivers an unmistakably classic arcade feel, strongly reminiscent of Sega’s OutRun.

To make that possible, he leaned on some clever graphics tricks rather than brute force. The road uses a segment-based pseudo-3D renderer drawn back-to-front, a technique popular in late-1980s arcade machines. Hills, curves, and roadside scenery are procedurally generated at startup, so the game world doesn’t rely on large stored maps. Atmospheric fog increases toward the horizon, helping hide draw distance limitations while also adding realism.

The player’s car is fully 3D. The vehicle is an imported OBJ mesh with hundreds of vertices and triangles, textured using scanline affine mapping — again a deliberate compromise between visual quality and performance. Six computer-controlled traffic cars independently change lanes and speeds, and the physics model simulates acceleration, friction, gravity on hills, and centrifugal drift through curves. Crashes trigger a short recovery delay, just like a real arcade racer.

The game also includes a day-to-night lighting cycle, tunnels, buildings, lamp posts, and a circular speedometer HUD showing speeds up to 300 km/h. The entire frame is drawn into a double buffer stored in external PSRAM before being pushed to the display, preventing visible tearing despite the SPI connection’s limited throughput.

The project has been made publicly available on GitHub, so get busy downloading it if you feel the need for speed.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles