TTF-DOOM: A raycaster running in TrueType font hinting
Implements a 3D raycasting engine entirely within TrueType font bytecode. Uses a custom DSL and compiler to bypass the arcane constraints of the 1991 Apple hinting VM.
liveTTF-DOOM
TTF-DOOM is a masterful exercise in technical masochism. While most 'code in a font' projects rely on modern shaper exploits or WASM bridges, this project targets the original TrueType hinting virtual machine—a stack-based VM designed for grid-fitting glyphs, not rendering pseudo-3D environments. The result is a 6.5 KB .ttf file that calculates perspective and wall heights using the same instructions meant to make a serif look crisp on a low-res monitor.
The engineering effort here is primarily in the toolchain. The author built a custom DSL and compiler to handle the nightmare of F26Dot6 fixed-point math and the absence of standard loop constructs. Since TrueType bytecode lacks a 'WHILE' instruction, the engine implements loops via recursive function calls (FDEFs), flirting dangerously with FreeType's call stack limit. The technical ingenuity peaks in the use of Scale-Coordinate-Font-Size (SCFS) instructions to physically move vertical bar contours into 3D positions based on raycast results.
From a product standpoint, it is a proof-of-concept rather than a game. The JS layer handles the heavy lifting of game logic, input, and HUD rendering, treating the font essentially as a very specialized GPU. The main weakness is performance and stability; relying on browser glyph caching and font-variation-settings introduces jitter and rendering inconsistencies that require 'per-frame jitter' hacks to resolve.
This is required reading for developers interested in esoteric VMs, compiler design, or those who simply enjoy seeing a legacy specification pushed to its absolute breaking point. It transforms a static typography format into a dynamic rendering engine, proving once again that any Turing-complete system is just a game engine waiting to happen.