Game Server SDK Reference #
This section provides references for Game server methods, classes, and events in the Pragma SDK for Unreal and Unity. For information on Pragma Engine backend classes and plugins, see Game Server Backend Reference.
The Pragma SDK provides methods that developers can use to facilitate game instance processes, such as connecting more players or ending the game. The SDK includes methods for game server use through the MatchApi
. The tables below contains a list of all the methods relevant to game server tasks.
Match API SDK methods #
method | description | |
---|---|---|
RequestStartGame() | Requests the game start data for a game instance. Use this method when Pragma does not manage your game server capacity. | |
ConnectPlayers() | Connects the initial players for a game instance | |
ConnectMorePlayers() | Connects more players for a game instance | |
VerifyPlayer() | Uses player connection token to verify that connecting players are not misrepresenting their Pragma identity | |
UpdateGameInstance() | Requests game instance data updates | |
RemovePlayers() | Removes players from a game instance and processes player game results. Does not end the game instance. | |
EndGame() | Request that a game instance end. Does note automatically end the game instance. | |
EnterMatchmaking() | Enters a game instance into matchmaking to accept additional players | |
LeaveMatchmaking() | Removes a game instance from matchmaking | |
SetRichPresence() | Sets a player’s rich presence based on server-side options (such as “in party”) |
The SDK calls invoke various plugins through service RPCs.
Unreal classes #
FPragma_GameInstance_GameStart #
property | description | |
---|---|---|
GameInstanceId | game instance ID | |
Players | Array of Pragma_GameInstance_GameServerPlayer | |
Ext | FPragma_GameInstance_ExtGameStart | |
IsInMatchmaking | Whether or not the game instance is in matchmaking |
FPragma_GameInstance_GameServerPlayer #
property | description | |
---|---|---|
PlayerId | player ID | |
PartyId | party ID the party the player is in | |
TeamNumber | player’s team number | |
Ext | FPragma_GameInstance_ExtGameServerPlayer |
Events #
There are several game server-related events that player clients and game servers can listen to. The following tables contain bindable events relevant to game server operations, along with associated descriptions of when the event is triggered.
Player client events #
The following events are handled by the player client.
Event | Trigger | Data returned |
---|---|---|
OnFailedToAllocateGameInstance | Game instance allocation fails due to game server issues after matchmaking succeeds | N/A |
OnHostConnectionDetailsReceived | The game server starts a game instance and is available for parties to connect | GameInstance |
OnRemovedFromGameInstance | The game server has removed the player from the game | game instance ID, ExtRemovedFromGame |
Game server events #
The following events are handled by the game server.
Event | Trigger | Data returned |
---|---|---|
OnGameStart | A game instance is started. The game server receives game instance data on this event. | FPragma_GameInstance_GameStart |
OnGameStartFailed | An error occurs when attempting to retrieve game instance data with the provided game instance ID | Pragma error |
OnKeepAliveFailed | The platform fails to process a keep alive request | game instance ID, Pragma error |
OnPlayersAdded | The platform adds players to a game game instance. Upon receiving, the game server should invoke ConnectMorePlayers with prepared details for the provided new players for the provided game instance ID. | game instance ID, list of FPragma_GameInstance_GameServerPlayer |
OnPlayersRemoved | Players are removed from the game instance by the backed. | game instance ID, list of FPragma_GameInstance_GameServerPlayer |
OnGameInstanceEnteredMatchmaking | The given active game instance enters matchmaking | game instance ID |
OnGameInstanceLeftMatchmaking | The given active game instance leaves matchmaking | game instance ID |