Matchmaking

The matchmaking provides a powerful service to group players together in teams.

Coherence.Runtime.Matchmaking

The matchmaking module has only one method.

// Invoked on success/failure
public delegate void OnMatch(Result result, MatchResponse match);

// The data for every player returned by the matchmaking request
public struct PlayerPayload
{
    public string UserId;
    public string Team;
    public int Score;
    public string Payload;
}

// The response of the matchmaking request
public class MatchResponse
{
    public string MatchId;
    public PlayerPayload[] Players;
    public string Error;
}

public static class Matchmaker
{
    // Sends matchmaking request.
    // region:  matchmaking region, e.g. eu, us, ...
    // team:    team name
    // payload: custom string that will be send to all other players
    public static async Task<MatchResponse> Match(string region, string team, string payload)
    
    // Sends a matchmaking request
    // region:  matchmaking region, e.g. eu, us, ...
    // team:    team name
    // payload: custom string that will be send to all other players
    // tags:    custom tags to segment the player pool, e.g. "level1", "qa", etc
    // friends: group the player with his friends. If any of the friends doesn't show up the request will fail
    public static async Task<MatchResponse> Match(string region, string team, string payload, string[] tags, string[] friends)
}

Example

Last updated

Was this helpful?