Claude/debug ai worker refactor 7qc pd#1115
Merged
Merged
Conversation
SpawnSystem.ts line 83 calls game.getTerrainHeightAt() but this method only existed in Game.ts, not WorkerGame. When SpawnSystem ran in the worker context, the call failed silently, preventing component additions to newly spawned entities. This caused AI-produced units to be created as empty entities without Unit components. https://claude.ai/code/session_01V4RhCiDvDJ7FmwSPYT74Y7
…plication This refactor creates a proper inheritance hierarchy to prevent bugs like the missing getTerrainHeightAt method that caused AI units not to spawn. Architecture: - GameCore (abstract base): Shared terrain, placement validation, commands - Game (extends GameCore): Main thread - Selection, Audio, multiplayer - WorkerGame (extends GameCore): Worker - simulation, AI, anti-throttling Benefits: - TypeScript catches missing methods at compile time - Single source of truth for terrain/placement logic - No more copy-paste between Game.ts and GameWorker.ts - Clearer separation of thread-specific vs shared code Also: - Removed hardcoded DEBUG flag, use debugLogger system - Cleaned up temporary debug logging from Entity.ts and World.ts https://claude.ai/code/session_01V4RhCiDvDJ7FmwSPYT74Y7
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.