Build log · Games
How I built Overset
A typesetting arcade game where text reflows around falling 3D rocks and your sword

1.Why I built it
The idea came from IrukiType's text-around-silhouette look, where body text wraps tightly around a shape. I wanted that reflow to be the game. A typewriter keeps setting a story into a two-column magazine page while rocks fall onto it, and every rock takes space away from the words.
"Overset" is the printer's term for text that doesn't fit its frame. If the page stays overset for three seconds, the run ends. The story itself is about a sword in a stone and a printer setting type around the shards, so the sword you swing is part of it.
2.How it works
Line-by-line layout around polygons
The layout function walks two columns, one 13 px line at a time. For each line it collects blocked intervals: the drop cap's box for the first three lines, then the horizontal span of every obstacle polygon inside that line's band, padded by 4 px. bandSpan finds that span by taking the vertices inside the band plus the points where edges cross the band's top and bottom.
With the blocked intervals sorted, it fills each free gap that is at least 9 px wide with as many characters as fit, using cached per-character widths from measureText. A gap can end mid-word. The function returns how many characters were placed, and the game compares that to how many the typewriter has set so far. The difference is the overset count.
Rocks are hand-rolled 3D meshes
Each rock starts as an icosahedron, optionally subdivided once with a midpoint cache, then made chunky. A few random cutting planes push vertices inward wherever they poke past the plane, and a final jitter and per-axis squash finish the shape. Orientation is a 3x3 matrix updated each frame by a Rodrigues rotation from the angular velocity, then re-orthonormalised so it doesn't drift.
To draw a rock, every vertex is rotated, given a simple perspective scale, and projected. Faces are sorted far to near and filled with a lambert shade from a fixed light. The projected points also go through a monotone-chain convex hull, and that hull is the obstacle the text wraps around. The text therefore follows the rock's actual silhouette as it tumbles.
Swing speed decides cut or push
The sword is a 13-point polygon that also blocks text. Each frame I sample points along the blade at its previous and current pose and check segment distance to each rock, so a fast swing can't pass through a rock between frames. If the tip moves faster than 260 px/s, the rock shatters into spinning 3D shards. A slow touch only pushes the rock out of the blade and passes on a little of the sword's velocity.
Every third page brings a boulder with hit points. Crystal and magma rocks behave differently, and three power-ups drop: an hourglass, an ink bomb and a quill that doubles points. Hits inside 1.2 seconds of each other build a combo multiplier up to 5x.
Sprites, page turns and the leaderboard
The sword and power-up art come from a script that asks the OpenAI Images API for each object on flat chroma green, then keys it out with an edge flood-fill and despill, crops and resizes it. The script also writes sword.json with the crossguard row so the game can pin the hilt to the pointer. Every sprite has a procedural fallback in case the PNG is missing.
At the end of each page the old page is copied to a second canvas and turned with the Web Animations API. Scores go to a Convex table through a submitScore mutation that trims the name and range-checks the values, and the board shows each player's best score only.
3.Try it
Move the pointer to hold the sword and swing fast to shatter rocks; press P to pause.


