Commit Graph

89 Commits

Author SHA1 Message Date
root 8fe442e38c fix: move day label update before early return, add line-height
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 19:20:18 +00:00
root 61f6c0629f feat: pass dayNumber from state updates to TimeIndicator 2026-03-10 19:17:51 +00:00
root 6dcf281702 feat: double TimeIndicator size and add day counter 2026-03-10 19:17:47 +00:00
root 8e6a970ae4 fix: backstory generation reliability and admin LLM stats loading
- Fix LLM stats panel stuck on "Loading stats..." by requesting stats
  immediately after admin authentication succeeds
- Add retry mechanism for backstory generation (up to 3 attempts with
  increasing delays) so transient failures don't permanently skip NPCs
- Fix stale model bug: queued LLM requests now use the current model at
  dequeue time instead of capturing it at enqueue time, so fallback
  model switches take effect for pending requests
- Add per-template maxTokens (backstory: 350, invention: 300, desire:
  250) to prevent "length" finish truncation on structured JSON responses
- Remove unused "reasoning" field from backstory prompt to reduce token usage
- Add failure logging throughout LLM pipeline (backstory null results,
  queue errors) for better diagnostics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:21:00 +00:00
root f9e99ff09a feat: wire LLM stats into GameScene admin panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:28:48 +00:00
root 28ce0822e6 feat: add two-column admin panel with LLM analytics display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:28:01 +00:00
root 7b8ba95189 feat: widen LeftPanel to 680px when admin tab is active
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:27:21 +00:00
root d2fd013312 feat: add client socket methods for LLM stats
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:26:03 +00:00
root 6712942436 fix: address code review — auth gating, subscription cleanup, debounce, npcBrainSystem
- Wire npcBrainSystem to RuntimeConstants (was using hardcoded shared imports)
- Add auth gating on admin-update-constant and admin-reset-defaults sockets
- Unsubscribe from previous tab's data sources on left-panel tab switch
- Use per-key debounce timers in AdminPanel to avoid dropped changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 02:42:51 +00:00
root 701411c9a4 feat: integrate Admin and Log panels into LeftPanel and GameScene
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 02:28:32 +00:00
root 926bdc6687 feat: add AdminPanel UI component with password gate and constant editor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 02:25:51 +00:00
root a897dbfee4 feat: add LogPanel UI component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 02:25:21 +00:00
root 39cb094110 feat: add admin and log socket methods to SocketClient
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 02:25:03 +00:00
root 0127eeaae6 fix: remove quotes around backstory display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:51:25 +00:00
root ae723342c9 fix: strip NPC name prefix from thought display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:37:02 +00:00
root b347ada878 feat: add D (Desires) tab to NPC info panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:34:46 +00:00
root 034f799431 feat: multi-tile trees with treesnstone tileset and trunk bridging
Replace single-tile tree rendering with 6 multi-tile tree variants using
the treesnstone.png tileset. Each tree is 3 tiles wide with canopy tiles
on the decorations layer (above characters) and ground/shadow tiles on
the trunkDecorations layer (below characters). Add trunk bridge tiles
(tile 41) behind transparent canopy areas to connect canopy to ground
visually, fixing floating canopy appearance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:22:47 +00:00
root 7a16872bb9 feat: display NPC desires in info panel
Shows category-colored diamond bullets for active desires and
placeholder slots in the Status tab, between backstory and thoughts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 00:07:14 +00:00
root 45ecad89bb fix: store tooltip cleanup functions and call on destroy
Prevents orphaned tooltip divs when panels are torn down while
a tooltip is visible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:31:58 +00:00
root 3ae0d55f72 fix: prevent orphaned tooltip divs on rapid mouse re-entry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:29:15 +00:00
root ad80d63763 feat: add hover tooltips to NPC info panel tabs and stat abbreviations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:28:30 +00:00
root 57be76443c feat: add hover tooltips to left panel tabs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:27:28 +00:00
root 9165758e67 feat: add tooltip utility for hover labels
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 19:26:38 +00:00
root 34aca29082 fix: sleep emoji, invention history race condition, and gathering stuck state
- Add persistent 💤 emoji over sleeping NPCs (tracks sprite position)
- Buffer history events (inventions, narration, stockpile) in SocketClient
  to fix race condition where data arrived before GameScene handlers registered
