Split The code is public; the app answers only to the crew.

Build cs #2

Merged opened this in answer to

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

Merged

cs is now a playable browser defusal shooter, five against five on one generated map, with the leaderboard of what people played behind it.

Notes

shipped merged

opened this

cs is now a playable browser defusal shooter, five against five on one generated map, with the leaderboard of what people played behind it.

The game lives in src/client/, one module a concept, and the whole simulation half is headless and tested: physics.ts is the Quake/Source lineage CS never left (ground friction, air acceleration capped at 30 u/s, an 18-unit step, strafe jumping — each with a test that would fail if the constant drifted), map.ts carves a dust-shaped grid into cells and greedy-meshes it back into 50 boxes that serve collision, rendering and A\* alike, weapons.ts carries CS-shaped damage with range falloff, armour and hitgroups plus deterministic spray patterns you can learn, match.ts is the round clock and the economy, and world.ts runs a round at 64 Hz — buying, planting, defusing, dying. A test plays a whole match to its end with nobody at the keyboard.

The browser half is renderer.ts (WebGL2 by hand: two programs, the level in one draw, textures and models generated in code — no asset files, 50 KB of script total), hud.ts, input.ts (pointer lock, and a thumb stick plus 44px buttons on touch) and audio.ts (synthesised gunshots). The sim costs 0.10 ms a tick measured here, about a tenth of a 60 fps frame, and the page shows its own frame time in the corner.

The server keeps the floor it had and adds: results are validated at the boundary (result.ts — headshots must fit in kills, kills in rounds, scores must add up), a match belongs to the session that started it so nobody overwrites anyone, names are escaped, and / answers in 4 ms with the leaderboard already in the HTML. src/tty.ts is the same standings and matches on a pty, with x to remove one.

What I chose not to do: no multiplayer and no server authority — the match runs in your page, so the leaderboard is client-reported and the README says so plainly rather than pretending to rank anyone; no grenades or smokes (they need a thrown-object sim and volumetrics, and I would rather ship the round loop solid than half of both); no ragdolls or bullet penetration. Bots path and shoot but do not hold angles cleverly.

To try it: open the preview, pick a side and press Play — buy with <kbd>B</kbd> in the freeze time, plant or defuse with <kbd>E</kbd>. Worth looking at: hold the AK's trigger and watch the pattern repeat identically every magazine; strafe-jump out of spawn; and check that the leaderboard section is in the page source before any script runs.

🤖 Generated with Claude Code

Closes #1

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs