50ccfd9c69
- Document follow mode panel feature and controls - Add Traefik reverse proxy deployment instructions - Add security note about vite dev vs production serving - Update CLAUDE.md with new entry points, test count, and conventions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
CLAUDE.md
Project
Multiplayer NPC simulation game (Dwarf Fortress-inspired). Server-authoritative ECS architecture.
Structure
shared/-- Types and constants (no runtime code)server/-- Node.js + Socket.io game server with ECSclient/-- Phaser 3 + TypeScript rendererchars/-- Character sprite assets (do not modify)docs/plans/-- Design and implementation docs
Commands
npm install-- install all workspace dependenciesnpm -w server run dev-- start server (port 3001)npm -w server run test-- run server tests (29 tests)npm -w server run test:watch-- run server tests in watch modenpm -w client run dev-- start client dev server (port 3000)npm -w client run build-- build client for production
Tooling
- ESM modules throughout (
"type": "module") - Server: tsx (runtime), vitest (tests)
- Client: vite (bundler), Phaser 3
- Shared: compiled to
shared/dist/(auto-built)
Key Entry Points
server/src/main.ts-- server startupserver/src/game/GameLoop.ts-- tick loop orchestrationserver/src/spawner/appearanceGenerator.ts-- NPC appearance + portrait feature generationserver/src/spawner/nameGenerator.ts-- NPC name generationclient/src/main.ts-- Phaser game bootstrapclient/src/scenes/GameScene.ts-- main game scene (camera/avatar/follow modes)client/src/sprites/CharacterCompositor.ts-- sprite layer compositingclient/src/sprites/PortraitCompositor.ts-- portrait layer compositing (data URL output)client/src/ui/NpcInfoPanel.ts-- follow-mode NPC info panel (HTML/CSS overlay)shared/src/types.ts-- protocol typesshared/src/constants.ts-- game constants (incl. portrait slots, folder mapping)
Key Conventions
- ECS components are plain data objects, systems are pure functions
- Server owns all game state; clients are renderers
- Character sprites are 48x48 per frame, 6 cols x 4 rows spritesheet layout
- Compositing: skins + accessories layered in z-order, cached as single textures
- Portraits: skin-specific layers composited client-side, exported as data URLs for HTML panel
- Portrait assets are in
chars/baseman/accessories/portraits/organized by skin folder (skin01-07) - Sprite skin
shape00_skinXXmaps to portrait folderskin{XX+1}, base fileskin{XX}.png - Shared types ensure client/server protocol agreement
- Systems run in order: needsDecay -> npcBrain -> movement -> broadcast
- Follow mode shows EarthBound-styled NPC info panel with live-updating needs bars