Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind

Assets become engine: a mesh builder, a texture painter and a sound device; the game keeps its recipes #8

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The three asset tools are now engine primitives, and the game keeps only its recipes.

shipped production is serving it deploy ae07c2d

opened this

The three asset tools are now engine primitives, and the game keeps only its recipes.

src/engine/mesh.ts holds Mesh, builder, finish, addBox and quadMesh; src/client/models.ts keeps levelMesh, playerMesh, bombMesh and viewModelMesh. src/engine/texture.ts holds hash, noise, fbm, Shader and paintAtlas(shaders, size); src/client/textures.ts became materials.ts, which exports the nine shaders, TEX_SIZE, and LAYERS derived from the list. src/engine/sound.ts is a device that opens an AudioContext lazily, holds the noise buffer, and plays two voices — a band-passed noise burst and a tone that can slide — plus attenuate; src/client/audio.ts stays the weapon-to-tone table with shot, hit and beep, and createAudio() keeps its signature, so main.ts is untouched. Each move is its own commit with bun test green in between.

Two things worth looking at. First, the winding test the issue asked for found a real bug: (axis, u, v) is a left-handed frame for the Y faces, so every box's north and south face was wound inside-out and the back-face cull was eating it — the preview should now show those faces where it previously showed through them. That is the one deliberate visual change; the uv layout is untouched. Second, the atlas is pinned by the sha256 it had before the move (d063c08…), asserted in src/client/materials.test.ts, so the map cannot change colour by accident. The sound device takes its AudioContext constructor as an optional parameter, which let the wiring be tested against a fake context rather than left uncovered; the arithmetic (attenuate) is tested on its own. No dependencies added, the bundle is rebuilt and committed as static/app.6864d577a4.js, and / answers in about 6 ms locally.

🤖 Generated with Claude Code

Closes #4

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs