Introduction to matchmaking customization
Extend is in Open Beta for AGS Private Cloud! This means that the Extend add-on is available for you to try in your development environment. You can submit your feedback via our Extend Open Beta feedback form.
Overview
This article walks you through how to modify the Extend Override app template for matchmaking function and transform it into your own app that fits your requirements.
Contract functions
The following are the functions in the contract:
service MatchFunction {
rpc ValidateTicket(ValidateTicketRequest) returns (ValidateTicketResponse);
rpc EnrichTicket(EnrichTicketRequest) returns (EnrichTicketResponse);
rpc MakeMatches(stream MakeMatchesRequest) returns (stream MatchResponse);
}
EnrichTicket
EnrichTicket
is called before ValidateTicket
and is meant to be used for adding additional logic to the match ticket. For example, you can add additional ticket attributes here to be used in the later step.
- Go
- C#
- Java
- Python
In the app template, the following function can be found in src/master/pkg/server/matchFunctionService.go
.
func (g GameMatchMaker) EnrichTicket(matchTicket matchmaker.Ticket, ruleSet interface{}) (ticket matchmaker.Ticket, err error) {
...
}
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)
{
...
}
In the app template, the following function can be found in src/main/java/net/accelbyte/matchmaking/function/grpc/server/MatchmakingFunctionService.java
.
@Override
public void enrichTicket(EnrichTicketRequest request, StreamObserver<EnrichTicketResponse> responseObserver) {
...
}
In the app template, the following function can be found in src/master/src/app/services/matchFunction.py
.
async def EnrichTicket(self, request, context):
...
ValidateTicket
ValidateTicket
is called next and returns a boolean if the match ticket is valid or not. Here, you can can implement your own logic to validate tickets.
- Go
- C#
- Java
- Python
In the app template, the following function can be found in src/master/pkg/server/matchFunctionService.go
.
func (g GameMatchMaker) ValidateTicket(matchTicket matchmaker.Ticket, matchRules interface{}) (bool, error) {
...
}
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)
{
...
}
In the app template, the following function can be found in src/main/java/net/accelbyte/matchmaking/function/grpc/server/MatchmakingFunctionService.java
.
@Override
public void validateTicket(ValidateTicketRequest request, StreamObserver<ValidateTicketResponse> responseObserver) {
...
}
In the app template, the following function can be found in src/master/src/app/services/matchFunction.py
.
async def ValidateTicket(self, request, context):
...
MakeMatches
After the matchTicket
is decorated and validated, you can start making some matches! For example, you can implement a logic to create matches wih the minimum number of players without going over the maximum limit, aiming to reach the maximum capacity.
- Go
- C#
- Java
- Python
In the app template, the following function can be found in src/master/pkg/server/matchFunctionService.go
.
func (g GameMatchMaker) MakeMatches(ticketProvider TicketProvider, matchRules interface{}) <-chan matchmaker.Match {
...
}
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)
{
...
}
In the app template, the following function can be found in src/main/java/net/accelbyte/matchmaking/function/grpc/server/MatchmakingFunctionService.java
.
@Override
public StreamObserver<MakeMatchesRequest> makeMatches(StreamObserver<MatchResponse> responseObserver) {
...
}
In the app template, the following function can be found in src/master/src/app/services/matchFunction.py
.
async def MakeMatches(self, request_iterator, context):
...