A tower defense game with no asset files
Drawing everything in code, and keeping it fast
The Pikefall repository contains no images and no sounds. Every tower, enemy, hero, map, particle and note of music is produced by JavaScript as the game runs. That started as a convenience — no pipeline, no art files to keep in sync — and became a design principle, because it means the art cannot drift from the game. A tower's picture and its stats live in the same codebase and change in the same commit.
A small set of primitives is the art direction
Everything is built from a handful of drawing helpers: solid saturated fills, dark ink outlines, a rim light from the upper left, an elliptical ground shadow. One helper lights any solid with a warm flank toward the sun and a cool flank away from it. Because every sprite uses the same few helpers, the game reads as one game rather than as a collection of drawings.
The same rule applies to colour. The tower renderer writes no colour at all; every fill names a role, and a palette resolves the roles. That one decision is what made cosmetic tower skins a few lines of data instead of an edit to a 1,400-line drawing file.
A tier is a different building
An early version drew each upgrade as the same tower a few pixels taller. Players could not see that anything had happened, which is fatal in a genre where upgrading is the main thing you buy. Now tier one is timber, tier two puts it on stone, tier three fortifies it, and each branch at the fourth step is drawn as the step up from tier three. The upgrade you pay for is a building you can point at.
Draw calls are the lever, not pixels
Drawing a tower from scratch is around a hundred path operations, every frame, for every tower. The fix is to cache the static half of each building as an image once and draw the moving half — the archer, the turning gun — live. Units cache their walking poses the same way.
Two measurements from that work changed how we optimise. First, the cache images were mostly transparent margin, so we cropped them to the pixels they actually cover: a unit pose went from about 116 KB to 6 KB and a busy map's cache from 26 MB to 1.6 MB. That saved a lot of memory and changed frame time by about 2%. The GPU discards transparent pixels almost for free. Replacing a hundred path calls with one image draw is what moved the number.
Second, a benchmark of that image draw in a tight loop reported a twenty times speed-up. Measured interleaved with a real frame, the honest figure was 1.4×. A loop of identical operations pipelines in a way a real frame never does, so we now only trust measurements taken inside the frame they are meant to speed up.
The last allocation per entity per frame was a gradient. The contact shadow under every unit built a new radial gradient each frame, but over a full board there were only three distinct radii in use. Caching gradients by radius and opacity took the frame from 46 allocations to 4, with an identical picture. Mean frame time barely moved; what it bought was fewer garbage-collection stutters in the heaviest waves.
The world map is painted from the levels
The campaign map is a surveyor's chart, ink and wash on vellum, and every country on it is derived from one level's own ground colours. Rivers are anchored to the countries they drain, bridges appear wherever the march crosses water, and cleared country loses its blight as you win. Because it is computed rather than drawn, adding a level adds a country, and moving a level's position moves the nation, its rivers and its road.
What it costs
Some things are harder without files. The link preview image that social sites show has to be a PNG, so a small tool rasterises it at deploy time and the repository never stores it. The landing page cannot use a screenshot, so its hero is a real battle replayed through the game's own simulation. And nobody can hand the project a finished drawing: every sprite is code, and it is reviewed like code, at actual size, in a tool that draws the whole cast side by side.
In exchange there is no art to download, and the game stays consistent with itself. You can see every tower in the Field Manual, or play it.