Jump to content

Unity.Multiplayer/SPEC

From MindAttic Docs

Unity.Multiplayer — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

Place in the ecosystem: An engine kit (docs/ECOSYSTEM.md §2.1): the netcode every MindAttic Unity game uses.

Unity.Multiplayer (com.mindattic.unity.multiplayer) is the kit every MindAttic Unity game uses for multiplayer. A game marks methods [ToServer] / [ToClients] / [ToOwner] / [ToClient] and fields [Synced], and runs as a host, a dedicated server or a client from the same code, joined by IP or a join code. With MindAttic Components and Unity.Shared it is a one-stop shop: menus, roster, votes, keyed objects, bots, a test kit, the mp-host deploy CLI and a New Game wizard. It is for MindAttic's game developers (today Unity.Cursory and the seven Unity.Rea.* games). The finished product is release 3: the work already built plus Unity Relay for a home host, bug-hunted, with every consuming game compiling and the docs current.

2. Scope boundary

2.1 In the product

  • Server-authoritative sessions on Netcode for GameObjects, with reconnectable seats.
  • Attribute RPCs and synced fields from a compile-time source generator, and keyed networked objects.
  • Join codes: rendezvous for dedicated servers, Unity Relay for a home host.
  • The game kit: drop-in front end, player roster, votes, bots, test kit, network-condition simulation, editor tooling, samples and the New Game wizard.
  • Hosting: the server package and mp-host with its provider profiles and per-match allocators.
  • CI, the nightly smoke test, docs and versioned releases.

2.2 Never in the product

  • Another netcode engine or backend. NGO and Unity Transport do the transport; this package is the API and policy on top (BIBLE §3). A new backend would mean rewriting the adapter.
  • Client-side prediction or client authority. The server owns state (UM-LAW-1).
  • Reflection-based RPC discovery. Plumbing is generated at compile time (BIBLE §3).
  • More matchmaking or hosting providers than the VPS, big-cloud, Fly.io, Edgegap and GameLift profiles it has. G-Portal and Nitrado were considered (RFC 0001, UM-T21/T22) and dropped.
  • Kit features no consuming game asked for. The kit grows only from a game's real need.
  • A DocFX site on GitHub Pages. The Page is the brochure (UM-T106); the docs are published to the MindAttic wiki.

3. Users and roles

  • Game developer — builds a networked game on the kit.
  • Player — hosts, joins by IP or code, reconnects to the same seat.
  • Server operator — deploys and runs dedicated servers with mp-host.
  • Bot / CI — headless clients and suites that prove a build end to end.
  • Owner — cuts releases and signs off with a consuming game.

4. Requirements

Status is built (closed ticket, with evidence) or MS-37, the active milestone, which is also the finished product.

E1. Networking core — UM-T108 — built

Server-authoritative sessions, RPCs, synced state and join codes over NGO.

F1.1 Sessions and seats — UM-T109 — built

  • S1.1.1 Session contracts — UM-T5 — built As a game developer, I want one NetConfig and a session state machine for host, server and client, so that the topology is configuration, not code. Acceptance:
    • Given a NetConfig, when it is validated, then a bad port, tick rate or player count is refused. Evidence: NetConfigTests, SessionStateMachineTests.
  • S1.1.2 Connection approval payload — UM-T7 — built As a server, I want a versioned payload with game version, protocol hash and identity, so that I can refuse mismatched clients with a clear reason. Acceptance:
    • Given a client on another game version, when it connects, then it is refused with "version mismatch". Evidence: ConnectionApprovalValidatorTests.
  • S1.1.3 NGO adapter — UM-T8 — built As a game developer, I want NetSession and NetBootstrap to start a host, server or client, so that I never touch NGO directly. Acceptance:
    • Given a host and two clients over UDP or WebSocket, when they connect, then each reaches Connected. Evidence: HostAndClientTests, ServerAndClientsTests.
  • S1.1.4 Seats and reconnects — UM-T9 — built As a player, I want to get my seat and player object back after a drop, so that a reconnect doesn't lose my place. Acceptance:
    • Given a dropped client, when it reconnects within the grace period, then it reclaims the same seat and object. Evidence: ApprovalAndSeatTests.