- Fix NPCs getting stuck on 'gather' goal: tree trunks are both obstacles
  and resource tiles, so pathfinding always failed. Now findNearestResource
  returns adjacent walkable tiles for non-walkable resources, and
  gatheringSystem checks adjacent tiles. Added wander fallback when
  pathfinding to any gather target fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:57:50 +00:00
root 3294879bab fix: address code review findings for sleep system
- Fix NpcInfoPanel activity label: rest→sleep (functional bug)
- Remove unnecessary array spread in mapGenerator reserved set
- Remove unused SLEEP_NIGHT_END constant

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:02:04 +00:00
root 65ee23c5be refactor: remove rest POIs from map generation, persistence, and client rendering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:58:02 +00:00
root c0e015e6e5 fix(client): resolve three TypeScript type errors
Add missing Vite client type declarations, fix canvas-to-HTMLImageElement
cast in CharacterCompositor, and use proper Stats/StatName types in
NpcInfoPanel instead of loose Record<string, number>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:23:48 +00:00
root afbf85d7ff feat(client): improve day/night cycle and add time indicator
Fix vertical line artifacts in nighttime overlay by using a single
rectangle for full night and a base+sweep approach for transitions.
Increase night darkness from 0.3 to 0.45 for more distinct nighttime.
Add a time indicator bar at top-center showing day/night progress
with sun/moon icons matching the EarthBound-inspired UI style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:19:05 +00:00
root 067976f9a2 feat(client): rework NPC panel tabs to vertical left-edge S/R/H/I style
Replace horizontal Status/Relations/History tabs with vertical single-letter
tabs (S/R/H/I) on the left edge of the panel. Add dedicated Inventory tab,
removing inventory from the Status tab. Panel structure reworked to flex row
with tab column + panel body, matching the LeftPanel's tab styling but mirrored.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:59:22 +00:00
root 797ea2d410 feat(client): wire StocksPanel into LeftPanel with R tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:55:52 +00:00
root 3dbf5b707b feat(client): add StocksPanel UI component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:55:47 +00:00
root 803e6c9b8c feat(client): add stockpile socket callbacks to SocketClient
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:55:44 +00:00
root 9f77a84d6f feat(server): add pickup system for NPC stockpile material retrieval
NPCs can now retrieve crafting materials from stockpiles instead of
always gathering raw resources. The industry system checks if a
stockpile has needed materials before falling back to gathering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:52:37 +00:00
root d5ad7d5f7f feat(client): wire InventionsPanel into GameScene
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:46:21 +00:00
root e27f2381eb feat(client): add inventions tab with notification dot to LeftPanel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:45:10 +00:00
root 6b932d12a7 feat(client): add InventionsPanel UI component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:44:30 +00:00
root 01e6d9c526 feat(client): add invention event/history callbacks to SocketClient
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:43:38 +00:00
root c7bf7c9ef4 feat(client): add Phase D UI integration (D.1-D.3)
- D.1: Inventory display in NPC info panel (two-column grid below stats)
- D.2: Activity labels for gather/craft/build/dropoff goals
- D.3: Gold color for invention events in feed, lightbulb icon in history

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:13:15 +00:00
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 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 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 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 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 37b9390c64 style: shrink NPC info panel fonts and center command panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:21:57 +00:00
root 6f459fa88a feat: add trunk decorations, resize superlatives panel, add LLM plan docs
- Add trunk decoration layer to GameMap and mapGenerator
- Load trunk.png asset in BootScene
- Increase superlatives panel size and font sizes for readability
- Simplify mapGenerator (remove procedural terrain features)
- Add LLM integration planning documents
- Remove stale day-night cycle worktree plans
- Update local Claude settings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:09:19 +00:00