Commit Graph

132 Commits

Author SHA1 Message Date
root afc8329a82 fix: add catch handler for LLM generation promise in narration service
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:00:08 +00:00
root 4bcf90d7c5 feat: add NarrationService with event buffer, LLM priority, and template fallback
Implements NarrationService that manages a rolling buffer of 50 narration events,
generates immediate template fallback text, and queues LLM generation for priority
interactions and proposals (respecting daily limits).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:57:03 +00:00
root 865054facc feat: add NarrationEvent type and template fallback narration generator
Define NarrationEvent and NarrationOutcome types in shared package for
social interaction narration. Add generateFallbackNarration() with
randomized templates for each outcome type (positive, negative,
proposal_accepted, proposal_rejected) to provide immediate text when
LLM narration is unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:52:23 +00:00
root 6a8ffc26a1 fix: don't count failed API calls against daily rate limit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:50:50 +00:00
root 1de6178c50 feat(llm): update rate limits to match OpenRouter free tier and add daily limit
Raise requestsPerMinute from 10 to 20 and add requestsPerDay (1000) to
match OpenRouter free-tier limits. The generation queue now tracks daily
usage and resets at midnight, resolving requests with null once the cap
is hit. Both GenerationQueue and LlmService expose isDailyLimitReached().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:48:34 +00:00
root 138029e2a9 docs(llm): add .env.example and gitignore .env files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:30:59 +00:00
root 3a86e09e39 feat(llm): wire LLM service into GameLoop
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:30:32 +00:00
root b8a5032be6 feat(llm): add LLM service facade and prompt templates
Combines config, OpenRouter client, generation queue, and template
rendering into a simple generate(templateName, variables) API. When
disabled (no API key), returns a no-op implementation. Includes
backstory, socialNarration, and innerMonologue prompt templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:28:14 +00:00
root e9409f6e82 feat(llm): add rate-limited generation queue
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:26:32 +00:00
root cf403250e0 feat(llm): add OpenRouter API client with error handling and timeout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:23:23 +00:00
root 5f5bf24d64 feat: add prompt template system for LLM variable substitution
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:17:56 +00:00
root 98ec288caf feat: add LLM config module for OpenRouter API settings
Reads API key and model from environment variables. LLM is disabled by
default and auto-enables when OPENROUTER_API_KEY is set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:15:10 +00:00
root 4d6ca21bda fix: include camera dimensions in overlay cache key for resize handling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:15:12 +00:00
root 736941d190 fix: remove unused NIGHT_HOURS import and sunriseEnd variable
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:12:38 +00:00
root 88e560f4b4 feat: add day/night visual overlay with sunset/sunrise transitions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:10:05 +00:00
root a778bee58d fix: round cycleTicks to prevent float precision drift
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:08:05 +00:00
root f5857f72d8 feat: server tracks and broadcasts game time
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:04:08 +00:00
root b295ef1af7 feat: add gameTime to StateUpdate type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:03:23 +00:00
root 28533a3865 feat: add day/night cycle constants
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:03:13 +00:00
root 3be39b0c63 docs: add day/night cycle implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 02:57:21 +00:00
root 6800d35124 docs: add day/night cycle design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 02:55:10 +00:00
root 167cb514e6 fix: remove watergrass inner corner tiles from grass layer
The watergrass inner corner tiles (rows 0-1) show mostly water with a
tiny grass patch — they're designed for water tiles at concave corners,
not for grass tiles. Removing them eliminates the reddish-brown artifacts
at diagonal water-grass boundaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:56:40 +00:00
root f1f79ed765 fix: correct dirt autotile direction and simplify edge logic
Dirt tiles (dirt-on-transparent) must be applied to DIRT tiles checking
for non-dirt neighbors, not to GRASS tiles. The previous approach had
dirt edges facing the wrong direction because the dirt island's edges
point inward from the center, not outward from the grass.

Water edges (watergrass = grass-on-water) remain applied to GRASS tiles
since the grass portion aligns correctly with the base grass layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:50:07 +00:00
root 17621fbd59 feat: switch to LPC tileset with layered autotiling
Replace the 16x16 tileset with LPC Base Assets (32x32 tiles, 1.5x scale).
Uses a 4-layer rendering approach:
- Layer 0: solid grass base (grass.png)
- Layer 1: water transitions (watergrass.png) with LPC autotile edges
- Layer 2: dirt transitions (dirt.png) with LPC autotile edges
- Layer 3: tree canopy decorations (treetop.png)