F1.2 RPCs and synced state — UM-T110 — built

  • S1.2.1 Entities and RPCs — UM-T10 — built As a game developer, I want NetEntity and RPCs in every direction with ownership and rate limits, so that networked behaviour is safe by default. Acceptance:
    • Given a non-owner, when it calls an owner-only [ToServer] method, then the server refuses it. Evidence: EntityRpcTests, SceneFlowTests.
  • S1.2.2 Source generator and analyzers — UM-T11 — built As a game developer, I want RPC plumbing generated at compile time with clear diagnostics, so that I write only partial methods and fields. Acceptance:
    • Given a [Synced] field written directly, when the game compiles, then MAMP006 reports an error. Evidence: tests/Generators.Tests.
  • S1.2.3 Objects by key — UM-T60 — built As a game developer, I want to find a networked object by my own key on every peer, so that I never depend on spawn order. Acceptance:
    • Given a keyed object spawned on the server, when a late joiner connects, then NetSession.Objects finds it by key. Evidence: NetRegistryTests.

F1.3 Join codes — UM-T111 — built

  • S1.3.1 Join-code format — UM-T6 — built As a player, I want a short code that catches typos, so that I join the right game. Acceptance:
    • Given a code with one wrong character, when parsed, then the check character rejects it. Evidence: JoinCodeTests.
  • S1.3.2 Rendezvous service — UM-T12 — built As a server operator, I want a service that maps a code to a server's address, so that players join by code. Acceptance:
    • Given a registered server, when its code is resolved, then the address and port come back until the TTL ends. Evidence: tests/Rendezvous.Tests.
  • S1.3.3 Join codes at runtime — UM-T13 — built As a game developer, I want HostWithCode and JoinByCode, so that join codes work with one call. Acceptance:
    • Given a dedicated server with a rendezvous URL, when it runs, then it registers and keeps its code alive. Evidence: JoinByCodeTests.
  • S1.3.4 Nine-character codes — UM-T32 — built As a player, I want codes shown as ABC-EFG-HJK, so that they are easy to read out. Acceptance:
    • Given a new code, when shown, then it has 9 characters in three groups. Evidence: JoinCodeTests.
  • S1.3.5 Unity Relay for a home host — UM-T71 — built As a host at home, I want Relay join codes with clear setup messages, so that friends join without port forwarding. Acceptance:
    • Given an unlinked project, when I host with a code, then the front end says exactly what to set up. Evidence: 67d4f11, RelaySetupTests.

E2. The game kit — UM-T112 — built

Everything a new game needs.

F2.1 Front end, players and votes — UM-T113 — built

  • S2.1.1 Drop-in front end — UM-T48 — built As a game developer, I want one component that gives menus, lobby, dialogs and reconnects, so that every game starts the same way. Acceptance:
    • Given NetFrontEnd in a scene, when I host from the menu, then the lobby shows the code and the roster. Evidence: Unity.Multiplayer.UI.Tests.
  • S2.1.2 Player roster — UM-T55 — built As a player, I want everyone's name, colour and ping on every peer, so that I know who is playing. Acceptance:
    • Given a rename mid-game, when the server accepts it, then every peer's roster shows the new name. Evidence: RosterTests.
  • S2.1.3 Votes kit — UM-T54 — built As a game developer, I want server-run votes with quorum, timeout and an overlay, so that players decide together. Acceptance:
    • Given a vote, when the quorum becomes unreachable, then it is rejected at once. Evidence: VoteBoxTests, VoteBoardTests.

F2.2 Bots and testing — UM-T114 — built

  • S2.2.1 Test kit — UM-T56 — built As a game developer, I want free ports and a session test base, so that my PlayMode tests run in parallel. Acceptance:
    • Given two test runs on one machine, when they start, then they bind different free ports. Evidence: Unity.Multiplayer.Testing.
  • S2.2.2 Network conditions — UM-T14 — built As a game developer, I want latency, jitter and loss profiles, so that I test on a bad network. Acceptance:
    • Given the Lossy profile, when 40 reliable calls are sent, then each arrives once and in order. Evidence: LossyNetworkTests.
  • S2.2.3 Bots and end-to-end smoke — UM-T57 — built As the owner, I want -bot clients and mp-host game smoke, so that any game is proven end to end. Acceptance:
    • Given a server and two bots, when the smoke runs, then both bots log OK. Evidence: NetBotTest, game-smoke.yml.

