# Overview

The matchmaking system of Kronos is a complex state machine that automatically handles creating, finding, and joining sessions using the **Online Subsystem**.

## What Is A Session?

A session is the representation of an online room that exists on the online service's backend (e.g. the Steam servers). There are two types of sessions: **Game Sessions** representing online lobbies or matches, and **Party Sessions** representing online parties.

{% hint style="info" %}
In C++ session types are referred to as `SessionName`.
{% endhint %}

Session have a number of small data blocks assigned to them in the form of Key-Value pairs. These small data blocks are what we call **Session Settings**. These session settings are used by the matchmaking system to filter out session that do not match our search criteria. Some of the settings that Kronos uses include: "Playlist", "MapName", and "Game Mode".

## The Matchmaking Process

When matchmaking is started **sessions will be queried first**. If at least one session was found, the joining process starts. If no sessions were found, the matchmaking system will decide whether to start a new search, or whether it should switch over to hosting role - creating a new session.

The joining process consists of three steps. First we'll **request a reservation** for the session by establishing a lightweight connection with the session host, and asking him to reserve a spot for us in the session. This ensures that all party members will be able to join the session. Next we will attempt to **join the session** on the backend service (e.g. Steam servers) using the Online Subsystem. Once we've joined the session, we can **connect to the session host**. This is where the actual multiplayer stuff happens such as establishing the connection with the host, receiving the map to load, and spawning into the game.

**Session creation** is also part of the matchmaking process. It is pretty straight forward, first we'll create the session on the backend and then open a listen server for it.
