Joining Matches
Joining Matches Directly

#include "KronosMatchmakingManager.h"
#include "KronosMatchmakingPolicy.h"// The session you want to join. You must get this somehow, for example by doing a SearchOnly matchmaking.
// Please note that search results cannot be replicated or sent via RPCs! This is an Online Subsystem limitation.
// Notice that this is passed into the lambda so that we can access it.
FKronosSearchResult SessionToJoin;
// Get the matchmaking manager.
UKronosMatchmakingManager* MatchmakingManager = UKronosMatchmakingManager::Get(this);
// Request a new matchmaking policy. This operation is async!
// If matchmaking is in-progress, it will be canceled first.
MatchmakingManager->CreateMatchmakingPolicy(FOnCreateMatchmakingPolicyComplete::CreateLambda([this, SessionToJoin](UKronosMatchmakingPolicy* MatchmakingPolicy)
{
// Matchmaking params are irrelevant in JoinOnly mode.
FKronosMatchmakingParams MatchmakingParams = FKronosMatchmakingParams();
// Matchmaking flags to use.
uint8 MatchmakingFlags = static_cast<uint8>(EKronosMatchmakingFlags::None);
// Tell the matchmaking that we only want to join a session that we've got already.
EKronosMatchmakingMode MatchmakingMode = EKronosMatchmakingMode::JoinOnly;
// Start matchmaking.
// Notice that we are using NAME_GameSession!
MatchmakingPolicy->StartMatchmaking(NAME_GameSession, MatchmakingParams, MatchmakingFlags, MatchmakingMode, 0.0f, SessionToJoin);
}));Finding Matches To Join

Last updated