F2.3 New games — UM-T115 — built

  • S2.3.1 Editor tooling — UM-T15 — built As a game developer, I want Set Up Scene, Validate Prefabs and Build Dedicated Server, so that networking a scene is one click. Acceptance:
    • Given an open scene, when I run Set Up Scene twice, then the second run changes nothing. Evidence: NetSceneSetupTests, DedicatedServerBuildTests.
  • S2.3.2 Minimal sample — UM-T16 — built As a new developer, I want a minimal sample with a 10-minute walkthrough, so that I learn the kit fast. Acceptance:
    • Given the imported sample, when I host, then the player spawns, moves and bumps the wall. Evidence: tests/run-sample.ps1.
  • S2.3.3 New Game wizard — UM-T59 — built As a game developer, I want MindAttic ▸ Multiplayer ▸ New Game, so that an empty project becomes a working networked game. Acceptance:
    • Given a fresh project, when the wizard runs, then the new game's tests pass and its smoke run is OK. Evidence: NewGameTests, tests/run-new-game.ps1.
  • S2.3.4 Multiplayer-ready standard — UM-T74 — built As a game developer, I want a written standard, so that a single-player game can add co-op later without re-architecting. Acceptance:
    • Given docs/articles/multiplayer-ready.md, when a game follows it, then it adopts the kit without restructuring. Evidence: 1056d3b.

E3. Hosting and delivery — UM-T116 — built

mp-host deploys any game to any provider; CI, docs and releases.

F3.1 Hosting pipeline — UM-T117 — built

  • S3.1.1 Server package and hosting profiles — UM-T23 — built As a server operator, I want one provider-neutral server package, so that choosing a host never changes game code. Acceptance:
    • Given any profile, when the package is built, then it runs the same server image.
  • S3.1.2 mp-host deploy CLI — UM-T25 — built As a server operator, I want one mp-host pipeline, so that every provider deploys the same way. Acceptance:
    • Given a profile, when I run mp-host deploy, then it provisions, uploads and starts the server.
  • S3.1.3 Plain VPS providers — UM-T26 — built As a server operator, I want Hetzner, Vultr, DigitalOcean, Linode and OVHcloud profiles, so that cheap hosts work. Acceptance:
    • Given a VPS profile, when I deploy, then the server comes up by cloud-init.
  • S3.1.4 Big-cloud providers — UM-T27 — built As a server operator, I want AWS, Google Compute Engine and Azure VM profiles, so that big clouds work too. Acceptance:
    • Given a big-cloud profile, when I deploy, then the VM runs the server.
  • S3.1.5 Fly.io — UM-T28 — built As a server operator, I want a Fly.io profile with a UDP service, so that edge hosting works. Acceptance:
    • Given the Fly profile, when I deploy, then fly.toml exposes the UDP port.
  • S3.1.6 Per-match allocation — UM-T29 — built As a server operator, I want an allocator contract with Edgegap, so that a server can be requested per match. Acceptance:
    • Given a match request, when the allocator answers, then the game gets a server address.
  • S3.1.7 GameLift — UM-T30 — built As a server operator, I want an AWS GameLift profile, so that GameLift fleets can host the game. Acceptance:
    • Given the GameLift define, when the server starts, then it registers with GameLift.
  • S3.1.8 Free and home hosting — UM-T31 — built As a host at home, I want mp-host local up and LAN join, so that I host for free. Acceptance:
    • Given mp-host local up, when it runs, then a local server is joinable on the LAN.
  • S3.1.9 Deploy any game — UM-T58 — built As a server operator, I want mp-host game deploy|local|status|logs|destroy --project, so that no game needs its own deploy script. Acceptance:
    • Given a game's mp-host.json, when I run mp-host game local, then its server runs.

F3.2 CI, docs and releases — UM-T118 — built

  • S3.2.1 CI and nightly smoke — UM-T17 — built As the owner, I want CI on every push and a nightly smoke under Docker Compose, so that breakage is caught. Acceptance:
    • Given a push, when CI runs, then the .NET suites and the Unity suites run.
  • S3.2.2 Hosting guide — UM-T18 — built As a server operator, I want a hosting guide, so that I can pick and set up a host. Acceptance:
    • Given docs/articles/hosting.md, when I follow it, then I can host on any supported provider.
  • S3.2.3 Documentation — UM-T19 — built As a game developer, I want guides and an API reference, so that I can learn the kit without reading its source. Acceptance:
    • Given docs/articles, when published, then every guide and the API reference are readable.
  • S3.2.4 Release v1.0.0 — UM-T20 — built As a game developer, I want a tagged, changelogged release, so that I build on a known version. Acceptance:
    • Given the v1.0.0 tag, when I check out the package, then CHANGELOG.md describes it. Evidence: v1.0.0, v2.0.0 (UM-T59).

