feat(online): live queue count — friends see each other waiting
The server only sent the queue size to the player who just joined, and the client dropped the count entirely (emitMM ignored s.players). So two friends queuing together never saw each other, even though the server does seat 2+ waiting humans together within ~25s. - Server: BroadcastQueueLocked() pushes the current queue size to EVERY waiting player on join/cancel (not just the joiner). - Client: thread the count through emitMM → MatchmakingState.waiting. - MatchmakingScreen shows "N players in queue" (mm.inQueue) when ≥2 humans wait, so friends can tell they're queued together before bots fill the empty seats. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,7 @@ export class SignalrService implements OnlineService {
|
||||
.build();
|
||||
|
||||
conn.on("matchmaking", (s: { phase: string; players: number; queuePosition: number | null }) =>
|
||||
this.emitMM(s.phase, s.queuePosition ?? undefined));
|
||||
this.emitMM(s.phase, s.queuePosition ?? undefined, s.players));
|
||||
conn.on("matchFound", () => {
|
||||
this.emitMM("ready");
|
||||
// Safety net: if the initial state never lands (dropped/raced), ask the
|
||||
@@ -226,7 +226,7 @@ export class SignalrService implements OnlineService {
|
||||
}
|
||||
}
|
||||
|
||||
private emitMM(phase: string, queuePosition?: number) {
|
||||
private emitMM(phase: string, queuePosition?: number, waiting?: number) {
|
||||
const state: MatchmakingState = {
|
||||
phase: phase as MatchmakingState["phase"],
|
||||
players: [],
|
||||
@@ -234,6 +234,7 @@ export class SignalrService implements OnlineService {
|
||||
ranked: this.mmRanked,
|
||||
stake: this.mmStake,
|
||||
queuePosition,
|
||||
waiting,
|
||||
};
|
||||
this.mmCbs.forEach((cb) => cb(state));
|
||||
}
|
||||
|
||||
@@ -390,6 +390,8 @@ export interface MatchmakingState {
|
||||
elapsedMs: number;
|
||||
ranked: boolean;
|
||||
stake: number;
|
||||
/** live count of real humans waiting in the matchmaking queue (incl. you). */
|
||||
waiting?: number;
|
||||
/** position in the queue when phase === "queued" */
|
||||
queuePosition?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user