Sub-Game Modes
Last updated on
Matchmake into a Sub-Game Mode
You can use sub-game modes to allow players to choose from multiple game modes within your game. The following function is used to matchmake a player into a sub-game mode.
- Unreal Engine
- Unity
FRegistry::Lobby.SetStartMatchmakingResponseDelegate(Api::Lobby::FMatchmakingResponse::CreateLambda(
[](const FAccelByteModelsMatchmakingResponse& result )
{
if(result.Code == "0")
{
UE_LOG(LogTemp, Display, TEXT("Matchmaking started successfully"));
}
else
{
UE_LOG(LogTemp, Display, TEXT("Matchmaking start error with code %s"), *result.Code);
}
})
);
Api::FMatchmakingOptionalParams OptionalParams;
OptionalParams.SubGameModes = {"1v1", "ffa"};
FRegistry::Lobby.SendStartMatchmaking("deathmatch", OptionalParams);
MatchmakingOptionalParam optionalParam = new MatchmakingOptionalParam
{
subGameModes = new string[] { "1v1", "ffa" }
};
AccelBytePlugin.GetLobby().StartMatchmaking("deathmatch", optionalParam, result =>
{
if (!result.IsError)
{
Debug.Log("Matchmaking started succesfully");
}
else
{
Debug.Log($"Start matchmaking error with code {result.Error.Code}, message is {result.Error.Message}");
}
});