メインコンテンツまでスキップ

マッチメイキング・カスタマイズの紹介

Last updated on May 21, 2025

Overview

This article explains the API contract (Protobuf) used in the Extend Override app for matchmaking.

service MatchFunction {
rpc GetStatCodes(GetStatCodesRequest) returns (StatCodesResponse);
rpc EnrichTicket(EnrichTicketRequest) returns (EnrichTicketResponse);
rpc ValidateTicket(ValidateTicketRequest) returns (ValidateTicketResponse);
rpc BackfillMatches(stream BackfillMakeMatchesRequest) returns (stream BackfillResponse);
rpc MakeMatches(stream MakeMatchesRequest) returns (stream MatchResponse);
}

API Contract

GetStatCodes

The flow begins with a call to GetStatCode, which retrieves relevant statistical codes from AGS Storage Statistics. These codes are essential for gathering player-specific stats to inform matchmaking decisions. For example, retrieving stat codes for "mmr" enables AGS Matchmaking to gather player statistics based on those specified codes.

In the app template, the following function can be found in src/master/src/AccelByte.PluginArch.Demo.Server/Services/MatchFunctionService.cs.

public override Task<StatCodesResponse> GetStatCodes(GetStatCodesRequest request, ServerCallContext context)
{
...
}

EnrichTicket

Next, EnrichTicket is called to add additional attributes or logic to the match ticket. This customization step allows you to tailor tickets with specific attributes that will be used in later stages.

In the app template, the following function can be found in src/master/src/AccelByte.PluginArch.Demo.Server/Services/MatchFunctionService.cs.

public override Task<EnrichTicketResponse> EnrichTicket(EnrichTicketRequest request, ServerCallContext context)
{
...
}

ValidateTicket

The ValidateTicket function then validates each match ticket according to a defined ruleset. This step ensures that only tickets meeting the criteria progress to matchmaking, returning a boolean to indicate validity.

In the app template, the following function can be found in src/master/src/AccelByte.PluginArch.Demo.Server/Services/MatchFunctionService.cs.

public override Task<ValidateTicketResponse> ValidateTicket(ValidateTicketRequest request, ServerCallContext context)
{
...
}

BackfillMatches

BackfillMatches – After validation, the system initiates the BackfillMatches function to allocate matchTickets into existing game sessions as needed. This step aims to optimize session capacity and resource use according to the game session criteria.

In the app template, the following function can be found in src/master/src/AccelByte.PluginArch.Demo.Server/Services/MatchFunctionService.cs.

public override async Task BackfillMatches(IAsyncStreamReader<BackfillMakeMatchesRequest> requestStream, IServerStreamWriter<BackfillResponse> responseStream, ServerCallContext context)
{
...
}

MakeMatches

Finally, the MakeMatches function completes the process by creating new matches based on the existing player tickets. This function balances minimum and maximum player limits to fill matches as efficiently as possible. It also considers the matchmaking wait time for players who may not meet the criteria for backfilling into existing game sessions.

In the app template, the following function can be found in src/master/src/AccelByte.PluginArch.Demo.Server/Services/MatchFunctionService.cs.

public override async Task MakeMatches(IAsyncStreamReader<MakeMatchesRequest> requestStream, IServerStreamWriter<MatchResponse> responseStream, ServerCallContext context)
{
...
}
備考

You could find more information about gRPC request handling here.