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
Go to your Lyra project folder.
Right click on the
.uprojectfile and select the "Generate Visual Studio Project Files" option. You must have Visual Studio installed to complete this step.Open the generated
.slnfile. This is the Visual Studio solution file that's been generated by Unreal Engine.
2. Modifying Build Files
Add "Kronos" to PublicDependencyModuleNames in
LyraGame.Build.cs.Comment out the NativePointerMemberBehaviorOverride line in
LyraEditor.Target.csfile by placing two slash (//) characters before it. Currently Kronos does not make use of theTObjectPtrtype for backwards compatibility reasons.

3. Disabling The Common Session Subsystem
Open the
CommonSessionSubsystem.cppfile. You can press Ctrl+T to quickly find files in the solution.Find the "Initialize" function. You can press Ctrl+F to quickly find the line.
Comment out the "BindOnlineDelegates" and "FCoreUObjectDelegates::PostLoadMapWithWorld" lines by placing two slash (//) characters before them.

4. Configuring The Project
Follow the steps outlined in the Configuration page of the documentation.
Override the Online Session class in
LyraGameInstanceto useKronosOnlineSession. 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.Open the
DefaultEngine.inifile and make sure to setbUseBeaconsto 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
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...
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.
Hook up
CreateKronosMatchin "UI/Menu/Experiences/W_HostSessionScreen" for when an experience was selected: https://blueprintue.com/blueprint/f34jju17/Hook up
StartKronosMatchmakingin "UI/Menu/Experiences/W_ExperienceSelectionScreen" for the quickplay button: https://blueprintue.com/blueprint/__brjfzz/Hook up
CancelKronosMatchmakingin "UI/Menu/Experiences/W_ExperienceSelectionScreen" for when the widget is deactivated: https://blueprintue.com/blueprint/oobjpcza/
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
DestroyReservationBeaconsin "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