← All projects

Arduino game · C++

Arduino Parkour

A dodge-the-walls game on a 16×2 character LCD. Walls scroll toward you; steer through the gap with a joystick. It gets faster and meaner the longer you last.

AIArduinoC++
View on GitHub

How it started

A video game on a screen that only shows text

I was challenged to make a video game using nothing but a 16×2 LCD, the kind of screen that shows two rows of 16 text characters. No graphics, just character cells.

The trick I came up with: the LCD's controller lets you design up to 8 custom characters of 5×8 dots, and the game uses all 8. Each one is a different combination of three things: an upper wall, a lower wall, and the ball. Three things that are each on or off make 2³ = 8 combinations, which exactly fills the 8 slots.

So every character cell can show two walls and a ball at once. That doubles the vertical resolution: two text rows become four lines of walls, and every frame is just picking the right one of the 8 characters for each of the 32 cells.

0empty
1lower wall
2upper wall
3upper wall + lower wall
4ball
5lower wall + ball
6upper wall + ball
7upper wall + lower wall + ball
The 8 custom characters, drawn from the bitmaps in parkour_game.ino. The top row of the screen only ever uses 0–3; the ball lives on the bottom row.

Try it

Play it right here

Score 0

A faithful port of the game logic from parkour_game.ino: same timings, ramp and collision rules. Arrow keys or the buttons take over from the demo.

Features

How it plays

Under the hood

More under the hood

One clock, two speeds. A single timer runs at player speed, and the walls move on every 5th tick, so you always move 5× faster than the walls, even as everything speeds up.

Fair collisions. A wall line is only checked at the moment it scrolls off the bottom of the screen, not while you can still see it. You get until the very last moment to slip through.

Hardware

Wiring

PartArduino pin
LCD RSD12
LCD ED11
LCD D4D5
LCD D5D4
LCD D6D3
LCD D7D2
Joystick XA1
Joystick YA2 (only used as extra randomness)
Joystick buttonD7 (INPUT_PULLUP)

An Arduino Uno (or compatible), a 16×2 HD44780 LCD wired in 4-bit mode, and an analog joystick module. That's it.

Open parkour_game/parkour_game.ino in the Arduino IDE (it uses the built-in LiquidCrystal library) and upload.

Photos

The real thing

Screenshots coming soon.

The full source code for Arduino Parkour is on GitHub.

View on GitHub

This site was created with the assistance of AI