Unreal Engine 5 Multiplayer
β Last Updated : September 13, 2022
πͺ Prerequisite Knowledge (Optional)
Describe Initial Knowledge that reader need to know before reading this article
β Key Question / Problem / Issue
Describe what question / Problem / Issue this knowledge should answer
β Expected Output/Definition of Done
Define what information you really need and the definition of done
π Resulting Solution
Unreal Engine Multiplayer System
Unreal Engine uses an authoritative client server model. This means that one machine will always act as the server, and other machines will connect to it as clients.
The server version is the authoritative version and at all times is considered the correct version of the game. When running a single player game in unreal engine, you're still using the client server model. It just so happens that the client and server are the same machine.
Online Subsystem
Online subsystem class is contains several interfaces which have capabilities related to multiplayer games sessions. The Sessions interface, is designed to handle setting up and joining game sessions.
The online subsystem provides a way to access the functionality of online platform services by online platforms, for example Steam, Xbox Live and so on.
Each of these platforms has its own set of services support for things like friends, achievements, setting up matchmaking sessions, etc. The online subsystem contains a set of interfaces designed to handle these different services for each platform.
The online subsystem is a class of type IOnlineSubsystem
, which can be accessed through the static function get that belongs to that class. This returns a pointer to the online subsystem of type pointer to IOnlineSubsystem
. Once we have that online subsystem, we can access the different interfaces that we mentioned earlier. The interface that we're most concerned for multiplayer is the Session Interface.
Session Interface Online Subsystem
The Session Interface handles creating, managing and destroying game sessions. It also handles searching for sessions and other matchmaking functionality. A session can be thought of as an instance of the game. Running on the server with a set of properties and a session can be advertised so other players can find the session and join in or private, so only people with an invite can join the game.
The basic lifetime of a typical game session looks like this image below.
First you create the session with the set of desired settings. Then you wait for other players to join and register each one as they come in. Once enough players join you start the session, then each player is in the same session playing the game. Once the match is over, you can end the session and unregistered the players. You then can either update the session changing the settings for the match.
To start adding multiplayer session to your Unreal project, go to [Unreal Engine 5 Setup Multiplayer](Unreal Engine 5 Setup Multiplayer efa656449d864b17ae2138fdc19d2ba1.md) documentation.
No Comments