docs: add README and CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 20:21:30 -05:00
parent fc29bc204c
commit d543f8d3f1
2 changed files with 64 additions and 0 deletions

30
CLAUDE.md Normal file
View File

@@ -0,0 +1,30 @@
# 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 ECS
- `client/` -- Phaser 3 + TypeScript renderer
- `chars/` -- Character sprite assets (do not modify)
- `docs/plans/` -- Design and implementation docs
## Commands
- `npm install` -- install all workspace dependencies
- `npm -w server run dev` -- start server (port 3001)
- `npm -w server run test` -- run server tests (22 tests)
- `npm -w client run dev` -- start client dev server (port 3000)
- `npm -w client run build` -- build client for production
## 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
- Shared types ensure client/server protocol agreement
- Systems run in order: needsDecay -> npcBrain -> movement -> broadcast

34
README.md Normal file
View File

@@ -0,0 +1,34 @@
# DFlike
A multiplayer browser game inspired by Dwarf Fortress. Watch autonomous NPCs with needs-driven AI wander, eat, and rest in a shared world. Connect as an observer or take control of an avatar.
## Quick Start
```bash
npm install
# Terminal 1: Start server
npm -w server run dev
# Terminal 2: Start client
npm -w client run dev
```
Open http://localhost:3000. Open multiple tabs for multiplayer.
### Asset Setup
Character assets must be present at `client/public/assets/chars/`. If missing:
```bash
cp -r chars client/public/assets/
```
## Controls
- **WASD / Arrow Keys** -- pan camera (camera mode) or move avatar (avatar mode)
- **TAB** -- toggle between camera and avatar mode
## Architecture
- **Server:** Node.js + Socket.io, server-authoritative ECS simulation at 10 ticks/sec
- **Client:** Phaser 3 + TypeScript, Vite bundler
- **Shared:** TypeScript types and constants