Class GameyeMatchAllocator
- Namespace
- Unity.Multiplayer.Core
IMatchAllocator for Gameye: starts one session per match from an image already registered with Gameye, waits for it to report ready with its ports mapped, and publishes the result through an IJoinCodeService so a player gets a short code instead of a raw address.
public sealed class GameyeMatchAllocator : IMatchAllocator
- Inheritance
-
GameyeMatchAllocator
- Implements
- Inherited Members
Constructors
GameyeMatchAllocator(IGameyeApiClient, IJoinCodeService, string, string, IReadOnlyList<GameyePortSpec>, IReadOnlyDictionary<string, string>, string)
Starts sessions of image imageName in location through
api, publishing join codes through joinCodes. Every
session declares the same ports and environmentVariables
(rendezvous URL/secret and the like); gamePortName is the
Name the game port is declared under.
public GameyeMatchAllocator(IGameyeApiClient api, IJoinCodeService joinCodes, string imageName, string location, IReadOnlyList<GameyePortSpec> ports, IReadOnlyDictionary<string, string> environmentVariables = null, string gamePortName = "game")
Parameters
apiIGameyeApiClientjoinCodesIJoinCodeServiceimageNamestringlocationstringportsIReadOnlyList<GameyePortSpec>environmentVariablesIReadOnlyDictionary<string, string>gamePortNamestring
Exceptions
- ArgumentNullException
api,joinCodesorportsis null.- ArgumentException
imageName,locationorgamePortNameis empty, orportsis empty.
Properties
DisplayName
A name for people and for logs ("Edgegap", "Gameye", ...).
public string DisplayName { get; }
Property Value
GamePortName
The port name a session's game port is registered under.
public string GamePortName { get; }
Property Value
ImageName
The image name AllocateAsync(MatchRequest, CancellationToken) starts sessions from.
public string ImageName { get; }
Property Value
Location
The Gameye location/fleet sessions start in.
public string Location { get; }
Property Value
PollInterval
How often AllocateAsync(MatchRequest, CancellationToken) polls while waiting. Default 2 seconds.
public TimeSpan PollInterval { get; set; }
Property Value
Timeout
How long AllocateAsync(MatchRequest, CancellationToken) waits for Gameye to report the session ready before giving up. Default 2 minutes.
public TimeSpan Timeout { get; set; }
Property Value
Methods
AllocateAsync(MatchRequest, CancellationToken)
Requests a server for request and waits until it can be joined.
public Task<MatchAllocation> AllocateAsync(MatchRequest request, CancellationToken cancellationToken = default)
Parameters
requestMatchRequestcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentNullException
requestis null.- MatchAllocationException
The provider refused the request, could not be reached, or never came up in time.
RegisterImageAsync(string, string, string, CancellationToken)
Registers (or updates) ImageName with Gameye, pointing it at
imageReference (the same GHCR reference mp-host just pushed). Call this
once per build, before the first match of that build is allocated.
public Task RegisterImageAsync(string imageReference, string registryUsername = null, string registryPassword = null, CancellationToken cancellationToken = default)
Parameters
imageReferencestringregistryUsernamestringregistryPasswordstringcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentException
imageReferenceis empty.- MatchAllocationException
Gameye refused the request or could not be reached.
ReleaseAsync(MatchAllocation, CancellationToken)
Tears down a server AllocateAsync(MatchRequest, CancellationToken) returned, once the match is over.
public Task ReleaseAsync(MatchAllocation allocation, CancellationToken cancellationToken = default)
Parameters
allocationMatchAllocationcancellationTokenCancellationToken
Returns
Exceptions
- ArgumentNullException
allocationis null.- MatchAllocationException
The provider could not be reached (a refusal because the allocation is already gone is swallowed, not thrown).