An Unreal Engine Plugin used to manage an online subsystem
Developed in Unreal Engine 5.3. Works on any Unreal Engine 5 Version.
Tired of the Advanced Sessions Plugin?
This is the new one!
Much more modular and should work right out of the box.
EnhancedOnlineSessions Subsystem that helps communicating with the online service.
Supports STEAM, Epic Online Services (EOS) and EOS Plus.
Including platform specific settings which can be changed inside the Editor.
Well my goal was to make this plugin as modular as possible that it works with any other project.
The entire online service logic is stored into a custom UGameInstanceSubsystem.
💡 Suggestions or Feedback is much appreciated: My Discord Account. Feel free to DM me any time! 🙂
- Setup
1.1 Configure your Project using the Online Subsystem of your Choice
1.2 Structure of the Enhanced Sessions
1.3 Session Maps- Sessions
2.1 Host Online Sessions
2.1.1 Host Session
2.1.2 Host Peer 2 Peer Lobby
2.2 Start Session
2.3 Find Sessions
2.3.1 Get Current Players
2.3.1 Get Max Players
2.3.1 Get Session Friendly Name
2.3.1 Get Ping in Ms- Identity
3.1 Login User
3.2 Kick Player
3.2 Ban Player
3.2 Change Player Name- Friends
3.2 Coming Soon...
In Project Settings > Plugins
there is a section called Online Enhanced Subsystem.
Here you can select the Online Subsystem of your Choice and configure its parameters.
This will write the changes directly into the DefaultEngine.ini
so you wont have to do that manually anymore :)
📝You will be prompted to restart the Editor after.
💡The Enhanced Sessions Subsystem follows a consistent structure.
All the necessary functions are stored inside theEnhancedOnlineSubsystem
These function will always take in a request object, which defines the action that you want to perform.
Every request will have multiple callbacks, that you can bind functions to (Based on the request type).
However, every request will have an OnFailedDelegate
which will be called if the request fails and the log why the request may have failed will be passed through.
If you want to use a Level for an Online Session you would need to tell the Asset Manager
about its existence.
To do that you would need to go inside your Project Settings -> Asset Manager
And then make sure to uncheck Is Editor Only
and add the Directory where your Level is located.
An online session is basically an instance of the game running on the server with a given set of properties which is either advertised so that it can be found and joined by players wanting to play the game or private so only players who are invited or notified of it in some way can join.
The basic lifetime of a sessions is:
- Host a new session with desired settings.
- Wait for players to request to join the session.
- Register players who want to join.
- Start the session.
- Play the match.
- End Session or destroy the session.
To Host an Online Session you need to call the HostOnlineSession
function which you can find in the EnhancedOnlineSubsystem.
This takes in a HostSessionRequest.
There are two different types of sessions you can host:
To host a Session you need to construct an Online Host Session Request.
Note that this will automatically travel to the map you selected in Map Id.
💡 If you are not able to find your Map in
Map Id
checkout Session Maps and make sure you have setup everything correctly.
Parameter | Description |
---|---|
Online Mode: | Defines the online mode of the session. You can choose from: Offline / Online / LAN. The Online Mode: "Online" adds ?listen to the travel url so you would not need to add that manually to the Travel URL Operators |
Max Player Count | The maximum number of players that can be in the Session. |
Map Id | Primary Asset Structure of the map you want to travel to, when the Session gets created. |
Travel URL Operators | Adds additional operators that will be apended to the Travel URL. |
Friendly Name | The friendly name of the session that will be used to display the Session name in the UI. |
Search Keyword | The searchkeyword can be used for different scenarios. If you use EOS you will notice that this is the official SEARCH_KEYWORD combined with the Session. However you can also use it with any other online subsystem to filter your Session Results, depending on what Sessions you want to find |
Use Lobbies if Available | Sets if the session should use player hosted Lobbies. |
Use Voice Chat if Available | Some online services provide Voice Chat. This Settings defines if we use the Voice Chat. |
Game Mode Advertisement Name | The advertisement name of the game mode that your session currently has. Can be used to advertise your session like Team Deathmatch, etc. |
Is Presence | Defines if the hosted session should use Presence (Account Services) |
Allow Join in Progress | Sets if other players can join the session when the session already is in progress. This can be used to disable joining when your game has been started. |
On Failed Delegate | Delegate that will be called when the request failed for some reason. |
To host a Peer 2 Peer Lobby you need to construct a Host P2P Lobby Request.
💡Note that this will NOT travel to a different map, as the P2P Lobby stays in the current level and you need to server travel manually.
Very similar to Host Online Session, this takes in a few parameters:
Parameter | Description |
---|---|
Online Mode | Defines the online mode of the session. You can choose from: Offline / Online / LAN. |
Max Player Count | The maximum number of players that can be in the Session. |
Friendly Name | The friendly name of the session that will be used to display the Session name in the UI. |
Search Keyword | The searchkeyword can be used for different scenarios. If you use EOS you will notice that this is the official SEARCH_KEYWORD combined with the Session. However you can also use it with any other online subsystem to filter your Session Results, depending on what Sessions you want to find |
Use Voice Chat if Available | Some online services provide Voice Chat. This Settings defines if we use the Voice Chat. |
Game Mode Advertisement Name | The advertisement name of the game mode that your session currently has. Can be used to advertise your session like Team Deathmatch, etc. |
Is Presence | Defines if the hosted session should use Presence (Account Services) |
Allow Join in Progress | Sets if other players can join the session when the session already is in progress. This can be used to disable joining when your game has been started. |
On Succeeded Delegate | This Delegate will be called whenever the lobby creation was a success. |
On Failed Delegate | Delegate that will be called when the request failed for some reason. |
Rest of the documenation is currently in progress...
Starting a session basically sets its current state to InProgress
meaning the the session is now registered as in progress in the online subsystem you are using.
This also blocks other players from joining if you disabled the option Allow Join in Progress
in Host Online Sessions.
To start the session you would need to call the Start Online Session
function which you can find in the Enhanced Online Subsystem
This takes in a Start Session Request.
Parameter | Description |
---|---|
On Succeeded Delegate | Delegate that will be called when the Start Session Request succeeded and the current session is now set to be in progress. |
On Failed Delegate | Delegate that will be called when the request failed for some reason. |
As you can see this request does not take in any additional inputs, since you are only able to start the current session you are in.
You could use the On Succeeded Delegate
to start the match and a timer for example.
📝 You dont have to start a session to start the match. Starting a session is more like a helper which the engine provides to help you doing the session management. Meaning that your game would still work fine if you dont start your session.
The most basic form of searching for sessions is the classic server browser that shows all available games and allows the player to filter those based on the type of game they want to play and then choose one to join one of the sessions that match those criteria.
To find these sessions you would need to call the Find Online Sessions
function which you can find in the Enhanced Online Subsystem.
This takes in a Find Sessions Request.
Parameter | Description |
---|---|
Online Mode | Defines the online mode of the session you want to filter for. You can choose from: Offline / Online / LAN. |
Max Search Results | The maximum number of sessions which can be found by the player requesting the find sessions. |
Find Lobbies | Whether we want to find player hosted lobbies. |
Search Keyword | Takes in an optional keyword if you want to filter the sessions you want to find. This Keyword can be assigned to a session in Host Online Sessions. |
On Succeeded Delegate | Delegate that will be called when the Find Sessions Request succeeded and we have a list of found sessions. |
On Failed Delegate | Delegate that will be called when the request failed for some reason. |
Returns the number of current players which are inside the session search result.
Parameter | Description |
---|---|
Search Result | The session search result you want to read the current players from. |
Returns the maximum amount of players which could be possibly inside the session search result.
Parameter | Description |
---|---|
Search Result | The session search result you want to read the maxplayers from. |
Returns the friendly name of the session search result. The friendly name can be assigned to a session in Host Online Sessions.
Parameter | Description |
---|---|
Search Result | The session search result you want to read the friendly name from. |
Pings the session search result and returns the ping duration in ms.
📝 Some online subsystems do not support that action or require further work to make this working.
Parameter | Description |
---|---|
Search Result | The session search result you want to ping. |