Tileset graphics
public/tileset/<name>.{cv5,vf4,vr4,vx4,wpe} is what the app fetches on demand and
rasterises into one megatile atlas per tileset (src/formats/tileset/).
MTXM tile id ──(id >> 4)──▶ CV5 group ──(id & 15)──▶ VX4 megatile
VX4 megatile ──▶ 16 minitile refs (bit 0 = h-flip) ──▶ VR4 8×8 bitmaps ──▶ WPE palette
load.ts fetches and caches per tileset, decode.ts parses the five files,
atlas.ts rasterises the atlas the viewport blits from, terrain.ts derives the
terrain-type catalogue and its variations from the CV5, and palette.ts holds the
terrain names (from Chkdraft's tables, checked against real files in
tests/palette.test.ts).
Water animation#
The graphics are 8-bit indexed, and StarCraft animates water and lava by rotating a few short bands of the WPE palette every 8 game frames, about 336 ms on Fastest. The band tables per tileset are the game's own; Space Platform and Installation have none.
The atlas keeps a second small canvas holding just the megatiles that touch those
bands, and setAtlasStep re-rasterises it on each step. Always blit through
atlasSource(atlas, megatile) rather than indexing atlas.image directly. Averages
used by the minimap and far zoom stay at step 0.