Commit Graph

200 Commits

Author SHA1 Message Date
root 2abcb7b1e1 feat(client): render stone terrain tiles as gray overlays
Stone tiles now display as gray rectangles with darker borders instead of
being hidden under the base grass layer. Also treats stone as a land tile
for water edge autotiling so water/stone boundaries render correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:52:10 +00:00
root 25d842e367 feat(systems): pause movement during gathering, wire gathering into game loop
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:50:48 +00:00
root 3a075b68e0 feat(protocol): broadcast inventory and resource tiles to clients
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:50:38 +00:00
root 5fba656c62 feat(systems): add gatheringSystem with timer, stat modifier, and inventory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:49:47 +00:00
root 61c463c1c7 feat(brain): add gather goal when productivity is low
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:47:51 +00:00
root e1edbd47c6 feat(needs): add productivity decay to needsDecaySystem
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:46:57 +00:00
root 4670bfc08b feat(spawner): add productivity need and inventory to spawned NPCs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:45:34 +00:00
root 096597e7e5 feat(loop): register ItemRegistry and load resource tiles
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:44:59 +00:00
root 429523f3b4 feat(map): generate water ponds, stone deposits, and tree resources
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:43:47 +00:00
root b3a9197aec feat(industry): add inventory helper functions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:41:18 +00:00
root 25546b5f44 feat(industry): add ItemRegistry with seed resources
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:41:03 +00:00
root 4f48c65fe3 feat(config): add industry config for gathering and map generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:40:33 +00:00
root 53750df48b feat(shared): add productivity need, gather goal, inventory, STONE terrain
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:40:09 +00:00
root f6792baf68 docs: phase resource system design into 4 independent implementation stages
Break the monolithic 2.2 design into Phases A-D that can each be
implemented in a separate session with cleared context. Each phase
section is self-contained with all needed specs and file references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:28:17 +00:00
root ce2caa4ae1 fix(memory): use auto-incrementing id as tick proxy for recency scoring
Events recorded with tick: 0 now get a meaningful tick value from the
service's internal counter, ensuring selectForPrompt recency scoring
works correctly. Also fixed preferTypes to accept readonly arrays.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:09:01 +00:00
root ccb53d8a17 docs: mark task 2.1 (NPC event memory) as complete
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:05:46 +00:00
root cb59636cd9 feat(memory): add shared history context to social narration prompts
When narrating social interactions, the LLM now receives up to 3 shared
history events between the two NPCs, enabling more contextual narrations
that reference past encounters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:04:52 +00:00
root 1db8935de3 feat(memory): integrate event memory into thought generation context
Replace the simple last-2-narration-events approach with smart selection
of up to 5 memory events, preferring types relevant to the thought trigger
(social events for post-interaction, need events for need-critical).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:04:46 +00:00
root 7194321e1b feat(memory): add client memory events, History tab in NPC info panel
Wire SocketClient to receive memory-event and memory-history socket
events. GameScene stores per-NPC memory events and updates the info
panel in follow mode. NpcInfoPanel gains a third "History" tab showing
a reverse-chronological event log with emoji icons per event type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:02:16 +00:00
root 1a83814a0f feat(memory): record need crisis, recovery, and goal change events
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:59:42 +00:00
root 1b114a1897 feat(memory): record tier changes and bond dissolution events
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:58:09 +00:00
root ef7a792750 feat(memory): record spawned, social, proposal, and bond events
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:56:42 +00:00
root 2c4a0d1f75 feat(memory): wire EventMemoryService into GameLoop and SocketServer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:54:56 +00:00
root 1f5cafe2fd feat(memory): add EventMemoryService with smart selection and tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:52:46 +00:00
root ba487839fd feat(memory): add MemoryEvent types and socket events to shared
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:50:08 +00:00
root 48332b104c docs: add NPC event memory implementation plan (task 2.1)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:46:48 +00:00
root 7f2097be0e docs: add NPC event memory system design (task 2.1)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:41:31 +00:00
root 35d1bb0bee fix: update socialSystem tests to match new tuning values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:19:16 +00:00
root d58e623c14 tweak: reduce stat drift rates and increase social cooldowns
- Halve sociability/empathy drift on positive outcome (0.05 -> 0.025)
- Halve temperament drift on negative outcome (0.02 -> 0.01)
- Increase social global cooldown (50 -> 75 ticks)
- Increase social pair cooldown (300 -> 450 ticks)
- Increase base proposal cooldown (500 -> 750)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:18:03 +00:00
root eb79c5e481 fix(thought): add missing trigger types and prevent emoji overlap
- determineTrigger now detects post_interaction (recent social outcome),
  need_critical, idle (wandering), and periodic triggers
