diff --git a/apps/web/src/hooks/useArcadeSocket.ts b/apps/web/src/hooks/useArcadeSocket.ts index fb492be3..f91c8cd3 100644 --- a/apps/web/src/hooks/useArcadeSocket.ts +++ b/apps/web/src/hooks/useArcadeSocket.ts @@ -124,8 +124,9 @@ export function useArcadeSocket(events: ArcadeSocketEvents = {}): UseArcadeSocke console.warn('[ArcadeSocket] Cannot send move - socket not connected') return } - console.log('[ArcadeSocket] Sending move:', move) - socket.emit('game-move', { userId, move }) + const payload = { userId, move } + console.log('[ArcadeSocket] Sending game-move event with payload:', JSON.stringify(payload, null, 2)) + socket.emit('game-move', payload) }, [socket]) const exitSession = useCallback((userId: string) => { diff --git a/apps/web/src/lib/arcade/session-manager.ts b/apps/web/src/lib/arcade/session-manager.ts index b33cbaa2..cdf17a62 100644 --- a/apps/web/src/lib/arcade/session-manager.ts +++ b/apps/web/src/lib/arcade/session-manager.ts @@ -129,9 +129,22 @@ export async function applyGameMove( // Get the validator for this game const validator = getValidator(session.currentGame as GameName) + console.log('[SessionManager] About to validate move:', { + moveType: move.type, + playerId: move.playerId, + gameStateCurrentPlayer: (session.gameState as any)?.currentPlayer, + gameStateActivePlayers: (session.gameState as any)?.activePlayers, + gameStatePhase: (session.gameState as any)?.gamePhase + }) + // Validate the move const validationResult = validator.validateMove(session.gameState, move) + console.log('[SessionManager] Validation result:', { + valid: validationResult.valid, + error: validationResult.error + }) + if (!validationResult.valid) { return { success: false,