Commit Graph

141 Commits

Author SHA1 Message Date
root 8c793578ae feat: wire backstory generation into NPC spawn flow
Trigger fire-and-forget backstory generation whenever an NPC spawns,
both during initial spawn and via player spawn-npc requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:52:13 +00:00
root aa3f5651dd feat: add backstory generation helper for NPC LLM backstories
Adds formatStatsForPrompt to convert Stats into prompt-friendly abbreviations
and generateBackstory to call the LLM service with the backstory template,
writing the result back to the entity's backstory component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:49:32 +00:00
root 180f056570 feat: add backstory component to spawner and serializer
Initialize empty backstory on NPC spawn, serialize it for broadcast,
and add test coverage for the new component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:44:23 +00:00
root 0b028c2cec feat: add backstory field to EntityState shared type
Add optional backstory string to EntityState for NPC backstory generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:44:19 +00:00
root 28a0117b49 Merge branch 'worktree-llm-integration' 2026-03-08 16:32:51 +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 80ce9d1367 feat: integrate superlatives panel into GameScene with follow mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:48:42 +00:00
root 4fe41b7cf0 feat: add SuperlativesPanel UI component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:47:22 +00:00
root b3a74e40e1 feat: add superlatives socket methods to client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:45:23 +00:00
root 951b9cc701 feat: add superlatives subscribe/unsubscribe socket handlers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:44:16 +00:00
root 8b8f76bbb8 fix: remove unused classify import from superlativesComputer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:43:09 +00:00
root e709082694 feat: add superlatives computation with tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:41:05 +00:00
root 215eb66c23 feat: add superlatives types and socket events to shared
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:37:07 +00:00
root 180aabe17e docs: add superlatives implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:34:24 +00:00
root e54abdcbd2 docs: add superlatives system design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 04:30:44 +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