The matchmaking provides a powerfull service to group players together in teams.
Coherence.Runtime.Matchmaking
The player needs to be logged in to use matchmaking.
The matchmaking module has only one method.
// Invoked on success/failurepublicdelegatevoidOnMatch(Result result,MatchResponse match);// The data for every player returned by the matchmaking requestpublicstructPlayerPayload{publicstring user_id;publicstring team;publicint score;publicstring payload;}// The response of the matchmaking requestpublicclassMatchResponse{publicstring match_id;publicPlayerPayload[] players;publicstring error;}publicstaticclassMatchmaker{ // Sends matchmaking request. // region: matchmaking region, e.g. eu, us, ... // team: team name // payload: custom string that will be send to all other playerspublicstaticvoidMatch(string region,string team,string payload,OnMatch callback) // 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 void Match(string region, string team, string payload, string[] tags, string[] friends, OnMatch callback)
}
Example
Matchmaker.Match("eu","blue","car:volvo,rifle:glock", (res, match) => {if (res ==Result.Timeout) { // timed out, inform the playerreturn } // match.players contain all the matched players and their data // including the this player}