Integrating with Lyra Game

The Lyra Sample Game released by Epic Games proved to be popular among indie developers. This section will be helpful for those who want to integrate Kronos Matchmaking into the Lyra project.

Sessions in Lyra

All online features in Lyra are implemented in the Common User Plugin. This plugin was designed to be a base for other projects to use as a base when customizing Lyra. Its two main parts are the CommonUserSubsystem which handles user authentication, and the CommonSessionSubsystem which handles basic session operations such as hosting and joining online games.

Unfortunately the Common User Plugin tries to do things that Kronos also handles automatically. This results in kind of a conflicting situation where both plugins are trying to do the same thing on their own way. The best option would be to disable the Common User plugin entirely, however this isn't really an option due to the fact that it is integrated into the LyraGameMode and LyraGameInstance classes on a C++ level.

Fixing Code Issues

To get everything working we will need to make some small changes to the C++ code directly.

1. Generating C++ Project Files

  1. Go to your Lyra project folder.

  2. Right click on the .uproject file and select the "Generate Visual Studio Project Files" option. You must have Visual Studio installed to complete this step.

  3. Open the generated .sln file. This is the Visual Studio solution file that's been generated by Unreal Engine.

2. Modifying Build Files

  1. Add "Kronos" to PublicDependencyModuleNames in LyraGame.Build.cs.

  2. Comment out the NativePointerMemberBehaviorOverride line in LyraEditor.Target.cs file by placing two slash (//) characters before it. Currently Kronos does not make use of the TObjectPtr type for backwards compatibility reasons.

3. Disabling The Common Session Subsystem

  1. Open the CommonSessionSubsystem.cpp file. You can press Ctrl+T to quickly find files in the solution.

  2. Find the "Initialize" function. You can press Ctrl+F to quickly find the line.

  3. Comment out the "BindOnlineDelegates" and "FCoreUObjectDelegates::PostLoadMapWithWorld" lines by placing two slash (//) characters before them.

4. Configuring The Project

  1. Follow the steps outlined in the Configuration page of the documentation.

  2. Override the Online Session class in LyraGameInstance to use KronosOnlineSession. You may have already done this during the previous step, but it is important to do this in Lyra's game instance class since it is integrated into the project on a C++ level.

  3. Open the DefaultEngine.ini file and make sure to set bUseBeacons to false under the CommonSessionSubsystem config section. Kronos uses its own set of Online Beacons for matchmaking so Lyra should not handle this.

5. Build The Project

  1. Now you'll need to rebuild the project. To do this simply press Ctrl+B on your keyboard, or in the top menu press Build -> Build Solution. Please note that this may take a while...

  2. If the build succeeded you can start the project and begin using Kronos Matchmaking!

Implementing Authentication

Since Lyra already handles authentication for us, we will have to make sure that Kronos does not interfere in any way. To do this, go to Edit -> Project Settings -> Kronos Matchmaking, and under authentication enable the "AuthenticateUserAutomatically" and "AuthenticationIsPassthrough" options. The latter is hidden inside the Advanced dropdown.

Implementing Matchmaking

Lyra has its matchmaking functionality started from widget blueprints such as the experience selection screen and the host session screen. You will need to open up those widgets and replace the matchmaking nodes found in them with their Kronos counterparts.

Blueprint nodes for the examples above do not render perfectly on the website, but they will give you a good idea about what you need to change. If you need further assistance please reach out directly.

Fix Reservation Cleanup

Lyra does not use the standard way of disconnecting from online matches through the HandleDisconnect function. I assume Epic did this to allow sending parameters to the main menu map when returning. For now we will have to call DestroyReservationBeacons manually.

  • Hook up DestroyReservationBeacons in "UI/Hud/W_LyraGameMenu" for when the return button is clicked and the open level call has been made. Maps are always loaded in the next frame so it is safe to handle this at the end: https://blueprintue.com/blueprint/busdki-e/

Last updated