Multiplayer

On this page

Gully Studio online games use a server-authoritative setup: FishNet for netcode, headless Linux dedicated servers that run the simulation, and Nakama as the backend for accounts, matchmaking, leaderboards and storage. Everything runs on Gully infrastructure.

Text
Unity client ──Gully ID token──▶ Nakama (custom auth)  ── session, matchmaker ticket
     │                              │
     │                              └── match found: server address + join token
     ▼
FishNet client ──UDP──▶ dedicated server (StandaloneLinux64, headless)
                              │
                              └── reports results to Nakama (leaderboards, storage)
                                  and to Gully Chain (quests, scores) when needed

Coming soon

The first FPS project (FishNet netcode, Nakama backend, dedicated servers, Gully ID login, Gully Quests achievements) is being built in a private repo now. The first FPS project's repo links appear here when it lands.

#Netcode: FishNet

The studio template's Packages/manifest.json ships Netcode for GameObjects and Unity Transport as defaults. The FPS foundation swaps to FishNet: server-authoritative, client-side prediction and lag compensation suited to a shooter. A project picks one netcode and removes the other; do not ship both.

Rules for either:

  • The server owns game state: health, hits, scores, inventory changes. Clients send inputs, not results.
  • Anything that grants value (a quest completion, a reward, a purchase) is decided on the server.
  • Network prefabs are listed under Assets/_Project/Netcode/.

#Dedicated servers

Servers are the same Unity project built for StandaloneLinux64 as a headless server build. The template's CI already builds the Linux target (see Release and CI).

Run a server without graphics:

Shell
./Game.x86_64 -batchmode -nographics -logFile -
  • Strip client-only code and assets from server builds with scripting defines and #if UNITY_SERVER.
  • One process per match; the orchestrator starts and stops them.
  • Servers bind to the box's private network; players reach them through the UDP proxy, never through an open port on every process.

#Backend: Nakama

The backend is the Gully Labs fork of Heroic Labs Nakama, gully-labs/nakama (opens in a new tab) (Apache-2.0).

Nakama feature Use
Custom authentication the game sends its Gully ID token; a server hook verifies it against Gully ID's JWKS and maps sub to the Nakama user
Matchmaker queue players, then hand them a dedicated server
Leaderboards per-season rankings (on-chain scores stay on Gully Chain)
Storage inventory, settings, progression, written only by the server
Metrics Prometheus endpoint with sessions, presences and authoritative matches

Players never get a raw Nakama account without a verified Gully ID behind it. See Gully ID for what the server checks.

#Fleet and matchmaking at scale

For more than a handful of servers, Gully Labs keeps forks of the standard open-source pieces:

Repo What
gully-labs/agones (opens in a new tab) game server hosting and scaling on Kubernetes
gully-labs/quilkin (opens in a new tab) UDP proxy in front of game servers
gully-labs/open-match (opens in a new tab) matchmaking framework for larger player pools

Nakama's built-in matchmaker is enough to start; Open Match and Agones come in when the fleet needs them.

#Where it runs

All studio services run on Gully-operated boxes under the same rules as every Gully product:

  • only Gully containers on Gully boxes;
  • service ports bound to localhost or the private Docker network, with Caddy as the only public HTTP entry point;
  • game UDP traffic through the proxy, not through ports opened per process;
  • secrets (Nakama server key, database passwords, signer keys) live in each service's environment on the box, never in a repo or a client build.

#On-chain pieces in a multiplayer game

  • Achievements: Gully Quests. The player completes them from their own account; the server can tell the client when a quest is ready.
  • Scores: the server decides the score; on-chain submission goes through an attestation, as with Gully Arcade.
  • Items and purchases: Payments, granted by the server from verified Gully Pay webhooks.