Cave Runner (AVR Embedded Game)
Real-time obstacle-dodging game in C for an ATmega32U2, rendered on a 5×7 LED matrix with TinyGL score UI
Engineering
CAVR (ATmega32U2)LED Matrix (5×7)NavswitchTinyGLMakefiledfu-programmer
Gameplay clip recorded from browser recreation of the game. (poster shown before playback).
Gameplay
You run through a cave and must react to incoming hazards. Each obstacle type requires a specific action (or set of actions) to avoid a collision. If you collide, the game ends and your score flashes indefinitely.
Obstacle rules (collision logic)
- Stalactite: must crouch
- Rock: must jump or double-jump
- Bat: must crouch or double-jump
- Boulder: must double-jump
- Tunnel: must jump
Controls
- Crouch: navswitch down (landscape)
- Jump: navswitch up (landscape)
- Double-jump: navswitch press
- Pause: navswitch left (landscape)
- Resume: navswitch right (landscape)
Technical highlights
- Deterministic real-time loop: fixed 500 Hz pacer rate for predictable input polling and refresh.
- LED matrix rendering: runner + obstacles stored as compact bitmasks and composed per-column.
- Efficient scrolling: obstacle motion implemented via a left bit-shift on a timing divider.
- Commitment window: input locked for a fixed duration after actions to prevent spam and stabilize feel.
- Difficulty ramp: decreasing movement divider increases required reaction speed.
- Score UI via TinyGL: score increments once per second; displayed on pause and game-over.
Build & flash
Built with avr-gcc and flashed via dfu-programmer to an ATmega32U2.
make
make program Play it in your browser
Faithful 5×7 recreation (smooth-rendered).