Claude/fix player status display yu2gq#1152
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.