- Track active emoji per NPC, destroy previous before showing new one

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:16:24 +00:00
root 22956c2050 docs: mark task 1.4 (NPC inner monologue) as complete
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:12:51 +00:00
root daddf2583d feat(thought): wire client socket, GameScene thought handling, emoji animation, and info panel display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:12:00 +00:00
root b515f7195f feat(thought): integrate ThoughtSystem into game loop and socket broadcast
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:10:00 +00:00
root fb19f6cf8d feat(thought): add ThoughtSystem with batching, cooldowns, and trigger detection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:08:30 +00:00
root 4e5edda6c6 feat(thought): add mood-contextual emoji picker
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:05:55 +00:00
root a16d70a1b8 feat(thought): add batched thought generator with LLM prompt and parser
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:04:46 +00:00
root e33a253c5b feat(thought): add thought config and npc-thought socket event type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:02:50 +00:00
root e17f8c7655 docs: add NPC inner monologue implementation plan (task 1.4)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:57:27 +00:00
root b151d8a785 docs: add NPC inner monologue design (task 1.4)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:53:51 +00:00
root 69c36e776b docs: add resource, tool & invention system design
Design for LLM-driven emergent crafting and invention system.
NPCs gather resources from terrain, craft at workshops, and
occasionally have eureka moments where an LLM invents new items.
Updates LLM roadmap: this becomes item 2.2, old goal selection
splits into 2.5 (POI naming).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:37:20 +00:00
root 87946bcb5c feat: add social interaction narration system (task 1.3)
Implements LLM-powered narration for NPC social interactions:
- Rate limits updated to 20 RPM / 1000 per day (OpenRouter free tier)
- NarrationEvent type with template fallback text generator
- NarrationService with rolling event buffer and LLM priority queuing
- Narration emitter wired between social and relationship systems
- Socket.io events for real-time narration delivery
- Tabbed left panel (Stats + Events) replacing old Superlatives panel
- Recent events section in NPC info panel
- Follow tracking via socket for LLM narration priority

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 19:29:43 +00:00
root 94e4f4b9c2 fix: restore superlatives methods, fix event update rebuild, remove dead method
- Restore subscribeSuperlatives/unsubscribeSuperlatives/onSuperlativesUpdate
  on SocketClient (lost during Task 5 refactor)
- Fix EventsFeed.updateEvent to rebuild entire element when LLM narration
  arrives (names may be in different positions)
- Remove dead setFollowedEntity method from GameLoop (replaced by
  SocketServer.rebuildFollowedEntityIds)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:38:06 +00:00
root 6514dde42e feat: track followed NPCs via socket for LLM narration priority
Adds follow-npc client event so the server knows which NPCs are being
watched, enabling priority LLM narration for followed entity interactions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:25:16 +00:00
root e8723f0a06 feat: add recent narration events to NPC info panel
Show the last 3 narration events involving the followed NPC in the
Status tab, between the activity label and the diamond separator.
Events update live when new narrations arrive or LLM text replaces
template text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:22:48 +00:00
root 554b5a6f30 feat: refactor left panel into tabbed container with Stats + Events tabs
Extract SuperlativesPanel into content-only component, create LeftPanel
as the outer shell with two tabs (S for Stats, E for Events), and add
EventsFeed component for displaying narration events with clickable
NPC names and auto-scroll behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:19:20 +00:00
root 57695043f2 feat: add socket.io events for narration broadcast
Wire narration events through the socket layer so clients receive
real-time narration updates. Server emits narration-event on creation,
narration-update when LLM text arrives, and narration-history on connect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:14:50 +00:00
root 78c8dbfb7f fix: use shared formatStatsForPrompt from backstoryGenerator
Removes duplicated local version that had different format.
Also brings backstoryGenerator.ts into the worktree from main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:13:23 +00:00
root 541b70b781 feat: wire narration emitter into social system and GameLoop
Add narrationEmitter system that reads completed interactions from
socialState.lastOutcome and feeds them to the NarrationService. It runs
between socialSystem and relationshipSystem to capture outcomes before
they are cleared. Includes pair deduplication, proposal detection,
priority marking for followed NPCs and high-value relationships, and
personality formatting for LLM prompts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:02:59 +00:00
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