Public: anyone can read this; the crew can change it.
forked from trevato/cs
The sample draws with the engine it advertises: the example room in WebGL2, with the 2D plan as its fallback #222
Check · Review · Land · Live done — Landed and live in production.
`/example` now draws its room, plate and tracers through the engine's WebGL2 renderer, out of recipes written in the sample itself: `src/engine/example.ts` gained two box meshes (the room is one box handed in with its corners swapped, so every face is wound to be seen from within), two atlas shaders, a two-instance scene with one line for the shot, and a `spark` on the world so a tracer fades in t…
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
new above
offline
/examplenow draws its room, plate and tracers through the engine's WebGL2 renderer, out of recipes written in the sample itself:src/engine/example.tsgained two box meshes (the room is one box handed in with its corners swapped, so every face is wound to be seen from within), two atlas shaders, a two-instance scene with one line for the shot, and asparkon the world so a tracer fades in ticks the game owns.src/example/main.tsis still only wiring — it builds the renderer and falls back toplan.tswhencreateRendererhands back null, exactly as the range does — and the readout (score, clock, bar, help, crosshair) moved onto the HUD canvas so both paths share one copy of it.One engine change made it possible:
RendererAssets.nearand.far, the clip planes in the game's own unit, defaulting to the shooter's 6 and 12,000. A room four metres wide is entirely inside a near plane of six Source units, and a renderer that assumed one game's units was the engine knowing a game;renderer.test.tsholds the projection against both.Sizes, measured on the bundles this branch commits: example 9,735 → 21,115 raw and 4,618 → 9,189 gzipped, so its ceiling moves to 23,500 / 10,200 with the reasoning written into
src/games.ts. Almost none of that is the game — the recipes are about forty lines — it isrenderer.ts,mesh.ts,texture.tsandscene.tsarriving whole, the same price the range paid. The other two bundles grew 46 and 34 raw bytes for the clip planes and fit their ceilings. Lines:src/engine/example.ts79 → 176, the wiring 220 → 279, and/example's "What this cost" is re-rendered from those files rather than retyped — the page's own test still refuses any digit in that prose that is not a measurement.Worth looking at: the GL path in
src/example/boot.test.ts(the atlas and both meshes uploaded once, twodrawElementsa frame, a tracer that appears on a press and is gone a tenth of a second later), the fallback test beside it, andsrc/example/stage.test-helper.ts, whose GL recorder is a proxy rather than a third written-out copy of the renderer's call list. I did not give the example a column in the guide's seam table — that is #130's job, and the sentence there now says so instead of claiming the example is in no column. One thing outside the issue: main had two committedapp.<hash>.jsbundles, which twelve tests refuse to pick between, so the first commit on this branch rebuilds and commits one.🤖 Generated with Claude Code
Closes #216