E4. Media.Capture name — UM-T95 — built

The CI docs name MindAttic.Media.Capture among the private repos (UM-T96, 7afd5f4).

E5. Stable kit — UM-T97 — MS-37

The package is bug-hunted and every consuming game compiles against main.

F5.1 Kit without known bugs — UM-T99 — MS-37

  • S5.1.1 Exhaustive bug hunt — UM-T94 — MS-37 As a game developer, I want the kit's real bugs found and fixed, so that release 3 is solid. Acceptance:
    • Given the package, server and mp-host, when the hunt ends, then every confirmed bug is fixed under its own ticket.

F5.2 Consumers compile — UM-T100 — MS-37

  • S5.2.1 Consumer compile pass — UM-T103 — MS-37 As the owner, I want Unity.Cursory and the seven Unity.Rea.* games batch-compiled against main, so that release 3 breaks nobody. Acceptance:
    • Given each consuming game, when it is compiled in batch mode, then it builds with no errors.

E6. Polish and release 3 — UM-T98 — MS-37

The Unreleased work ships as whole-number release 3 with current docs. This epic is the release's polish and release step.

F6.1 Version and changelog — UM-T101 — MS-37

  • S6.1.1 Cut release 3 — UM-T104 — MS-37 (requires UM-T94, UM-T103) As a game developer, I want version 3.0.0 with a dated [3] changelog section and a tag, so that games pin it. Acceptance:
    • Given the package, when released, then package.json is 3.0.0 and CHANGELOG.md has [3].

F6.2 Documentation describes release 3 — UM-T102 — MS-37

  • S6.2.1 Docs current for release 3 — UM-T105 — MS-37 (requires UM-T104) As a game developer, I want docs/overview.md and the articles to describe release 3, so that the wiki matches the package. Acceptance:
    • Given release 3, when the docs are read on the wiki, then the status, Roadmap, join codes and multiplayer-ready pages describe it.

5. Non-functional requirements

  • Engine-free Core (netstandard2.1, C# 9), tested with dotnet test without the editor.
  • Generator output is C# 9 so it compiles on every Unity 6 compiler (UM-LAW-3).
  • Only the adapter imports Unity.Netcode (UM-LAW-2).
  • Transports: UDP and WebSocket; Relay over DTLS or wss.
  • Security: rendezvous secret required outside development, fixed-time token compare, per-IP rate limits; hosting credentials in MindAttic.Vault, never in the repo.
  • Versioning: whole-number versions (HOUSE-LAW-1).

6. Interfaces and dependencies

  • Platform owners it relies on (docs/ECOSYSTEM.md): credentials (mp-host): MindAttic.Vault; UI: MindAttic.Components; profiles: Unity.Shared.
  • Uses: Netcode for GameObjects 2.x, Unity Transport 2.x, Unity Services Multiplayer (Relay), MindAttic Components (front end), Unity.Shared (profiles), MindAttic.Vault (mp-host credentials).
  • Used by: Unity.Cursory, Unity.Rea.Chain, Unity.Rea.Hare, Unity.Rea.Incognito, Unity.Rea.Overworld, Unity.Rea.ProjectVania, Unity.Rea.QuickDuel, Unity.Rea.Ricochet, by file: path from the sibling checkout.
  • Contract: game code talks only to NetSession, NetEntity, NetSender and the attributes.

7. Release sequence

  1. MS-37 — Unity.Multiplayer 3: the Relay release its games build on (active). Epics UM-T97 Stable kit (900) and UM-T98 Release 3 (800), its polish-and-release step. Reaching it finishes the product: the kit is complete, and it grows again only when a consuming game needs something.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from the BIBLE, RELEASE, RFC 0001, CHANGELOG, articles, code and the ticket history; release 3 is the finished product; docs move from the DocFX Page to the wiki (UM-T102/T105 reworded) MAT-T395
2026-11-30 MAT-T462 single-source pass: 3 renamed, 0 buckets, 3 requires added; place in the ecosystem and platform owners named MAT-T467
From Unity.Multiplayer/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.