Hosting on Gameye (Gameye)
The second per-match allocation profile (UM-T29), alongside Edgegap: Gameye starts one session per
match, on demand, in a location you pick, and you stop it when the match ends. Like Edgegap, this
is for short matches, not a persistent world -- see docs/articles/hosting/edgegap.md for the shape
this family of profiles has in common.
As with Edgegap, there is no single long-running server for mp-host deploy/status/logs/update/
destroy to act on. Core's Unity.Multiplayer.Core.GameyeMatchAllocator implements the UM-T29
IMatchAllocator contract instead: a matchmaker calls AllocateAsync when a match is ready and
ReleaseAsync once it ends.
How it fits together
- mp-host still builds the server package and pushes its image to GHCR, exactly as for every other
profile (
ServerPackageBuilder+DockerCliImageTool, UM-T23/UM-T25). - Once per build, call
GameyeMatchAllocator.RegisterImageAsync(imageReference, registryUsername, registryPassword). This tells Gameye about the pushed GHCR image under the image name the allocator was constructed with (a GHCR personal access token with read access is enough for Gameye to pull a private image; a public image needs no credentials here). - Per match, your matchmaker calls
GameyeMatchAllocator.AllocateAsync(new MatchRequest(matchId, maxPlayers)). The allocator starts a session of that image in the configured location, polls until Gameye reports it ready with its ports mapped, and returns aMatchAllocation: the endpoint (a public IP and the port Gameye mapped to your game port) and a join code published through whateverIJoinCodeServiceyou give the allocator (the self-hosted rendezvous service from UM-T12, so the code resolves for any client, not just this process). - Hand the player the join code (or the endpoint directly);
NetSession.JoinAllocatedServerAsyncjoins what the allocation already resolved, with no further lookup. - Once the match is over, call
GameyeMatchAllocator.ReleaseAsync(allocation): it revokes the join code and stops the Gameye session.
Setting it up
var api = new HttpGameyeApiClient(apiKey); // from the Gameye dashboard
var rendezvous = new RendezvousJoinCodeService(new RendezvousClient(rendezvousUrl), rendezvousSecret, serverAdvertisement: null);
var ports = new[] { new GameyePortSpec("game", 7777, TransportKind.Udp) };
var allocator = new GameyeMatchAllocator(api, rendezvous, imageName: "my-game", location: "eu-west", ports);
await allocator.RegisterImageAsync("ghcr.io/myorg/mygame:v1.2.0", ghcrUsername, ghcrToken);
MatchAllocation allocation = await allocator.AllocateAsync(new MatchRequest("match-42", maxPlayers: 8));
// hand allocation.Code (or allocation.Endpoint) to players ...
// ... match plays out ...
await allocator.ReleaseAsync(allocation);
Store the API key in the vault, never the repo:
mp-host credentials set-gameye --key <Gameye API key> --image-name my-game --location eu-west
(mp-host itself does not call Gameye's API -- set-gameye only gives your matchmaking service, or
a one-off script, a place to read the key from instead of hard-coding it.)
Cost and sizing notes
Gameye bills for session run time, by fleet/location pricing -- there is no "always on" cost, since a
session only exists for the length of a match. GameyeMatchAllocator.ReleaseAsync stops billing for
that match the moment it is called; wrap match lifecycles in a finally that always releases so a
crash or an early empty-lobby exit does not leak a running session. Verify Gameye's current locations,
fleet pricing and image-registration/session API shape against their live docs before depending on
this for a public launch -- this is also why the real-provider smoke test
(tests/Core.Tests/GameyeSmokeTests.cs) is opt-in rather than part of every build: it costs real
money and depends on Gameye's schema not having drifted since this was written.