Kronos Matchmaking
Buy NowContact
  • About
    • Kronos LTS
    • Support
    • Accolades
  • Examples
    • Playable Demo
    • Sample Project
    • Example Content
  • Configuration
  • Testing & Debugging
  • Usage
    • Getting Started
    • Authentication
      • Authenticating Users
      • Customizing The Auth Widget
      • Creating Custom Auth Tasks
    • Matchmaking
      • Overview
      • Creating Matches
      • Starting Matchmaking
      • Canceling Matchmaking
      • Using Skill Ratings
      • Sending Match Invites
      • Joining Matches
      • Leaving Matches
    • Party
      • Overview
      • Creating Parties
      • Sending Party Invites
      • Joining Parties
      • Managing Party Players
      • Party Player Actors
      • Leaving Parties
    • Reservations
      • Overview
      • Using Reservations
      • The Host Reservation
      • Completing Reservations
    • Lobby
      • Overview
      • Lobby Setup
      • Set Players Ready
      • Lobby Player Data
      • Starting The Match
      • Updating Lobby Session
      • Leaving The Lobby
    • Widgets
  • Guides
    • Creating a Level Selector
    • Integrating with Lyra Game
    • Integrating with EIK
  • Advanced
    • Steam Sockets
    • Reconnect Parties
    • Custom Party Variables
    • Player Groups
  • Changelog
    • API Upgrades
    • Legacy
Powered by GitBook
On this page
  • Joining Matches Directly
  • Finding Matches To Join
  1. Usage
  2. Matchmaking

Joining Matches

PreviousSending Match InvitesNextLeaving Matches

Last updated 9 months ago

In order to access online features, the player must be logged in with the Online Subsystem. Please visit the page for more information.

Joining Matches Directly

You can directly join a match by using the JoinKronosMatch node. Note that you only have to do this if you specifically told the matchmaking system to only search for games. Otherwise players join the game during matchmaking automatically. You will most likely only ever use this for a server browser.

There is no hard requirement on where you need to call this from. Most games will probably have this hooked to the OnClicked event of a widget button.

#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

You find matches by using the FindKronosMatches node. This will give you an array of KronosSearchResult that you can iterate over (e.g. to create entries for a server browser).

There is no hard requirement on where you need to call this from. Most games will probably have this hooked to the OnClicked event of a widget button.

#include "KronosMatchmakingManager.h"
#include "KronosPartyManager.h"
#include "KronosMatchmakingPolicy.h"
// 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](UKronosMatchmakingPolicy* MatchmakingPolicy)
{
    // Parameters to be used for matchmaking.
    FKronosMatchmakingParams MatchmakingParams;
    MatchmakingParams.Playlist = TEXT("TeamDeathmatch");
    MatchmakingParams.MaxSearchAttempts = 3;
    MatchmakingParams.MaxSearchResults = 20;
    MatchmakingParams.MinSlotsRequired = 0;
    MatchmakingParams.bIsLanQuery = false;
    MatchmakingParams.bSearchPresence = true;
    
    // Matchmaking flags to use.
    // You could use EKronosMatchmakingFlags::SkipEloChecks.
    uint8 MatchmakingFlags = static_cast<uint8>(EKronosMatchmakingFlags::None);
    
    // Tell the matchmaking that we only want to search for sessions.
    EKronosMatchmakingMode MatchmakingMode = EKronosMatchmakingMode::SearchOnly;
    
    // Start matchmaking.
    // Notice that we are using NAME_GameSession!
    MatchmakingPolicy->StartMatchmaking(NAME_GameSession, MatchmakingParams, MatchmakingFlags, MatchmakingMode);
}));
Authentication