Skip to content

Claude/fix player status display yu2gq#1152

Merged
braedonsaunders merged 2 commits into
mainfrom
claude/fix-player-status-display-Yu2gq
Jan 30, 2026
Merged

Claude/fix player status display yu2gq#1152
braedonsaunders merged 2 commits into
mainfrom
claude/fix-player-status-display-Yu2gq

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

No description provided.

The PlayerStatusPanel was incorrectly querying Game.getInstance().world,
which is the main thread's empty ECS world. The actual game simulation
runs in a Web Worker, and entity data is only available through
RenderStateWorldAdapter.

This caused all players to show as "DEFEATED" in spectator mode because
the main thread world had no entities, resulting in buildingCount === 0
for all players.

Changes:
- Import RenderStateWorldAdapter instead of Game
- Query entities from the render state adapter (synced from worker)
- Use getWorkerBridge() for event subscriptions

https://claude.ai/code/session_0137mAYwv8qrDRcfmUbHLJWG
The game runs in a Web Worker, but several main thread components
were incorrectly using Game.world (empty) instead of
RenderStateWorldAdapter (contains entity data synced from worker).

Fixed components:
- SelectionSystem: Now uses RenderStateWorldAdapter for entity queries
  and calls WorkerBridge.setSelection() to sync selection to worker
- PlayerStatusPanel: Already fixed in previous commit
- BattleSimulatorPanel: Uses RenderStateWorldAdapter for entity queries
- useCameraControl: Uses RenderStateWorldAdapter for entity lookup
- OverlayScene: Uses RenderStateWorldAdapter for attack indicators
- ConsoleEngine: Uses RenderStateWorldAdapter for reading entities,
  emits debug events for modifications (worker handles state changes)

Architecture changes:
- SelectionSystem accepts world provider and selection sync callback
- useWorkerBridge configures SelectionSystem with RenderStateWorldAdapter
- Debug commands emit events (debug:killEntity, debug:damageEntity, etc.)
  that worker should handle

This completes the worker mode implementation, fixing issues where:
- Selection didn't work (entities couldn't be found)
- Player status showed all players as defeated
- Camera centering on entities didn't work
- Debug console commands didn't work

https://claude.ai/code/session_0137mAYwv8qrDRcfmUbHLJWG
@braedonsaunders braedonsaunders merged commit acae070 into main Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants