# Creating Matches

In order to access online features, the player must be logged in with the **Online Subsystem**. Please visit the [**Authentication**](/kronos-matchmaking/usage/authentication/authenticating-users.md) page for more information.

## Creating The Match

To create a match (also knows as **Game Session**), use the `CreateKronosMatch` node. To make the required host parameters simply drag off of the "Host Params" property and search for "make".

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.

{% tabs %}
{% tab title="Blueprints" %}

<figure><img src="/files/DlEvBh0lF61ArvoMav12" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
#include "KronosMatchmakingManager.h"
#include "KronosMatchmakingPolicy.h"
```

```cpp
// 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 when matchmaking results in creating a session.
    FKronosHostParams HostParams;
    HostParams.StartingLevel = TEXT("MyMap");
    HostParams.Playlist = TEXT("TeamDeathmatch");
    HostParams.MaxNumPlayers = 4;
    HostParams.bShouldAdvertise = true;
    HostParams.bHidden = false;
    HostParams.bIsLanMatch = false;
    HostParams.bUsesPresence = true;
    
    // Initialize matchmaking params from the host params.
    // Only the host params matter when starting matchmaking in CreateOnly mode.
    FKronosMatchmakingParams MatchmakingParams = FKronosMatchmakingParams(HostParams);
    
    // No matchmaking flags needed.
    uint8 MatchmakingFlags = static_cast<uint8>(EKronosMatchmakingFlags::None);
    
    // Tell the matchmaking that we only want to create a session.
    EKronosMatchmakingMode MatchmakingMode = EKronosMatchmakingMode::CreateOnly;
    
    // Start matchmaking.
    // Notice that we are using NAME_GameSession!
    MatchmakingPolicy->StartMatchmaking(NAME_GameSession, MatchmakingParams, MatchmakingFlags, MatchmakingMode);
}));
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
After the match is created the player will join the game automatically. You do not need to do anything else.
{% endhint %}

### The Starting Level Param

The "Starting Level" will be the map that is opened in listen-server mode when the session is created. I'm going to use the [**KronosExampleLobby**](/kronos-matchmaking/examples/example-content.md) map that is provided with the plugin for demonstration, but you can use any map here. It doesn't have to be a lobby map either. The map name can be given in the following forms (without the quotes):

* Short package name: "KronosExampleLobby"
* Long package name: "/Kronos/Examples/Maps/KronosExampleLobby" (recommended)

<figure><img src="/files/o9LeyWQWAvgS8vVPxizn" alt=""><figcaption></figcaption></figure>

### The Playlist Params

The "Playlist", "Map Name", and "Game Mode" params are purely cosmetic information used for session filtering. These are the parameters that the matchmaking system will match when searching for sessions to join. They can be left empty if not needed for the project. As an example I'm going to set my playlist params to the following (without the quotes):

* Playlist: "PVP"
* Map Name: "Hangar"
* Game Mode: "Deathmatch"

Again, these are purely cosmetic information on the session. They do not alter gameplay, or the game mode class that is used by the "Starting Level" in any way.

### Session Visibility&#x20;

Whether the match is public or private is dictated by the "Should Advertise" param. Private sessions cannot be found by matchmaking. The only way to join them is by using invites.

You can also create hidden sessions by enabling both the "Should Advertise" and "Hidden" params. Hidden sessions are very useful when you want to create a private match, but your **Online Subsystem** requires sessions to be advertised to be joinable by other players. Hidden sessions can only be found during specific session queries (e.g. following party to a specific session).

### Extra Session Settings

The "Extra Session Settings" param allows you to add custom **Session Settings** to the session. These session settings are simple Key-Value pairs that can be advertised with the session. The matchmaking system can use them to filter out sessions by using **Query Settings** to compare against them.

Players can also read the value of each session setting once they have access to the session (e.g. player is in the session, or it was found after a search).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://horizongames.gitbook.io/kronos-matchmaking/usage/matchmaking/creating-matches.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
