Skip to main content

Request Matchmaking with Party Attributes

Last updated on

You can call the below function to send more information related to your party attributes. The client will send the party information and the server will retrieve all information when all party or player success opens the server. to send more information about the party to the server and client will send all that information.

Client Perspective

You will see here how the client will call start matchmaking by sending the party attributes, so then the server will get all that information about the party attributes later for your custom logic on the server if needed.

  1. Make sure the player is logged into the game.

  2. Connect to the Lobby service and request matchmaking with the Party attributes parameter.

    TMap<FString, FString> PartyAttributes;
    PartyAttributes.Add(FString("GameMap"), FString("EndlessBattle"));
    PartyAttributes.Add(FString("GameplayMode"), FString("DeathMatch"));

    FRegistry::Lobby.Connect();
    FRegistry::Lobby.SetStartMatchmakingResponseDelegate(AccelByte::Api::Lobby::MatchmakingStartResponse.CreateLambda([](const FAccelByteModelsMatchmakingResponse& Result)
    {
    if (Result.Code == "0")
    {
    // Do something if StartMatchmakingResponseDelegate has been successful
    }
    else
    {
    // Do something if StartMatchmakingResponseDelegate has an error
    }
    }));
    FRegistry::Lobby.SendStartMatchmaking(GameMode, PartyAttributes);
  3. Once completed, you can follow the same steps as you would making other matchmaking requests.

Server Perspective

You will get more information about the status of the party matchmaking by using the below function. You will need all this information to set up your custom statistic when the game is starting.

  1. Make sure the DS is authenticated and registered in the DSM.

  2. You need to call this query function to get the status and all information about the matchmaking.

    FString MatchId = FString("SomeMatchId");

    FRegistry::ServerMatchmaking.QuerySessionStatus(MatchId, THandler<FAccelByteModelsMatchmakingResult>::CreateLambda([](const FAccelByteModelsMatchmakingResult& Result)
    {
    // Do something if QuerySessionStatus has been successful
    }), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
    {
    // Do something if QuerySessionStatus has an error
    UE_LOG(LogTemp, Log, TEXT("Error QuerySessionStatus, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
    }));