Skip to content

Comments

fix: game end condition not triggering when last player remains#1415

Merged
braedonsaunders merged 1 commit intomainfrom
claude/fix-game-end-condition-RWnqc
Feb 10, 2026
Merged

fix: game end condition not triggering when last player remains#1415
braedonsaunders merged 1 commit intomainfrom
claude/fix-game-end-condition-RWnqc

Conversation

@braedonsaunders
Copy link
Owner

Two bugs prevented the game from ending when only one player survived:

  1. Victory condition used entity queries to count players, but buildings are immediately destroyed on death. If eliminated players had no surviving units, they disappeared from entity queries, causing players.size to be 1 and preventing victory from ever being declared. Fixed by using the stable playerTeams map from game setup instead.

  2. AICoordinator continued running combat tactics for eliminated AI players (zero buildings path), causing their surviving units to actively fight and potentially kill the remaining player. Fixed by tracking eliminated players via game:playerEliminated events and skipping their updates entirely.

Also fixed handleSurrender to exclude already-eliminated players when determining the winner.

https://claude.ai/code/session_01AXNWK1n2KziPhLXqMJqX8Q

Two bugs prevented the game from ending when only one player survived:

1. Victory condition used entity queries to count players, but buildings
   are immediately destroyed on death. If eliminated players had no
   surviving units, they disappeared from entity queries, causing
   players.size to be 1 and preventing victory from ever being declared.
   Fixed by using the stable playerTeams map from game setup instead.

2. AICoordinator continued running combat tactics for eliminated AI
   players (zero buildings path), causing their surviving units to
   actively fight and potentially kill the remaining player. Fixed by
   tracking eliminated players via game:playerEliminated events and
   skipping their updates entirely.

Also fixed handleSurrender to exclude already-eliminated players when
determining the winner.

https://claude.ai/code/session_01AXNWK1n2KziPhLXqMJqX8Q
@braedonsaunders braedonsaunders merged commit c22b782 into main Feb 10, 2026
3 of 4 checks passed
@braedonsaunders braedonsaunders deleted the claude/fix-game-end-condition-RWnqc branch February 10, 2026 03:21
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