From 4747aa9632691e9620ce8ae3357493e045b59f20 Mon Sep 17 00:00:00 2001 From: cottongin Date: Sun, 15 Feb 2026 22:46:16 -0500 Subject: [PATCH] Fix game.started not firing when Jackbox room is full The waitForGameStart() function checked roomStatus.full before roomStatus.locked, causing it to short-circuit when a room was full but the game hadn't started yet. This meant game.started was never broadcast and watchGameAsAudience() was never called for full games. Now only locked=true triggers game start detection. When full=true but locked=false, the poller continues until the game actually starts. Co-authored-by: Cursor --- backend/utils/player-count-checker.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/backend/utils/player-count-checker.js b/backend/utils/player-count-checker.js index acbb4a3..15d8f00 100644 --- a/backend/utils/player-count-checker.js +++ b/backend/utils/player-count-checker.js @@ -406,24 +406,20 @@ async function startPlayerCountCheck(sessionId, gameId, roomCode, maxPlayers = 8 return false; } - // If full, we know the count immediately - if (roomStatus.full) { - console.log(`[Player Count] Room is FULL - ${roomStatus.maxPlayers} players`); - updatePlayerCount(sessionId, gameId, roomStatus.maxPlayers, 'completed'); - stopPlayerCountCheck(sessionId, gameId); - return false; - } - // If locked, game has started - ready to watch if (roomStatus.locked) { console.log(`[Player Count] Room is LOCKED - game in progress, starting watch`); - // Return both status and real maxPlayers from Jackbox return { ready: true, maxPlayers: roomStatus.maxPlayers }; } - // Not ready yet - console.log(`[Player Count] Room not ready yet (lobby still open)`); - return null; + // Log if full but not yet started + if (roomStatus.full) { + console.log(`[Player Count] Room is FULL but not locked yet - waiting for game start`); + } else { + console.log(`[Player Count] Room not ready yet (lobby still open)`); + } + + return null; // Not ready, keep polling }; // Wait 10 seconds before first check