How To Use MatchMaker Ticket

MatchMaker Ticket allows the server to have the complete control over matchmaking logic. The client simply needs to issue a ticket and wait for the server to complete the matchmaking.

Using a ticket issued by MatchMaker, the client simply has to wait for the server to perform matchmaking and notify the matched clients.

The control of the matchmakings performed by tickets is handled by the server.

To learn how to manage the server-side of MatchMaker Ticket, please read here.

The upside of having the server to have the full control of matchmaking logics, the client does not require any change should the matchmaking specs and logics change.

How To Issue A Ticket

Diarkis.Modules.MatchMaker mm = new Diarkis.Modules.MatchMaker();

mm.IssueTicket();

How To Receive Notifications When Matchmaking Is Completed

The server will send a notification when a matchmaking ticket finishes finding matches or fails to find matches. Matched remote clients will also receive a notifications when matched with the client that issued the matchmaking ticket.

Here is how to setup an event listener callback to receive the notifications.

mm.OnTicketComplete += (bool success, byte[] message) =>
{
if (!success)
{
// The server failed to find matches...
return;
}
// message contains the data that the server created.
// message that the server sends can be easily configurable on the server.
};

How To Cancel Issued Ticket

There may be a time when you want to cancel the matchmaking ticket you have issued.

Here is how.

Important: You may cancel tickets that are issued by yourself only.

mm.CancelTicket();

How To Receive Notifications When Ticket Is Canceled

mm.OnCancelTicket += (bool success, byte[] message) =>
{
if (!success)
{
// Failed to cancel the ticket...
// message byte array contains the error data
return;
}
// ticket has been successfully canceled
};