Unity.Multiplayer/BIBLE
MindAttic.Unity.Multiplayer — Project Bible
Single source of truth for what MindAttic.Unity.Multiplayer IS, is NOT, and the rules that keep it coherent. README says how to use it; RFC 0001 holds the design and build order; this says how to think about the system.
Status legend: ✅ done (verified by a test/build) · 🟡 partial · ⬜ planned · living.
1. The one sentence
MindAttic.Unity.Multiplayer is a Unity 6 package that gives any MindAttic game server-authoritative multiplayer, written as attribute-decorated partial methods and fields, in either a listen-server or a dedicated-server topology, joined by IP:port or a join code.
2. The product promise
- A game adds one local package and one
NetBootstrapcomponent, marks methods[ToServer]/[ToClients]/[ToOwner]/[ToClient]and fields[Synced], and is networked. - The same game code runs as host, dedicated server or client; the topology is configuration, not code.
- A player who drops and reconnects gets the same seat back.
- With MindAttic Components and Unity.Shared it is one kit, a one-stop shop: MindAttic ▸ Multiplayer ▸ New Game… turns an empty project into a working networked game with menus, votes, keyed objects, a bot, tests and a deploy config (kit).
3. What it is NOT
- NOT a netcode engine. Netcode for GameObjects 2.x and Unity Transport 2.x do the transport and replication; this package is the API and policy on top.
- NOT client-authoritative. There is no client-side prediction of shared state; see UM-LAW-1.
- NOT reflection-based. RPC plumbing is generated at compile time by the package's source generator, never discovered at runtime.
4. Architecture canon
The full layout lives in RFC 0001 § Architecture and is not repeated here (UM-LAW-4). The assembly boundary that the laws below depend on:
MindAttic.Unity.Multiplayer.Core Runtime/Core noEngineReferences; no UnityEngine, no Unity.Netcode
▲
MindAttic.Unity.Multiplayer Runtime the NGO adapter: the only runtime assembly that imports Unity.Netcode
▲
MindAttic.Unity.Multiplayer.UI Runtime/UI optional drop-in front end (only with MindAttic Components); NetBootstrap/NetSession only, no Unity.Netcode
MindAttic.Unity.Multiplayer.Editor Editor editor tooling
MindAttic.Unity.Multiplayer.Testing Testing the test kit games reference from their PlayMode tests (Editor and test builds only)
MindAttic.Unity.Multiplayer.Tests Tests/Runtime PlayMode suites, on the test kit's NetSessionTest
MindAttic.Unity.Multiplayer.UI.Tests Tests/UI PlayMode suites for the front end
MindAttic.Unity.Multiplayer.Editor.Tests Tests/Editor EditMode suites for the editor tooling
game code (consumer) talks to NetSession / NetEntity / attributes only
5. The Laws
MindAttic.Unity.Multiplayer inherits the org-wide house rules in ../../MindAttic.HouseRules.md. Of note here: [HOUSE-LAW-1] (whole-number versioning: the package is 0.0.0 until the v1.0.0 tag in UM-T20), [HOUSE-LAW-8] (done is verified, not asserted), [HOUSE-LAW-13] (LF-only, enforced by the root .gitattributes).
Project-specific laws:
UM-LAW-1 — The server owns state
Every piece of shared game state is written only on the server. Clients send intent ([ToServer] calls); the server validates it, applies it and replicates the result ([Synced] fields, [ToClients] / [ToOwner] / [ToClient] calls). A client never asserts an authoritative value, and the generator and analyzers reject client writes to [Synced] state.
UM-LAW-2 — Nothing above the NGO adapter imports Unity.Netcode
Unity.Netcode (and Unity.Networking.Transport) are referenced only by the adapter assembly MindAttic.Unity.Multiplayer and its Editor, Tests and Testing (test kit) companions. MindAttic.Unity.Multiplayer.Core is engine-free (noEngineReferences), and game code sees only MindAttic types (NetSession, NetEntity, NetSender, the attributes). Generated code is the one sanctioned exception: it is emitted into the game's assembly by the generator and is not hand-written there. Swapping the backend means rewriting the adapter, nothing else.
UM-LAW-3 — Generator output is C# 9
The source generator emits only C# 9 constructs (extended partial methods, no file-scoped namespaces, no record structs, no required, no raw string literals), so its output compiles on every Unity 6 compiler. It targets netstandard2.0 against Microsoft.CodeAnalysis.CSharp 4.3.x.
UM-LAW-4 — One home per fact
Every fact lives in exactly one place and everything else links to it. Dependency versions live in package.json; the design and ticket order live in RFC 0001; laws live here; story status lives in USER_STORIES.md. A second copy is a bug.
6. Verified state
- ✅ Package skeleton (UM-T3):
package.json, the four asmdefs, LICENSE,.gitattributes. - ✅ Generator approach proven (UM-T4, RFC 0002): a netstandard2.0 / Roslyn 4.3.1
IIncrementalGeneratoremits[Rpc(SendTo.Server)]stubs andNetworkVariables from C# 9 partial methods and fields; NGO ILPP processes them; host+client and an IL2CPP Linux Dedicated Server run them. Decision: GO, no fallback. - ✅ Core session contracts (UM-T5):
NetConfig(topology, address, port, transport, tick rate 30, max players, game version,Validate),SessionStateMachine(Host/ServerIdle → Starting → Running → Stopping → Idle; ClientIdle → Connecting → Connected → Disconnectedwith aDisconnectReason), and theITickClockcontract withManualTickClock. Verified bydotnet test tests/Core.Tests(NetConfigTests, SessionStateMachineTests, ManualTickClockTests);tests/Core.Buildcompiles the same sources as netstandard2.1 / C# 9. - ✅ Join codes (UM-T6):
JoinCode/JoinCodeFormat(9 characters shown asABC-EFG-HJK: 8 data characters = 40 bits from a 32-symbol alphabet without 0, O, 1 or I, plus a Damm check character over GF(32) that catches every single substitution and every neighbour swap; parse ignores case and separators and corrects one look-alike the check confirms),JoinTarget(endpoint or relay allocation) and theIJoinCodeServicecontract (PublishAsync→ code,ResolveAsync→ target or null, idempotentRevokeAsync) withInMemoryJoinCodeService. Verified bydotnet test tests/Core.Tests(JoinCodeTests, JoinTargetTests, InMemoryJoinCodeServiceTests). Default length and 3-3-3 grouping set by UM-T32. - ✅ Connection approval payload (UM-T7):
ConnectionPayload{game version, protocol hash, player token, display name,PlayerColor} withConnectionPayloadCodec(versioned binary format 1: magicMA, version byte, game version first in every format so an unreadable newer payload still reports a version mismatch; strict, never-throwing decode),ConnectionApprovalValidatorproducing anApprovalDecisionwith a typedApprovalRejection(BadPayload→VersionMismatch→ProtocolMismatch→Banned→Full) and a wire reason string the client parses back,IBanList/InMemoryBanList, and the protocol-hash contract the generator fills:ProtocolHash.Compute(64-bit FNV-1a over the domain line plus sorted, de-duplicated signatures) emitted as[assembly: NetProtocol(hash, count)]and read byProtocolHash.FromAssemblies. Verified bydotnet test tests/Core.Tests(ProtocolHashTests, ConnectionPayloadCodecTests, ConnectionPayloadTests, ConnectionApprovalValidatorTests). - ✅ NGO adapter (UM-T8):
NetSession(StartHost/StartServer/JoinByAddress(ip, port)/Start(NetConfig)/Leave, eventsStateChanged/Started/Ended(Disconnection)/ClientConnected/ClientDisconnected) drives a NetworkManager and its Unity Transport (UDP or WebSocket fromNetConfig.Transport) and keepsSessionStateMachinein step with NGO's callbacks, mapping client disconnects to aDisconnectReason(server shutdown, kicked/rejected with the server's text, connect failed, timed out, transport failure);NetworkTickClockimplementsITickClockoff NGO'sNetworkTickSystem(one clock per live session, stopped when it ends); the headless bootstrap (HeadlessBootstrap: batch mode /-nographics/ Dedicated Server build detection, vsync off andtargetFrameRate= tick rate) with the engine-freeNetCommandLine(-mode -address/-ip -port -transport -tickrate -maxplayers) andNetLaunch(an explicit-modewins, else headless serves as a dedicated server, elseautoStart); and theNetBootstrapcomponent that owns the session. Verified bytests/run-playmode.ps1(PlayMode, NetcodeIntegrationTest over real Unity Transport on loopback, UDP and WebSocket:HostAndClientTests,ServerAndClientsTestswith 2 clients,NetworkTickClockTests,NetBootstrapTests) anddotnet test tests/Core.Tests(NetCommandLineTests, NetLaunchTests). - ✅ Connection approval and seats (UM-T9): Core
PlayerIdentity(stable player token, name, colour →ConnectionPayload),SeatRegistry(token → seat; a dropped player's seat is held forNetConfig.ReconnectGraceSeconds, default 60 s, and held seats count as taken; the same token reconnecting reclaims it, or takes it over from a stale connection the server has not seen die; expiry, kick-free, lowest-free-index seating) andConnectionAdmission(the validator counting seats, a returning player's own seat excluded, then seating in the same step);Disconnection.Rejectioncarries the typed approval reason andDisconnectReason.ClientLeftnames a server-side clean leave. The adapter turns approval on at both ends: clients and a host's own player sendIdentity+ game version +ProtocolHash;NetSession's NGO approval callback admits or refuses with the wire reason, and the client'sLastDisconnectshows the sentence with itsRejection. Each seat keeps its player object (DontDestroyWithOwner); a reclaimed seat hands the same instance back (respawned as the new connection's player object) instead of spawning another, and an expired or kicked seat despawns it. Events:SeatTaken/SeatReclaimed/SeatHeld/SeatReleased,PlayerDisconnected(ClientLeft, TimedOut or Kicked, with the seat's fate),ConnectionRejected;Kick(clientId, reason).NetBootstrapremembers the token in PlayerPrefs per install folder (-playertokenoverrides). Verified bytests/run-playmode.ps1(ApprovalAndSeatTests: version, protocol and full rejections with reasons; drop and reconnect → same seat and player object; a killed client's restarted game taking its seat over; grace expiry; kick) anddotnet test tests/Core.Tests(SeatRegistryTests, ConnectionAdmissionTests, PlayerIdentityTests). - ✅ Entities, RPCs, scene flow and prefabs (UM-T10): Core gets the attributes (
[ToServer]withDelivery,RateLimit,Burst,RequireOwnership= true;[ToClients],[ToOwner],[ToClient]whose first parameter is the target client id;[Synced]withOnChanged),NetSender(client id, seat index, display name; converts to its client id so a handler can answer its caller),TokenBucket/RpcRateLimiter(one bucket per sender and RPC, burst defaults to one second's worth, forgotten when the sender leaves) andRpcGate(ToServer: server only, then owner unlessRequireOwnership = false, the server itself always passing, then rate; server-to-client calls must come from the server). The adapter addsNetEntity(non-genericNetworkBehaviourbase:OnSpawned/OnDespawned,Owner,Session, and theNet*surface generated code calls; a client writing synced state throws),NetSession.RpcRejected/GetSender/Scenes/Prefabs,NetSceneFlow(server-onlyLoad(scene, Single|Additive)/Unload, one change at a time,SceneRequestResultinstead of NGO statuses, eventsLoadStarted,ClientLoaded,Loaded,Unloaded,ClientSynchronizedfor late joiners) andNetPrefabRegistry/NetPrefabList(checked registration before start;NetBootstrapregisters its lists). The RPC and synced-field plumbing is hand-written in the generator's exact shape inTests/Runtime/Entities/TestAvatar.g.cs(its header documents the shape:Move→MoveServerRpc→OnMove,…ClientsRpc,…OwnerRpc,…ClientRpc), which UM-T11 replaces. Verified bytests/run-playmode.ps1(EntityRpcTests: every direction, ownership refusal, per-sender rate limit, server-to-client calls refused from a client, answering the caller, synced replication,OnChangedon every peer, client writes refused, late joiner, prefab registry;SceneFlowTests: additive load and unload followed by every client, late-joiner sync, client and unknown-scene refusals, scene management off, usingtests/PlayModeHost'sNetFlowArenascene) anddotnet test tests/Core.Tests(TokenBucketTests, RpcRateLimiterTests, RpcGateTests, NetSenderTests, RpcAttributeTests). - ✅ Source generator and analyzers (UM-T11):
src/Generators(netstandard2.0, Microsoft.CodeAnalysis.CSharp 4.3.1, deterministic Release build copied toRuntime/Generators/MindAttic.Unity.Multiplayer.Generators.dll, labelledRoslynAnalyzerwith every platform unticked, so Unity applies it to the adapter assembly and every assembly that references it, verified for the PlayMode test assembly).NetEntityGeneratorwrites, for eachNetEntitysubclass, the body of every[ToServer]/[ToClients]/[ToOwner]/[ToClient]C# 9 extended partial method and its NGO stub (MoveServerRpc,…ClientsRpc,…OwnerRpc,…ClientRpcwithDelivery, server-only invoke for server-to-client calls, and theRequireOwnership/RateLimit/Burstpassed to the gate), then callsOn<Name>(args)orOn<Name>(args, NetSender); each[Synced]field becomes a server-writeNetworkVariable(a constant initializer becomes its first value) plus a property, withOnChangedwired throughNetBindSynced/NetUnbindSynced; and one[assembly: NetProtocol(hash, count)]per assembly over every RPC signature (direction, type, name, wire parameter types, delivery) and synced signature (type, declaration index, name, type), listed in the generated file. Diagnostics MAMP001–MAMP013 (catalogued insrc/Generators/Diagnostics.cs): not partial, missing handler, unsendable parameter, unreplicable synced type, genericNetEntity, direct write (error) or read (warning) of a[Synced]field, attribute outside aNetEntity, bad RPC shape,[ToClient]without aulongtarget, badOnChanged, bad synced field, non-constant initializer; a suppressor hides CS0169/CS0414/CS0649 on[Synced]fields. UM-T10's hand-writtenTestAvatar.g.csis deleted and the generator writes it. Verified bydotnet test tests/Generators.Tests(snapshots of the package's ownTestAvatarand of every member shape, each compiled clean as C# 9; one test per diagnostic; the hash checked against Core'sProtocolHash.Compute) andtests/run-playmode.ps1(the whole PlayMode suite,EntityRpcTestsunchanged, green against the generated code). - ✅ Rendezvous service (UM-T12):
server/Rendezvous(ASP.NET Core .NET 10 minimal API,MindAttic.Unity.Multiplayer.Rendezvous) maps a join code to a dedicated server's IP:port. Routes, header and JSON field names live in Core'sRendezvousProtocolso UM-T13's client shares them:POST /v1/register{secret, address?, port, transport?}→ 201{code, token, ttlSeconds, expiresAt}(an omitted address means the caller's own;JoinTarget.ForEndpointrejects wildcards, whitespace and port 0),POST /v1/heartbeat{code, token}renews for another TTL,GET /v1/resolve/{code}→{code, address, port, transport}(player-typed forms accepted throughJoinCode.TryParse; 400 with the parse reason, 404 for unknown or expired),DELETE /v1/register/{code}withX-Rendezvous-Token, andGET /healthz(Degraded when full, never rate limited). Codes are CoreJoinCode.Generatefrom a cryptographic RNG (CodeDataLength, default 8 = 40 bits); each registration gets a private 256-bit token compared in fixed time, and a wrong token looks exactly like an unknown code. The store is in memory with a TTL (default 60 s): an expired code is gone on read and swept byExpirySweeper;MaxRegistrationscaps it (503). The registration secret is required at startup unlessAllowOpenRegistration(Development only); per-IP fixed-window limits per route group (register, heartbeat/delete, resolve), IPv6 limited per /64, 429 withRetry-After. TLS-ready: Kestrel certificate configuration,RequireHttps(HSTS + redirect) orUseForwardedHeaderswithKnownProxiesbehind a TLS proxy. The Dockerfile (built from the repo root, non-root$APP_UID, port 8080) has aHEALTHCHECKthat runs the service's own--healthcheckprobe, since the aspnet image has no curl. Verified bydotnet test tests/Rendezvous.Tests(WebApplicationFactory with a hand-driven clock and fake caller IPs: round trips, TTL expiry and heartbeat renewal, tokens, secret and startup refusal, bad endpoints, full store, rate limits per IP and per /64, health) anddotnet test tests/Core.Tests(RendezvousProtocolTests). - ✅ Join codes at runtime (UM-T13): Core gets the rendezvous client and service, engine-free so
dotnet testcovers them:RendezvousClient(register / heartbeat / resolve / unregister overIRendezvousHttp, defaultHttpClientRendezvousHttp;RendezvousJsonreads and writes the flat bodies, since Unity has no System.Text.Json; refusals and unreachable services becomeRendezvousExceptionwith the service's own message andIsTransientfor 0/429/5xx),RendezvousJoinCodeService(IJoinCodeService:RegisterAsync(ServerAdvertisement)keeps each registration alive with heartbeats every third of its TTL on the thread pool, retries transient failures, raisesRegistrationLostwhen the service forgets it, and deletes what is left onDispose),ServerAdvertisement(what a server registers:PublicAddress/PublicPortwhen set, else on RunPod with WebSocket theRUNPOD_TCP_PORT_{port}mapping atRUNPOD_PUBLIC_IP, else the listen port at the address the service sees; warns for UDP on RunPod),RelayCodes(Unity Relay's 6-12 character codes are written in6789BCDFGHJKLMNPQRTW, all inside the join-code alphabet, so a Relay code plus the check character is the join code),JoinCodeProvider/JoinCodeDefaults(Auto = Relay for a listen server, rendezvous for a dedicated server),NetConfig.JoinCodes/RendezvousUrl/RendezvousSecret/PublicAddress/PublicPortwith-joincodes -rendezvous -rendezvoussecret -publicaddress -publicportandNetEnvironment(MINDATTIC_RENDEZVOUS_URL,MINDATTIC_RENDEZVOUS_SECRET,MINDATTIC_PUBLIC_ADDRESS, applied before the command line). The adapter addsRelayJoinCodeService(Unity Relay through com.unity.services.multiplayer behindMINDATTIC_UGS: initializes Unity Services and signs in anonymously, allocates for the host, joins the allocation for a client, DTLS orwss; without the package it reports what to install) and onNetSession:HostWithCode(Relay by default; Rendezvous publishes a reachable host's address),PublishCodefor a running Host or Server, a dedicated server with a rendezvous URL registering itself once Running (and again, with a new code, if the service loses it),JoinByCode(typed code)(rendezvous first when a URL is set, then Relay when installed and the code is Relay-shaped; the transport comes from the registration),PublishedCode/PublishedCodeText,JoinCodePublished,JoinCodeFailed(a message to show), aJoinCodesoverride, and the code withdrawn when the session ends;NetBootstrapgets the Inspector fields plusHostWithCode/JoinByCode. Verified bytests/run-playmode.ps1(JoinByCodeTests, UDP and WebSocket, againstInProcessRendezvousServer, a loopback HTTP implementation of the protocol: self-registration and heartbeats past a 1 s TTL, joining with the code typed lower case with spaces, withdrawal on leave, re-registration after the service forgets it, the RunPod mapped port and IP, a wrong secret, a listen server by rendezvous, the Relay default, bad, unknown and unresolvable codes),dotnet test tests/Core.Tests(RendezvousClientTests, RendezvousJoinCodeServiceTests, RendezvousJsonTests, RelayCodesTests, JoinCodeDefaultsTests, ServerAdvertisementTests, JoinCodeConfigTests) anddotnet test tests/Rendezvous.Tests(CoreClientInteropTests: the Core client against the real service). TheMINDATTIC_UGSpath compiles and the PlayMode suite passes with com.unity.services.multiplayer 2.4.1 installed; a live Relay allocation needs a linked Cloud project and is not exercised by the suite. - ✅ Network conditions (UM-T14): Core
NetConditions(latency, jitter, packet loss for this peer's link;For(profile),Validate,TryParseProfile) andNetConditionsProfile(Nonedefault,Broadband20 ms ±5,Mobile4G60 ms ±15 / 1%,Mobile3G200 ms ±50 / 3%,Lossy150 ms ±10 / 5%,Custom), selected byNetConfig.ConditionswithSimulatedLatencyMs/SimulatedJitterMs/SimulatedPacketLossPercentfor Custom (EffectiveConditions,UseCustomConditions),-netsimand-latency -jitter -losson the command line (a number after a profile keeps the profile's other numbers), and theNetBootstrapInspector. The adapter'sTransportConditionsretunes the simulator pipeline stage NGO's UnityTransport puts under every pipeline (ModifySimulatorStageParameters,ApplyMode.AllPackets: each packet sent and received is delayed and may be dropped, below the reliable stage so reliable traffic is resent) right after NGO starts, before any pipelined packet;NetSession.Conditionsreports what applies andSetConditionschanges a live session. The stage exists only where NGO builds it (editor, development builds,UNITY_MP_TOOLS_NETSIM_*overrides); elsewhere conditions are ignored with a warning, and no simulation leaves the stage alone so Multiplayer Tools' Network Simulator can drive it instead. Verified bytests/run-playmode.ps1(LossyNetworkTests: a Host and two clients onLossy; connect with the simulator parameters read back from the driver and the measured round trip over 250 ms, 40 reliable[ToServer]calls per client and 30 each of[ToClients]/[ToOwner]/[ToClient]arriving once and in order, a round trip,[Synced]settling on the last of 30 writes with OnChanged, a late joiner, reconnecting to a held seat and taking over a stale connection's seat, andSetConditionsslowing and restoring a live connection) anddotnet test tests/Core.Tests(NetConditionsTests). Removal reasons arrive first (UM-T34):Kickand the stale-connection takeover send the reason as their own reliable named message (MindAttic.Multiplayer.DisconnectNotice) instead of NGO'sDisconnectClient(reason), which closes the connection at once and could lose the reason on a lossy link; the client endsKickedwith that reason and closes its own connection, and the server closes it after a 5 s grace if it has not (LossyNetworkTestsasserts the reason for a takeover and a kick over theLossylink). A shutdown is announced the same way (UM-T65): a stopping Host or Server sends every remote clientMindAttic.Multiplayer.ShutdownNotice, the client endsServerShutdownand closes its own connection, and NGO shuts down once they have gone (2 s grace), because closing a WebSocket connection with the client's sends still unread resets it and lost NGO's own shutdown reason (the client sawTransportFailure);ShutdownUnderLoadTestsstreams client messages through a Server's and a Host's shutdown over WebSocket and UDP. - ✅ Editor tooling (UM-T15): MindAttic ▸ Multiplayer ▸ Set Up Scene (
NetSceneSetup.Run(scene, options)) networks the open scene in one click and one undo step. It finds the scene's NetworkManager or creates aNetworkManagerGameObject, adds Unity Transport wired asNetworkConfig.NetworkTransportand aNetBootstrap, and assigns aNetPrefabList: the one already assigned, else the project's first, else a newAssets/NetPrefabs.assetholding the project's NetworkObject prefabs that no list registers yet. A second run changes nothing. Validate Prefabs (NetPrefabValidator) checks every network prefab under Assets, meaning any prefab with a NetworkObject or NetworkBehaviour or named by a list. Errors:MissingNetworkObject(none on the root, naming the child that has one),NotRegistered(noNetPrefabListor NGONetworkPrefabsListasset holds it),GenericNetEntity(aNetEntitythat is generic or derives from a generic class; the runtime check could never see this, since an attached component is never an open generic). Warning:EmptyListEntry. Build Dedicated Server (Linux) (DedicatedServerBuild.Build) validates first and refuses on errors. It then builds the enabled scenes as a Linux x86_64 Dedicated Server (StandaloneBuildSubtarget.Server; an optional Mono/IL2CPP override is restored afterwards) intoBuilds/LinuxServer/, and writesServerDockerfile's Dockerfile (ubuntu:24.04, non-rootserveruser,EXPOSE port/udpor/tcpfor WebSocket, exec-formENTRYPOINT ["./Game.x86_64", "-batchmode", "-nographics", "-logFile", "-", "-mode", "server", "-port", …, "-transport", …]sodocker runarguments are appended) and a.dockerignorefor Unity's DoNotShip folders. The port and transport come from the open scene'sNetBootstrap.BuildFromCommandLineis the CI entry point (-serverOutput -port -transport -serverBackend -serverDevelopment). Verified bytests/run-editmode.ps1(EditModeMindAttic.Unity.Multiplayer.Editor.Tests:NetSceneSetupTests,NetPrefabValidatorTests,DedicatedServerBuildTests, including a real Mono Linux server build of a wizard-networked scene with its Dockerfile). - ✅ Minimal sample (UM-T16):
Samples~/Minimal, listed undersamplesinpackage.jsonso Package Manager's Samples tab imports it intoAssets/Samples/MindAttic Multiplayer/<version>/Minimal.MinimalPlayer(the NetworkManager's player prefab) is the whole networked surface: one[ToServer(RateLimit = 20)] SetDirectionsent by the owner when its keys change (the server clamps it to length 1), one[Synced] Vector2 _positionthe server moves inside an 8×8 arena, and one[ToClients] Bumpedthe server sends when a square first hits a wall; drawn with IMGUI so it needs no render pipeline, sprites or UI package.MinimalMenudrivesNetBootstrap: Host, Join by IP, Host with code, Join by code, Leave, withEnded/JoinCodeFailedshown;MinimalInputreads the Input System or the Input Manager. The scene's NetworkManager was made by the Set Up Scene wizard (scene management off: one scene). The sample'sREADME.mdis the 10-minute getting-started walkthrough of every line, which UM-T19's guide builds on.tests/run-sample.ps1builds a throwaway host project (tests/SampleHost, git-ignored), imports the sample throughUnityEditor.PackageManager.UI.Sample, and runstests/MinimalSample/Testsagainst the imported copy;-Authorregenerates the scene, prefab and prefab list (MinimalSampleHost.Author, prefab validator clean). Verified bytests/run-sample.ps1(MinimalSceneTests: the imported scene is wired as documented, hosts from its NetBootstrap, the host's player spawns at its seat's spot, moves to the wall and bumps;MinimalPlayerNetworkTests: host and client over loopback, the owner'sSetDirectionclamped on the server, the synced position on both peers,Bumpedon both, a non-owner refused). - ✅ CI (UM-T17):
.github/workflows/ci.ymlrunsdotnet teston Core.Tests, Generators.Tests and Rendezvous.Tests, and the PlayMode/EditMode suites through GameCI'sunity-test-runneragainsttests/PlayModeHost(-runTests -batchmode, filtered per mode toUnity.Multiplayer.Tests/.Editor.Tests; EditMode's[Category("Build")]Linux server build is skipped in CI, since GameCI's editor image has no Linux Dedicated Server build-support module, and stays covered byrun-editmode.ps1locally). Both need aUNITY_LICENSErepository secret..github/workflows/nightly-smoke.ymlbuilds a StandaloneLinux64 Player of the Minimal sample (tests/MinimalSample/Editor/SmokeHostBuild.cs, run locally bytests/run-smoke.ps1) and runs it under Docker Compose (smoke/docker-compose.yml) as the rendezvous service, a dedicated server and two headless bot clients: one build plays every role, picked at run time byMINDATTIC_ROLE(tests/MinimalSample/Runtime/SmokeDriver.cs). The server self-registers and publishes a join code to a shared volume; each bot reads it, joins through the rendezvous service and drives its square into the arena wall, proving the join-code flow and the[ToServer]/[Synced]round trip end to end (smoke/wait-for-smoke.shwatches for both bots'OK:log lines). - ✅ Drop-in front end (UM-T48): the optional
Unity.Multiplayer.UIassembly (Runtime/UI), compiled only whencom.mindattic.components.unityis installed (versionDefines→MINDATTIC_COMPONENTS, required by its define constraint) and usingcom.mindattic.unity.sharedprofiles when present (MINDATTIC_SHARED);package.jsoncannot listfile:packages, so a game adds both manifest lines itself.NetFrontEnd(one component beside theNetBootstrap; MindAttic ▸ Multiplayer ▸ Add Front End,NetFrontEndSetup.Run, networks the scene first and adds it, or changes nothing and names the exact manifest lines missing) builds, entirely from MindAttic Components: a main menu (Host, Join by IP, Join by code, Settings with name and colour, the game's items, Quit), a host lobby (the grouped join code in aMaCodeDisplaywith Copy, or the LAN address when no code could be published; a live roster from the seats with colour swatches, a Host tag, held seats as "reconnecting...", remove with confirm; Leave/Start), a cancellable busy dialog while hosting or joining, a dialog per disconnect reason, an automatic reconnect for a lost connection (same address or code again, same player token, so the same seat; progress and Cancel; refusals and kicks are final) and an in-game Esc menu (Resume, Invite players, Settings, the game's items, Leave/End game). The name and colour come fromIPlayerIdentitySource(ProfileIdentitySourceoverProfiles.Current.Settings.Common, elsePlayerPrefsIdentitySource), cleaned to what the server accepts, and go in the approval payload throughNetSession.Identity. Hooks:SessionStarted,GameStarted,Left(Disconnection),Reconnected,StateChanged,AddScreen,AddMainMenuItems,AddPauseMenuItems,AddSettingsItems,MenusVisible, and a method per button (HostAsync,JoinByAddressAsync,JoinByCodeAsync,StartGame,Leave); optionalNetFrontEndSettingsasset (title, buttons, lobby, a game scene the server loads on Start, kick message, pause menu, reconnect timing, theme). Core gains the engine-free rules it follows:DisconnectText(title, sentence and server detail for everyDisconnectReasonandApprovalRejection, the one home of that wording),ReconnectPolicy(onlyTimedOut/TransportFailureafter being connected; doubling capped delays),HostAddress(host,host:port,[v6]:portas typed) andNetLaunch.ShowsMenus(never headless, never on a-modelaunch: servers and bots create no UI).Samples~/FrontEnd: the Minimal arena with the front end, each square in its player's name and colour ([Synced]from the seat), the hooks inFrontEndGame.cs, authored byrun-sample.ps1 -Sample FrontEnd -Authorthrough the Add Front End step. Verified bydotnet test tests/Core.Tests(FrontEndRulesTests),tests/run-playmode.ps1(Unity.Multiplayer.UI.Tests, two front ends over real Unity Transport on loopback, free ports: host from the menu → lobby, Join by IP from the menu, roster name and colour from the payload, Start, Leave from the Esc menu; Join by code from the lobby's code throughInProcessRendezvousServer; the version-mismatch and kicked dialogs; a lost link cut byUdpLinkProxyreconnecting to the same seat, and one that never comes back giving up; Settings saving and the new name reaching the server; a headless scene with a real NetBootstrap building no UI; the profile identity),tests/run-editmode.ps1(NetFrontEndSetupTests) andtests/run-sample.ps1 -Sample FrontEnd. Found and fixed on the way in MindAttic.Components: M.COMP-T44 (Motionclashed withUnityEngine.Motionin any game with the animation module) and M.COMP-T45 (MenuScreen.Clearleft dead items in navigation for a frame). - ✅ Votes kit (UM-T54, promoted from Unity.Cursory's UC-T10): Core
VoteBox(engine-free; one vote at a time over a roster of client ids; the starter's Yes; passes when Yes reaches the quorum and runs the kind's server-side effect first; rejected as soon as the quorum is unreachable; lapses on theITickClockwith a per-second countdown; a leaver dropped and the quorum recomputed, the last one abandoning it;Cancel),VoteRules(quorum fraction, default 2/3 rounded up; timeout, default 15 s; optional per-starter cooldown after a failed vote;MayStart;StarterVotesYes),VoteKind(id,Title/Descriptionworded from the request,Checkwith the starter's reason,MayVote,Passed, per-kind quorum and time),VoteRequest(alongandstringpayload),VoteStatus,VoteResult,VoteStartResult/VoteRefusalandVoteText(the overlay's words, their one home). The adapter'sVoteBoard(aNetEntityfrom the package's ownResources/MindAttic.Multiplayer/VoteBoardprefab:RegisterPrefab,Spawn,Serve,AddKind,AddKickKindthroughNetSession.Kickwith the target left out of the voters,StartVote,StartKickVote,CastVote; status in[Synced]fields, ballots, results and refusals as RPCs;Status,LocalChoice,ChoiceOf,VoteChanged,VoteEnded,VoteRefused), the NGO-freeIVoteBoard/VoteBoardsthe UI binds to, andNetVotes(one component beside theNetBootstrap: registers the prefab on every peer, spawns and serves the board on the server with the Inspector's rules, the kick vote and the game's kinds).Unity.Multiplayer.UIgetsVoteOverlay(question, description, tally, quorum bar, standing, Yes/No, result and refusal toasts), wired by itself for aNetFrontEndwith menus and shown only in game. Verified bydotnet test tests/Core.Tests(VoteBoxTests) andtests/run-playmode.ps1(VoteBoardTests: host and two clients over loopback, number and text payloads, early rejection, a stepped-clock timeout, a leaver, refusals to the starter only, a kick, host-only starts;NetVotesTests;VoteOverlayTests); Unity.Cursory deletes its own VoteBox/VoteBoard/overlay and registers its reset and level kinds. - ✅ Player roster and identity (UM-T55):
NetSession.Roster(NetRoster) gives every peer one CoreNetPlayerper seat (seat, client id, name, colour, host, connected, ping, local), built by the server from its seats (NetPlayer.FromSeat:PlayerNames.Cleaned name,PlayerColors.Resolved colour with the seat's palette colour for an unpicked white) and kept in step over named messages (MindAttic.Multiplayer.Roster*): a client says hello once connected and gets a fullRosterUpdate, then incremental ones fromPlayerRoster.Replace's differences; a held seat stays as not connected and a reconnect keeps seat and record; the server probes each client's round trip once a second (first one interval after it joined).RequestChangeis checked by the server (PlayerChangeRequest.Validate:PlayerNames.Validate, opaquePlayerColors.Validate, a rate limit) and an accepted change is stored withSeatRegistry.Renameand inNetSession.Identity.NetFrontEnd's lobby reads the roster, its Settings renames mid-game through the server, and an accepted local change is saved to theIPlayerIdentitySource. Wire format:RosterWire(versioned, strict, never throwing). Verified bydotnet test tests/Core.Tests(PlayerNamesTests, PlayerColorsTests, PlayerRosterTests, RosterWireTests) andtests/run-playmode.ps1(RosterTests: host and two clients, late join, round trips, rename everywhere, bad names refused by the server, reconnect keeps identity, kick;NetFrontEndTests: the lobby follows a mid-game rename and the profile is saved). See Players. - ✅ Networked objects by key (UM-T60): a
NetKeyon a network prefab's root carries a game-given key (NetKeys: non-empty, at most 128 characters, no control characters or edge whitespace, ordinal) inside the object's spawn (NGOOnSynchronize), so every peer, late joiners included, knows it before anyOnSpawned; it cannot change while spawned.NetSession.Objects(NetRegistry, alsoNetRegistry.Current) indexes spawned keyed objects on every peer over Core'sNetKeyTable<T>(one holder per key, removal only by the holder):TryGet<T>/TryGet(GameObject)/Get<T>/Contains/Keys/All,Spawned/Despawnedafter every component'sOnSpawnedand before anyOnDespawned, and server-sideSpawn(prefab, key, ...)(refuses a bad or held key before anything spawns) andDespawn(key)(frees the key at once). An object spawned another way with a missing or duplicate key is logged on every peer and left out. Verified bydotnet test tests/Core.Tests(NetKeysTests, NetKeyTableTests) andtests/run-playmode.ps1(NetRegistryTests, Host and dedicated Server with two clients: lookup on every client, late join, out-of-order spawn and replacement, despawn and same-frame respawn, duplicate keys). Unity.Cursory maps its level bodies by block/shape id with it. See Networked objects by key. - ✅ Bots and end-to-end smoke (UM-T57, promoted from Unity.Cursory's UC-T14):
-bot <role>makes any game a headless bot client. CoreNetLaunchnever starts it by itself or shows it menus;NetBotsjoins by-joincode,-joincodefileor-addressand hands the session to the game'sIBotDriver([NetBotDriver]class or scene component) throughNetBot(role, scenario,Pass/Fail, frame-based waits). The verdict is a[NetBot:<role>] OK:/FAIL:line (CoreBotLog). A server launched with-joincodefilewrites its codes there (CoreJoinCodeFile, atomic).-scenariois passed through (CoreBotCommandLine). The test kit hasNetBotTest(a server + N bots in process).BotPlayerBuildbuilds one Linux player for every role.mp-host game smokewrites and runs the compose stack (rendezvous + server + N bots,SDL_VIDEODRIVER=dummy) and judges the bots' log lines, and.github/workflows/game-smoke.ymlis the reusable nightly a game adopts with one job. See Bots. - ✅ New Game wizard and game template (UM-T59, v2.0.0, the one-stop shop): MindAttic ▸ Multiplayer ▸ New Game… (
NewGame,NewGameWindow; batch:NewGame.CreateFromCommandLine -checkOnly | -addPackages | -gameName <Name>, exit 2 when packages are missing) checksPackages/manifest.jsonwithNewGameManifest(plain text: MindAttic Components required, Unity.Shared optional,com.unity.test-framework1.6.0, NGO undertestables;file:paths to the repos beside Unity.Multiplayer, relative on one drive, else absolute, else the documented sibling path flagged as not found and never written), adds the found lines, then copiesSamples~/GameTemplateintoAssets/<Name>(tokenMyGame→ the name in every text file; every asset a fresh GUID with all references remapped), puts its scene first in Build Settings, turns on Run In Background, and writesmp-host.json(scene,botsA,B,scenario) and.github/workflows/nightly.yml(oneuses:ofgame-smoke.yml). The template:Game.unity(NetworkManager + Unity Transport +NetBootstrap+NetFrontEnd+NetVotes, aGameobject),Player(NetEntity,[ToServer(RateLimit = 20)] Move,[Synced]position, name and colour fromNetRoster),Crate(NetKeyprefab, keyedcrate:0..2throughNetSession.Objects),Arena(plain server rules, push, therestartVoteKindthat despawns and respawns by key),Game(serves the arena, registers the vote, front-end items),GameBot([NetBotDriver]), PlayModeGameTests(NetSessionTest,NetBotTest) and EditModeGameSetupTests. Verified by EditModeNewGameTests(8: missing lines, adding them as valid JSON, empty blocks, a repo not on disk, renaming, fresh GUIDs that still resolve, mp-host.json) andtests/run-new-game.ps1(a fresh-createProject6000.4.3f1 project in%TEMP%: the check names the missing lines and exits 2,-addPackagesadds them,-gameName SpaceCratescreates the game; itsSpaceCrates.EditorTests2/2 andSpaceCrates.Tests5/5 pass, and-Smokerunsmp-host game smoke: the server and bots A and B under Docker Compose, bothOK: pushed crate:N;-Authorrebuilds the template's scene and prefabs). A project must list NGO undertestablesbefore batch mode will run anything:Unity.Multiplayer.Testingdoes not compile without it (UM-T67). Docs: getting-started (rewritten for a new game), kit, case-study-cursory. - ✅ Unity Relay for a home host (UM-T71): Core
RelaySetup/RelayReadiness(engine-free:Check(installed, cloudProjectId)→ NotInstalled / NotLinked / Ready, the not-installed, not-linked, Relay-off and offline sentences,ExplainFailuremapping a Unity Services failure to what to fix,EnvironmentOrDefault,IsProjectId);RelayJoinCodeServicegainsReadiness/IsInstalled(the join-code defaults now use it),Environment(Unity Services environment, production by default), a process-wide anonymousSignInAsync(), and fails before touching Unity Services when the project is not linked; other UGS failures becomeRelaySetupExceptionwith the explained message, whichHostWithCode/JoinByCoderaise asJoinCodeFailedand the front end shows (Host's "No join code: ..." toast, Join by code's "Couldn't join" dialog). NetBootstrap's Unity Relay section: Relay Environment, Relay Region, Sign In At Startup (signs in as the scene starts, not for a headless server or Join Codes None/Rendezvous). Setup: New Game wizard step 3 (RelaySetupCheck: add the package line atRelaySetup.PackageVersion, open Services settings or the dashboard, show the link), MindAttic ▸ Multiplayer ▸ Check Unity Relay Setup,RelaySetupCheck.CheckBatch(exit 0 when ready;-addRelayPackage), andtools/link-unity-cloud.ps1(writes cloudProjectId / organizationId / projectName into ProjectSettings.asset and adds the package, refusing while the editor has the project open;-Check). Verified bydotnet test tests/Core.Tests(RelaySetupTests),tests/run-editmode.ps1(RelaySetupCheckTests) andtests/run-playmode.ps1(JoinByCodeTests and NetFrontEndTests: the not-linked path for HostWithCode / JoinByCode and for the menus). A live Relay game needs a Cloud project with Relay on; see Join codes.
7. Active frontier
The ticket chain in RFC 0001 § Ticket chain. The UM-T4 gate is passed (GO) and UM-T5 to UM-T17 are done; next is UM-T18 (hosting guide).
8. Glossary
- NGO — Netcode for GameObjects, Unity's GameObject netcode package.
- Adapter — the
MindAttic.Unity.Multiplayerassembly; the only runtime code that touches NGO. - Listen server / host — one player's game is also the server.
- Dedicated server — a headless server build everyone joins.
- Join code — a short, checksummed code resolved to a relay allocation or an IP:port.
- Seat — a player's slot on the server, kept across reconnects.