From b62b3680340be5c8190d35aba95b32b7494902a3 Mon Sep 17 00:00:00 2001 From: MiguelCarino Date: Wed, 21 Oct 2026 21:32:38 -0600 Subject: [PATCH] Draw the city in high definition, still in text The payload splits per world: index.html keeps the engine and the city, and w/west.js, w/jp.js and w/moon.js carry the other worlds, each loaded with a content-hash cache-buster and isolated so one failing chunk only loses its own world. Under the glyphs sits a per-world underpainting (CC.Compose.UNDER, with 0 as a kill switch for the frame data and glyph layer), glyphs print through a pixel path on small cells, optics are sized for denser grids, and the default bands reach about 300 columns at 1920 px and 360 at 2560, stepping back down on a slow machine. The photosensitivity probes now see the composite, at 200x60 and 400x120, weighted by ink-compensated coverage for the real cell size. 27 of 28 runs pass; lum-mode west-flicker at 400x120 (3.25/s against the city's 3.16/s) is documented in CONTRACT as still open. Also carries the share card: og.jpg, its og/twitter meta and sitemap. --- CONTRACT.md | 157 +- README.md | 103 +- build.js | 208 +- index.html | 6859 ++---------------------------------- og.jpg | Bin 0 -> 92774 bytes sitemap.xml | 2 +- src/core.js | 341 +- src/elements/optics.js | 100 +- src/elements/weather.js | 6 +- src/elements/west_stock.js | 22 +- src/main.js | 91 +- src/raycast.js | 33 +- src/render_canvas.js | 165 +- src/surf_japan.js | 64 +- src/surf_west.js | 25 +- src/surfaces.js | 13 + tools/canal-flicker.cjs | 25 +- tools/composite.cjs | 212 ++ tools/cov.json | 256 ++ tools/domshim.cjs | 223 +- tools/flicker-rate.cjs | 65 +- tools/headless.cjs | 23 +- tools/lightning-rate.cjs | 65 +- tools/metrics.py | 58 +- tools/peds.cjs | 3 + tools/road-flicker.cjs | 28 +- tools/sakura-flicker.cjs | 45 +- tools/topng.py | 274 +- tools/west-flicker.cjs | 83 +- w/jp.js | 1750 +++++++++ w/moon.js | 2019 +++++++++++ w/west.js | 2744 +++++++++++++++ 32 files changed, 9233 insertions(+), 6829 deletions(-) create mode 100644 og.jpg create mode 100644 tools/composite.cjs create mode 100644 tools/cov.json create mode 100644 w/jp.js create mode 100644 w/moon.js create mode 100644 w/west.js diff --git a/CONTRACT.md b/CONTRACT.md index 6922dac..618ac47 100644 --- a/CONTRACT.md +++ b/CONTRACT.md @@ -1,7 +1,11 @@ # CyberCity — module contract -Deliverable: **one self-contained `index.html`**, fullscreen, pure ambient, no game loop. -Sources live in `src/`; `node build.js` inlines them into `index.html`. Never edit `index.html` by hand. +Deliverable: **`index.html` plus `w/`** — the page with the engine and the city inline, and one +`w/.js` per secondary world loaded by synchronous `\n').join('')} `; fs.writeFileSync(OUT, HTML, 'utf8'); +/* w/ is rewritten whole: a chunk this build did not produce (a world renamed or folded back + * inline) would otherwise sit there being published and never loaded. */ +fs.mkdirSync(WDIR, { recursive: true }); +for (const f of fs.readdirSync(WDIR)) + if (f.endsWith('.js') && !chunks.some(c => c.rel === 'w/' + f)) fs.unlinkSync(path.join(WDIR, f)); +for (const c of chunks) fs.writeFileSync(path.join(ROOT, c.rel), c.text, 'utf8'); +const kb = n => n + ' bytes (' + (n / 1024).toFixed(1) + ' KB)'; const bytes = Buffer.byteLength(HTML, 'utf8'); +let over = false; for (const p of files) console.log(' + ' + path.relative(ROOT, p).split(path.sep).join('/')); -console.log('index.html ' + bytes + ' bytes (' + (bytes / 1024).toFixed(1) + ' KB) ' + - files.length + ' modules'); +console.log('index.html ' + kb(bytes) + ' ' + (files.length - chunks.reduce((n, c) => n + c.files.length, 0)) + + ' modules headroom ' + (CAP_PAGE - bytes)); +if (bytes > CAP_PAGE) { console.error('build: index.html is over the 600 KB budget'); over = true; } +for (const c of chunks) { + const n = Buffer.byteLength(c.text, 'utf8'); + console.log(c.rel.padEnd(11) + ' ' + kb(n) + ' ' + c.files.length + ' modules headroom ' + (CAP_CHUNK - n)); + if (n > CAP_CHUNK) { console.error('build: ' + c.rel + ' is over the 160 KB per-world budget'); over = true; } +} /* THE BUDGET WAS 200 KB AND IT IS NOW 300 KB. That is a raise, not a discovery, and it is being * written down rather than quietly deleted. src/ went from roughly 190 KB to roughly 530 KB in one * pass — twelve new ambient elements, a weather director every element reads, four input devices, @@ -545,8 +634,39 @@ console.log('index.html ' + bytes + ' bytes (' + (bytes / 1024).toFixed(1) + ' * tree and it is worth two thousand bytes. A world is thirty thousand. Splitting the payload costs * the "one self-contained file" property, which is the first line of CONTRACT.md and is a real * loss — but it is the only remaining answer that is not "ship less", and it should be taken - * deliberately, by someone who has decided that trade, rather than discovered at this line again. */ -if (bytes > 600 * 1024) { - console.error('build: index.html is over the 600 KB budget'); - process.exit(1); -} + * deliberately, by someone who has decided that trade, rather than discovered at this line again. + * + * ---- AND THE PASS AFTER THAT SPLIT IT. ONE 600 KB LINE -> 600 KB + 3 x 160 KB. ---- + * Seventh time at this line, and the first time the answer is the one the last three paragraphs + * asked for. It was DECIDED, by the owner, before a byte of it was written — which is the condition + * the paragraph directly above set — and this is the record of what was traded. + * + * WHY NOW: the high-definition pass (an underpainting behind the glyphs, a pixel-path printer, + * density-correct optics) was costed at 8.5-9 KB against 1,983 bytes of headroom. The banked + * duplication cut is 2.35 KB of it. No ordering of the three moves closes that, and the fourth + * option — the next world — was already known not to fit. So it split. + * + * WHAT WAS SPENT: the "one self-contained file" property. index.html is still the page, still + * opens with no server (file:// runs classic