TExcelTAD
Home › Multiplayer Game Networking › Steamworks, EOS, Nakama & PlayFab

Steamworks, EOS, Nakama & PlayFab

A multiplayer game needs more than netcode: player identity, friends and lobbies, matchmaking, NAT traversal or relays, server hosting, stats, leaderboards and storage. You can build each one (this course shows how most of them work), but small teams usually rent or install them. This lesson surveys four widely used options, what each is good for, and how they plug into the architecture from Lobbies & Matchmaking and Dedicated Servers & Hosting.

Note: Prices, quotas, revenue terms and platform rules change. Every statement about cost below is general; read the current terms before you commit.

Steamworks

The SDK for games sold on Steam. Its multiplayer parts:

Feature What it gives you
Lobbies (ISteamMatchmaking) create/join/search lobbies with key-value metadata, lobby chat, invites through the Steam friends list
Steam Networking Sockets (ISteamNetworkingSockets, ISteamNetworkingMessages) reliable and unreliable messages over UDP, encryption, and relayed connections
Steam Datagram Relay (SDR) traffic routed through Valve's network: no port forwarding, players' IP addresses stay hidden, works for P2P and dedicated servers
Game server API dedicated servers that appear in the server browser and can verify players
Auth session tickets a client gets a ticket from Steam; your server verifies it (with the game server API or Valve's Web API) to learn the player's SteamID
Stats, achievements, leaderboards, Workshop, Cloud saves per-game services

Strengths: free to use for games on Steam, friends and invites "just work", SDR solves NAT and DDoS exposure for P2P games. Limits: tied to Steam players, so cross-platform play with consoles or mobile needs another identity layer. The older ISteamNetworking API is deprecated; use the Networking Sockets interfaces. Engine integrations exist for Unreal (the Steam online subsystem), Godot (GodotSteam, community) and Unity (Steamworks.NET or Facepunch.Steamworks, community).

Epic Online Services (EOS)

A cross-platform service suite from Epic that works with any engine and any store, not only Epic's. Epic describes the core services as free of charge.

Interface Use
Connect a game-scoped player id linked to platform accounts (Steam, consoles, Apple, Google, device id), the basis for cross-play
Auth sign-in with an Epic account (optional)
Lobbies / Sessions player-hosted lobbies with attributes, and server sessions with matchmaking search
P2P NAT-traversed peer connections with relay fallback
Easy Anti-Cheat client anti-cheat (see Cheat Types & Anti-Cheat)
Player/Title Data Storage, Stats, Leaderboards, Achievements, Voice the usual live features

Strengths: cross-platform identity and cross-play, P2P relay, anti-cheat, free core services. Unreal has the Online Services/Online Subsystem EOS plugins; Unity and Godot use the C SDK or community wrappers.

Nakama (Heroic Labs)

An open-source game server written in Go that you can run yourself (one binary plus a database such as PostgreSQL or CockroachDB) or rent as Heroic Cloud. It bundles accounts (device, email, Steam, Apple, Google, custom), friends, groups, chat, storage, leaderboards, tournaments, parties, a matchmaker, and real-time multiplayer.

Its standout feature for this course: authoritative matches written in TypeScript, Go or Lua. You implement a match handler with functions such as matchInit (where you set the tick rate), matchJoinAttempt, matchJoin, matchLeave, matchLoop (called every tick with the queued client messages), matchTerminate and matchSignal:

ts
// Nakama TypeScript runtime: a sketch of an authoritative match
const matchInit: nkruntime.MatchInitFunction<State> = (ctx, logger, nk, params) => {
  return { state: { players: {} }, tickRate: 20, label: JSON.stringify({ mode: "arena" }) };
};

const matchLoop: nkruntime.MatchLoopFunction<State> = (ctx, logger, nk, dispatcher, tick, state, messages) => {
  for (const m of messages) {
    // m.sender.userId, m.opCode, m.data: validate and apply inputs
  }
  dispatcher.broadcastMessage(OP_SNAPSHOT, encodeSnapshot(state));
  return { state };                       // returning null ends the match
};

Strengths: one server for both backend features and simple authoritative gameplay, self-hostable (no per-player fees when you run it), every engine has a client SDK. Limits: a match loop in a scripting runtime suits low-to-moderate tick rates and simple physics; a 60 Hz shooter still wants a dedicated engine server, with Nakama doing accounts and matchmaking.

PlayFab (Microsoft, Azure PlayFab)

A managed backend (LiveOps) with a strong multiplayer section:

Feature Use
Multiplayer Servers hosts your dedicated server builds (Windows or Linux containers) on Azure, scales them up and down by region; your server integrates the GSDK to report health and readiness
Matchmaking queues with rules (skill, latency, team sizes); clients create tickets, PlayFab forms matches and can allocate a server for them
Lobby persistent or temporary groups with properties and search
Party networking and voice/text chat for groups
QoS beacons clients measure latency to each Azure region, so matchmaking can pick a nearby one
Player data, economy, leaderboards, CloudScript (Azure Functions) LiveOps features

Strengths: dedicated server hosting and matchmaking in one place. Limits: a hosted service with usage-based billing; plan the costs of always-on servers.

How they combine

Need Typical choice
Steam-only co-op, 2–8 players, host is a player Steam lobbies + Steam Networking Sockets with SDR
Cross-platform casual game, P2P EOS Connect + Lobbies + P2P
Self-hosted backend, turn-based or slow real-time Nakama with authoritative matches
Competitive game with dedicated servers your engine server + PlayFab Multiplayer Servers/Matchmaking (or another host), identity from the platforms
Your own ecosystem accounts an OIDC provider like TAD (Accounts & Sign-In) plus any of the above for transport and hosting

A model of a matchmaking ticket

PlayFab, EOS sessions, Nakama and most hosted matchmakers share the ticket pattern: the client creates a ticket with its attributes (skill, measured latency per region), then polls its status, and the service widens the search over time. Services throttle API calls, so a client that polls too fast gets 429 Too Many Requests. The model shows a ticket matching after its skill window widens, and a client-side token bucket that keeps polls within the allowed rate.

ts · try it yourself
interface Ticket { id: string; skill: number; region: string; created: number }

const queue: Ticket[] = [
  { id: 'ana', skill: 1500, region: 'eu', created: 0 },
  { id: 'bo',  skill: 1720, region: 'eu', created: 2 },
  { id: 'cy',  skill: 1490, region: 'us', created: 3 },
];
const windowAt = (age: number) => 100 + 25 * age;        // skill window widens by 25 per second

function tryMatch(now: number): string | null {
  for (let i = 0; i < queue.length; i++)
    for (let j = i + 1; j < queue.length; j++) {
      const a = queue[i], b = queue[j];
      if (a.created > now || b.created > now) continue;    // ticket not submitted yet
      const allowed = Math.min(windowAt(now - a.created), windowAt(now - b.created));
      if (a.region === b.region && Math.abs(a.skill - b.skill) <= allowed) {
        queue.splice(j, 1); queue.splice(i, 1);
        return `${a.id} + ${b.id} (diff ${Math.abs(a.skill - b.skill)}, window ${allowed})`;
      }
    }
  return null;
}

// Client side: a token bucket allows 1 poll per 2 s with bursts of 2.
let tokens = 2, last = 0;
const RATE = 0.5, BURST = 2;
function mayPoll(now: number): boolean {
  tokens = Math.min(BURST, tokens + (now - last) * RATE);
  last = now;
  if (tokens >= 1) { tokens -= 1; return true; }
  return false;
}

for (let t = 0; t <= 9; t++) {
  const waitingBefore = queue.some((q) => q.id === 'ana');
  const win = waitingBefore ? String(windowAt(t)) : '-';       // ana's ticket was created at t=0
  const matched = tryMatch(t);                                  // the service runs every second
  // ana's impatient client wants to poll every second while it waits
  const poll = waitingBefore && t >= 2 ? (mayPoll(t) ? 'poll' : 'wait (bucket empty)') : '-';
  const waiting = queue.filter((q) => q.created <= t).map((q) => q.id).join(',') || 'none';
  console.log(`t=${t}s  ana's window ${win.padStart(3)}  ${poll.padEnd(19)} ${matched ? 'MATCH ' + matched : 'waiting: ' + waiting}`);
}
t=0s  ana's window 100  -                   waiting: ana
t=1s  ana's window 125  -                   waiting: ana
t=2s  ana's window 150  poll                waiting: ana,bo
t=3s  ana's window 175  poll                waiting: ana,bo,cy
t=4s  ana's window 200  poll                waiting: ana,bo,cy
t=5s  ana's window 225  wait (bucket empty) waiting: ana,bo,cy
t=6s  ana's window 250  poll                waiting: ana,bo,cy
t=7s  ana's window 275  wait (bucket empty) MATCH ana + bo (diff 220, window 225)
t=8s  ana's window   -  -                   waiting: cy
t=9s  ana's window   -  -                   waiting: cy

ana and bo match once the narrower of their two windows (bo joined later) reaches their skill difference of 220, while cy (the only player in its region) keeps waiting however wide the window gets. Meanwhile the client's own bucket spaces out its polls, so the service never has to reject it. Real services add more (team sizes, backfill, a server allocation step), but the shape is the same.

Test yourself

What does Steam Datagram Relay give a peer-to-peer Steam game?

  1. Free dedicated servers
  2. Relayed connections through Valve's network, so players needn't forward ports and their IP addresses stay hidden
  3. Client-side prediction
  4. Cross-play with consoles

In Nakama's authoritative multiplayer, where do you set how often the match loop runs?

  1. In the client SDK
  2. In matchInit, by returning a tick rate
  3. In PostgreSQL
  4. It is fixed at 60 Hz

Why does a well-behaved matchmaking client rate-limit its own status polls?

  1. To save battery only
  2. Hosted services throttle API calls and answer 429 when a client polls too fast
  3. Tickets expire when polled
  4. Polling resets the skill window