LPC autotile format: 3x6 grid with inner/outer corners, edges, and fill
tiles. Edge tiles are selected based on 8-neighbor terrain analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:40:15 +00:00
root 4a2819695b feat: procedural tilemap with river, ponds, dirt, and trees
Replace colored-rectangle world rendering with a proper tilemap system
using a 16x16 RPG tileset scaled 3x. Server generates terrain via seeded
procedural generation (river, ponds, dirt patches, tree decorations) and
sends it to clients. Client renders 3-layer Phaser tilemap with
8-neighbor autotiling for water/dirt edges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:45:09 +00:00
root cee0fde937 Merge branch 'worktree-relationship-system' 2026-03-07 20:57:08 +00:00
root 61e37bd2db feat: add ring emoji for proposals and partner bond display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:36:37 +00:00
root 03f837f95f feat: use bond-aware classification in state serializer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:34:22 +00:00
root 0bfeef7fa1 feat: add proposal interaction handling to social system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:33:22 +00:00
root 66596fb96d feat: add proposal queuing and bond-aware despawn to relationship system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:24:32 +00:00
root bf2a9817ab fix: update tests for new SocialState shape and Devoted tier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:21:58 +00:00
root db808bca86 feat: initialize bond registry singleton and update spawner
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:21:54 +00:00
root f8ad3a6f0c feat: rename Partner tier to Devoted, add bond-aware classification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:20:26 +00:00
root 7b70b9c8bf feat: add proposal system config values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:18:40 +00:00
root 99e041d6cf feat: add proposal and bond types to shared protocol
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:18:38 +00:00
root 925f8a7494 feat: add bond registry with helpers for mutual relationships
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:16:33 +00:00
root 6b32e115b0 feat: add singleton support to World ECS
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:14:13 +00:00
root e5a6b443e9 docs: add mutual bonds implementation plan
12-task TDD plan covering bond registry, proposal interactions,
classification rework, config additions, and client display updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:11:48 +00:00
root d9b2a64430 docs: add mutual bond system design
Separates feelings (asymmetric sentiment values) from formal
relationship statuses (mutual bonds in a central registry).
Introduces proposal interaction protocol for partnership formation
with acceptance/rejection mechanics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 18:57:58 +00:00
root 6209a5db70 Merge branch 'worktree-relationship-system' 2026-03-07 17:03:58 +00:00
root b42362e041 fix: prevent orphaned accessory sprites from race conditions
Two bugs caused accessories to render independently of their NPC:

1. spawnEntities ran concurrently with state updates, allowing duplicate
   sprites to be created for the same entity. The orphaned sprite would
   animate in place but never move. Fixed by deferring onStateUpdate
   registration until initial spawn completes.

2. CharacterCompositor tracked load intent (Set) rather than load
   completion (Promise), so concurrent preloads could composite before
   shared textures finished loading — producing sprites with missing
   skin layers. Fixed by using a Map<string, Promise> so concurrent
   callers await the same per-file load promise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:47 +00:00
root 29c8c5fd8c fix: give each CommandPanel a unique DOM id
Both camera and follow panels had id='command-panel'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:33 +00:00
root 76ea7afb3b feat: add toggleable red glow highlight on followed NPC
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:33 +00:00
root 764d4d7355 feat: add follow mode command legend panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:33 +00:00
root 9b55a563ed refactor: parameterize CommandPanel title and commands
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:33 +00:00
root 0c93915339 docs: add follow highlight implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:18 +00:00
root 93df418554 docs: add follow mode highlight & command legend design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:03:18 +00:00
root 3de56316bb Merge branch 'worktree-relationship-system'
# Conflicts:
#	client/src/ui/CommandPanel.ts
2026-03-07 16:47:43 +00:00
root 05b408408d fix: give each CommandPanel a unique DOM id
Both camera and follow panels had id='command-panel'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 16:33:54 +00:00
root 1ff7ddad68 feat: add toggleable red glow highlight on followed NPC
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 16:27:37 +00:00