Timed 3D toy-snake brawl. Four wind-up snakes, 36 capsule bricks, three minutes. Nothing new ever spawns.
pnpm install
pnpm devThen open http://127.0.0.1:5173/. The dev server listens on the LAN as well so friends can use the printed Network URL.
pnpm build # typecheck + production bundle
pnpm preview # serve dist/| Path | Role |
|---|---|
snap-snake.html |
Original prototype (Three r149, single file). Frozen reference. Open it directly in a browser. |
index.html + src/ |
Current game. Vite + TypeScript + Three r170. |
src/snake.ts |
Head mesh, trail follow, snap / devour / bite-off. |
src/bricks.ts |
Horizontal capsule bricks with studs and a mold seam. |
src/game.ts |
Match flow, combat helpers, collisions, constant node pool. |
src/scene.ts |
Renderer, lights, arena, camera setup. |
src/input.ts |
Mouse raycast, WASD, skeuomorphic joystick. |
src/net/ |
LAN lobby, WebSocket client, snapshot apply. |
server/lan.mjs |
Password room + relay, attached to Vite. |
Bite-off is immediate: a new steering input more than 45° from the locked trail heading breaks the snap and keeps every stolen node. Leftover aim from the approach does not count until the heading actually changes.
Setup (menu button, in-match set / Esc) stores sound, volume, light/dark shell, toy vs fast render, match length, camera shake and name tags in localStorage. Opening it during a brawl freezes the clock.
Host a password room from LAN on the main menu. Seats are 2, 3 or 4; unused seats become AI. Two-player is the mode to start with.
- Host types a password, picks seats, clicks Host room. Share a Network URL (
http://192.168.x.x:5173) plus that password. - Guests open that URL, click LAN → Join room with the same password.
- Guests press Ready. Host starts when at least two people are in and everyone else is ready.
The host browser runs the match. Other machines send steering and receive snapshots over /lan on the same port as the web app. If the host tab closes, the room ends.