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
  • Setting Up The Level Selector Widget
  • 1. Creating The Level Selector Widget
  • 2. Setting Up The Level Variables
  • 3. Modifying The Level Variables
  • 4. Creating the "Get Selected Level" Function
  • 5. Adding the Widget To The Screen
  • Using The Level Selector
  • 1. Get Selected Level When Creating The Match
  • 2. Get Selected Level For Matchmaking
  • 3. Starting The Selected Level From The Lobby
  1. Guides

Creating a Level Selector

PreviousGuidesNextIntegrating with Lyra Game

Last updated 10 months ago

This guide will show you how to manipulate the KronosHostParams at runtime to allow players to select which map they want to play on.

The guide will build on top of the section directly, so it is assumed that you already have a basic understanding about how matchmaking works, and you already have a widget setup where you can start matchmaking from.

Setting Up The Level Selector Widget

1. Creating The Level Selector Widget

Let's start by creating the user interface of the level selector. Create a simple UserWidget blueprint and add Buttons to it which will represent the different maps that can be selected. Alternatively you can also use a ComboBox if you want to select the level from a dropdown menu instead.

2. Setting Up The Level Variables

Create two new String variables inside the widget:

  • SelectedLevelName: This will be used as the "Map Name" for matchmaking.

  • SelectedLevelPath: This will be the actual map that we travel to.

3. Modifying The Level Variables

Now we will update the level variables when the level buttons are clicked. I'm also going to hook up the OnInitialized event of the widget with the same logic as the first button to ensure that the level variables are never empty.

To make the selected level visible, we can change the tint of the buttons when they are clicked. Here is how you can tint the first button for example:

4. Creating the "Get Selected Level" Function

5. Adding the Widget To The Screen

Add the level selector widget to the widget where your matchmaking buttons are located. In my case they are in the main menu widget so I will add it there and enable "Size To Content". Make sure to enable the "Is Variable" option on the widget to make it accessible in the blueprint graph.

Using The Level Selector

Now that we have the level selector in the same widget as the matchmaking buttons, we can switch over to the blueprint graph and update our matchmaking logic accordingly.

1. Get Selected Level When Creating The Match

Instead of filling out our host params manually by hand, we can now use the GetSelectedLevel function of the level selector widget that we created earlier.

Here comes a bit of an issue though. If we simply use the SelectedLevelPath as the "Starting Level" there won't be a lobby map before the match.

Let's use the FString as the type, and name it "GameLevel". We can also disable the "Advertise" option because this setting is only relevant to the hosting player.

2. Get Selected Level For Matchmaking

If you want to start matchmaming for the selected level, connect the level name to the "Map Name" param of your KronosMatchmakingParams. This tells the matchmaking system to find a match for the selected map.

3. Starting The Selected Level From The Lobby

Now all we have to do is simply get the selected level from the session when the match is being started in the lobby. Find the OnMatchStarted event of your KronosLobbyGameMode and use the GetGameSessionSetting function to get the selected level from the session.

Now the lobby will transition into the map that was selected in the main menu.

Create a new function named GetSelectedLevel. We will use this to easily access our level variables when filling out our matchmaking params. Make this a by enabling the "Pure" option. This makes the node not require an execution pin. Also make sure that the function is public to make it accessible outside the widget.

To fix this, we will add a custom to the session that will store the selected level. We can use the "Extra Session Settings" param of the KronosHostParams to easily add custom settings to the session. If you do not see this param, click on the little arrow at the bottom of the host params.

Alternatively you could infer the map path from the "Map Name" param itself. The for example uses a Data Table to determine which map path corresponds to the any given "Map Name".

Pure Function
Sample Project
Getting Started
Session Setting