Back to timeline
hobby Feb 2022

A game that draws itself in ASCII

A C++ game made during a folkehøyskole game-jam, with a CUDA-accelerated ASCII shader sitting between the renderer and the screen. The shader picked the best glyph for every pixel patch in real time, and the same kernel could read your webcam and turn your face into typography.

The idea

A "code zone" inside the game switched the renderer into ASCII mode. Not the usual brightness-bucket trick, but a per-patch best-match against a small glyph atlas, running on the GPU so it stayed at frame-rate.

How the shader works

The trick was making this cheap enough to run per-frame. CUDA, per-block scoring, and a small atlas got it well under a millisecond at 1080p.

Webcam mode

The kernel is content-agnostic, so feeding it a webcam frame instead of the framebuffer just works. Live ASCII selfie:

Live ASCII webcam, running on the same kernel.

What I'd revisit

The matching is purely structural. It doesn't know that O and 0 look almost the same. Adding a small perceptual term, or running the score against an edge map, would clean up the typography. And the atlas was monospace-only; with a proportional font and a smarter packer there's more visual variety to be had.

Back to timeline