Party
In order to access online features, the player must be logged in with the Online Subsystem. Please visit the Logging In page for more information.
Overview
Parties can be created directly in the main menu. The player who creates the party will become the party host. Other players will be able to connect to the party by accepting a party invite, or by matchmaking for it (if the party is not private of course). When the party host is joining a session, party clients will automatically follow the host into the session.
Parties are implemented using OnlineBeacons
. Let's take a look at the different classes that make up a party.
Class | Description |
---|---|
KronosPartyListener | Beacon listening for client connections. This is essentially the server that other players connect to. Only exists on the server. |
KronosPartyHost | Beacon that handles party client connections. Similar to the |
KronosPartyClient | Beacon that connects to the remote host. It represents a player in a party. Similar to the |
KronosPartyState | Shared state of the party. Similar to the |
KronosPartyPlayerState | Lightweight representation of a player while connected to a party. Similar to the |
KronosPartyPlayerActor | An actor that visually represents a party member in the game world. Not replicated, they are always created locally both by the server and the client. |
Creating Parties
As an example, let's say we want to create a party for up to 5 players. I'll be reacting to the OnClicked
event of a button inside a UMG widget, but feel free to do this wherever it makes sense for you, like the GameInstance
for example.
You will most likely want to create private parties, and invite your friends into it. To do this, all you have to do is disable the "ShouldAdvertise" param and enable the "AllowInvites" param.
If your Online Subsystem requires the session to be advertised for some reason, you can create hidden sessions instead by enabling both the "ShouldAdvertise" and the "Hidden" params. Hidden sessions can only be found during specific session queries (in which case other filters will prevent us from finding this session accidentally if it was not the target).
The "StartingLevel" param is irrelevant when creating a party.
Joining Parties
When accepting a party invite, players join the party automatically!
If for some reason the invite approach doesn't suit your needs, you can also start matchmaking for parties just like you would for matches. You can join a party directly after finding the session via a search.
Sending Party Invites
You can send party invites to your friends using the online service's external invite UI through the Online Subsystem (e.g. Steam Overlay). When the user accepts the invite, they will join the party automatically.
Additionally, you can also use the SendPartyInviteToFriend
function in KronosStatics
. This function requires the friend's unique id. You can get a list of online friends via the ReadUserFriendsList
async node.
Initializing Players
All players including the party host will have a KronosPartyClient
beacon created when they join the party. This is the main class that can be used to interact with the party. It's basically the equivalent of the PlayerController
in the Unreal game framework.
ServerInitPlayer:
Server side player initialization. If you have a backend service this is a good place to read the player's skill rating, fetch cosmetics, etc.ClientInitPlayer:
Client side player initialization.
Party Player Data
The KronosPartyPlayerState
includes a Player Data framework that automatically replicates an integer array to all players. This makes it very easy to advertise data about each player, such as their profile level, the banner that they are using, or the character / class they are going to play.
The LobbyPlayerState
also has a player data framework, and this system is explained there in more detail. Please check out the Lobby page for more information.
Please note that BeaconPlayerStates
don't have RPC capabilities, so the player data can only be changed through their owning KronosPartyClient
class instead.
SetPlayerData
: Used to set the player data. Overrides previous player data entirely.GetPlayerData
: Used to read the player data using theKronosPartyPlayerState
.Player data can be initialized during the
ServerInitPlayer
andClientInitPlayer
events.
Party Player Skill Rating
The KronosPartyPlayerState
also tracks the owning player's skill rating.
Please note that BeaconPlayerStates
don't have RPC capabilities, so the skill rating can only be changed through their owning KronosPartyClient
class instead.
SetPlayerElo
: Used to set the player's skill rating.GetPlayerElo
: Used to read the player's skill rating using theKronosPartyPlayerState
.Skill rating can be initialized during the
ServerInitPlayer
andClientInitPlayer
events.
The player's skill rating must be set properly for the GetPartyEloAverage
helper function to work!
Party Player Actors
As of version 1.8.0, the party system has the ability to spawn a KronosPartyPlayerActor
for each party member in the party. The spawning is handled automatically, you just have to select which class to spawn in the KronosPartyState
. These player actors are not replicated, they are always spawned locally.
To define where these player actors should be spawned, you'll have to place KronosPartyPlayerStart
actors into your level. You can find this actor in the "Place Actors" tab on the left in the "Kronos Matchmaking" category. After placing these into the level, one of them should be marked as the local player start (by toggling the param on it).
The example content provided with the plugin showcases how this feature works. The example blueprints also contain additional information.
Leaving Parties
You can leave a party at any time using a simple function call. Please keep in mind that if the party host leaves, the party will be disbanded.
Limitations
Parties are created on the hosting player's machine. They do not exist on a backend service. Due to this and due to the nature of OnlineBeacons
:
Parties are disbanded when initiating a map change.
As of version 1.9.0, party reconnection is supported by the plugin! Although parties are still going to be disbanded, it is now possible to recreate and reconnect parties after returning to the main menu. For more information please visit the Reconnect Parties page of the documentation.
Last updated