Matchmaking Diagnosis

Queue Configuration Audit

Export PlayFab matchmaking queue rules and validate ticket attribute mappings. Most failures stem from mismatched skill ranges or missing region tags.

// Common culprit: missing latency data MatchmakingTicket ticket = new MatchmakingTicket { Attributes = new Dictionary<string, object> { { "skill", playerMMR }, { "region", "us-west" } // Must match queue rule } };

Telemetry Analysis

Pull PlayFab API logs and correlate ticket creation timestamps with match allocation events. Timeouts usually indicate queue depth issues or server pool exhaustion.

  • Average queue wait time by hour
  • Ticket cancellation rate
  • Server allocation failures per region

Load Simulation

Spin up 500 bot clients using Unity's Netcode test framework. Stress test matchmaking under realistic player distribution across skill tiers and regions.

  • Locust.io for HTTP traffic
  • Custom Unity headless client for game traffic
  • Grafana dashboards for real-time metrics

Reconnection Architecture

1

Client Disconnect Detection

Monitor NetworkManager.OnClientDisconnectCallback. Distinguish between intentional quit and network hiccup using timeout threshold (default 5s is too short for mobile).

2

Server State Persistence

Serialize critical NetworkVariables to Redis with 5-minute TTL. Include player position, inventory, match timer, and turn state for card games.

3

Rejoin Handshake

Client reconnects with same PlayFab session token. Server validates token, retrieves state from Redis, and sends full snapshot via RPC before resuming tick updates.

4

State Reconciliation

Client applies server snapshot, discards local prediction buffer, and re-syncs NetworkTransform positions. Critical for preventing desync in fast-paced games.

GSDK Integration Checklist

Build Configuration

  • Headless Unity build with -batchmode -nographics flags
  • GSDK NuGet package installed and referenced
  • GameserverSDK.Start() called in server bootstrap
  • ReadyForPlayers() triggered after scene load
  • Heartbeat interval set to 15s (default 30s causes timeouts)

Lifecycle Hooks

  • OnShutdown: Gracefully disconnect clients, save state
  • OnMaintenance: Reject new connections, finish current match
  • OnHealthCheck: Return true only if NetworkManager is active
  • LogMessage: Forward Unity Debug.Log to PlayFab telemetry

Deployment Pipeline

  • GitHub Actions builds Linux x64 binary
  • Zip artifact with GSDK config JSON
  • Upload to PlayFab via MultiplayerAPI.UploadAsset
  • Create new build with updated asset reference
  • Roll out to 10% of fleet, monitor crash rate

Diagnostic Tooling

Custom PlayFab CLI

Python scripts to bulk-query matchmaking tickets, server logs, and player session history. Faster than web dashboard for production incidents.

Netcode Profiler

Unity package that visualizes NetworkVariable sync frequency, RPC call counts, and bandwidth per NetworkObject. Essential for optimization.

Redis Inspection UI

Web interface for browsing cached game state, session tokens, and reconnection snapshots. Built with ASP.NET Core + StackExchange.Redis.

Load Test Harness

Headless Unity client that spawns 100+ bot players, simulates realistic input patterns, and reports metrics to InfluxDB for time-series analysis.

Ship Stable Multiplayer for Beta

This methodology has fixed matchmaking and reconnection across 12 live games. Your card game is next.

Back to Solutions