Skip to content

Claude/fix fight button n d fo i#1361

Merged
braedonsaunders merged 2 commits into
mainfrom
claude/fix-fight-button-nDFoI
Feb 4, 2026
Merged

Claude/fix fight button n d fo i#1361
braedonsaunders merged 2 commits into
mainfrom
claude/fix-fight-button-nDFoI

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

No description provided.

When the battle simulator pauses the game, the game loop stops and
render states are no longer sent. This meant spawned/destroyed entities
weren't visible to the main thread's RenderStateWorldAdapter, causing
the Fight and Clear buttons to operate on stale data.

Added forceRenderStateUpdate() method to WorkerGame and call it after
spawnUnit and destroyEntity to ensure the main thread always has
current entity data.

https://claude.ai/code/session_01RByrKsfTJ9jf3kCjztLrY5
The Fight button wasn't working because:
1. AI was disabled for battle simulator mode (aiEnabled: false)
2. There was no way to register players as AI-controlled via the worker

Changes:
- Enable AI systems for battle simulator mode in useWorkerBridge
- Add registerAI message type to worker communication protocol
- Add registerAI handler in GameWorker to call EnhancedAISystem.registerAI
- Add registerAI method to WorkerBridge
- Update handleFight to register both players as AI before resuming

When Fight is clicked, both players are registered as AI-controlled,
allowing the EnhancedAISystem and AIMicroSystem to take over and
make units automatically attack enemies.

https://claude.ai/code/session_01RByrKsfTJ9jf3kCjztLrY5
@braedonsaunders braedonsaunders merged commit d1da7ca into main Feb 4, 2026
4 checks passed
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