Blueprint integration

Learn how to use the Blueprint Visual Scripting system in the Unreal Engine to integrate with the Multiplay Game Server SDK.

The Multiplay Game Server SDK can interact with the following interfaces:

Install the Multiplay Game Server SDK plug-in

Before proceeding, make sure the Multiplay Game Server SDK plug-in is properly installed.

Multiplay Server Config Subsystem

This subsystem has the server configuration for the current session.

This subsystem retrieves this information from the server.json file on subsystem initialization.

You can retrieve the server configuration by placing a MultiplayServerConfigSubsystem node and accessing the Server Config variable.

Server Config has the following values:

  • A server ID
  • An allocation ID
  • A Server Query Protocol Port
  • A connection port for the session
  • A directory in which the game server saves log files

Multiplay Game Server Subsystem

The Multiplay Game Server Subsystem allows you to subscribe (and respond) to game server events, such as when a game server becomes allocated and when a game server is ready for players. Refer to Game server lifecycle and Server readiness.

> Note: The Multiplay Game Server SDK has a full implementation of Unity’s Server Query Protocol, so the game server only needs to populate the variables. Refer to Server Query Protocol.

Use the instance of MultiplayGameServerSubsystem to interact with the Multiplay Game Server Subsystem through the following Blueprints:

SubscribeToServerEvents

After you have an instance of MultiplayGameServerSubsystem, you can use the Subscribe Blueprint to subscribe to Multiplay events, including OnAllocate, ReadyServerForPlayers, UnreadyServer, and OnDeallocate.

After subscribed to events, the game server must wait for an allocation. Use the OnAllocate Blueprint to enable the game server to know when it has been allocated.

OnAllocate

Use this Blueprint as an opportunity to perform any setup logic necessary before players can join the game server for a game match, such as loading game assets and starting backfill with ReadyServerForPlayers.

After performing any setup logic to allow players to join the game server, you can inform Multiplay that the game server is ready to accept players with the ReadyServerForPlayers Blueprint.

ReadyServerForPlayers

Use this Blueprint to let Multiplay know when a game server is ready to accept players for a game match.

If at any point the state of the game match changes so that you no longer want to accept new players, use the UnreadyServer Blueprint to let Multiplay know that the game server is no longer ready to accept players.

UnreadyServer

Use this Blueprint to let Multiplay know that the game server is no longer ready to accept players.

Scenarios in which you might want to use the UnreadyServer Blueprint include:

  • A game match is almost complete
  • A game match is complete
  • The game server is full

OnDeallocate

Use this Blueprint to know when Multiplay is deallocating the game server. The OnDeallocate Blueprint provides an opportunity to perform any last-minute cleanup or bookkeeping necessary before the game server shuts down.

Multiplay Server Query Handler Subsystem

The Multiplay Server Query Handler Subsystem allows you to set game server variables monitored by the game server query protocol. This implementation uses SQP. Refer to Server Query Protocol.

You can use the UMultiplayServerCheckSubsystem to:

Setting Blueprints

Use the following setting Blueprints to set the query values for the game server. These setting Blueprints include SetCurrentPlayers, SetMaxPlayers, SetServerName, SetGameType, SetBuildId, SetMap, and SetPort.

SetCurrentPlayers

Use this Blueprint to set the number of players connected to the game server.

SetMaxPlayers

Use this Blueprint to set the maximum number of players that can connect to the game server.

SetServerName

Use this Blueprint to set the current name of the game server.

SetGameType

Use this Blueprint to set the current game the game server.

SetBuildId

Use this Blueprint to set the current build ID of the game server.

SetMap

Use this Blueprint to set the current map of the game server.

SetPort

Use this Blueprint to set the port number of the game server.

This is the port number from which the game client can connect to the game server. It's separate from the query port number.

Make sure to continuously update these values as they're bound to change during the game. This ensures Multiplay collects and displays data while the server is running. After setting all the values, you can add the Connect Blueprint.

Connect Blueprint

Use this Blueprint to establish a connection to the game server. You must establish a connection to the game server before using any of the Accessor Blueprints.

Accessor Blueprints

Use this Blueprint to access the values you set. These Accessor Blueprints include GetCurrentPlayers, GetMaxPlayers, GetServerName, GetGameType, GetBuildId, GetMap, and GetPort.

GetCurrentPlayers

Use this Blueprint to get the current number of players connected to the game server.

GetMaxPlayers

Use this Blueprint to get the maximum number of players allowed to connect to the game server.

GetServerName

Use this Blueprint to get the current name of the game server.

GetGameType

Use this Blueprint to get the current game the game server.

GetBuildId

Use this Blueprint to get the ID of the build the game server is running.

GetMap

Use this Blueprint to get the current map of the game server.

GetPort

Use this Blueprint to get the current port of the game server.

This is the port that the game client uses to connect to the game server, not the query port.

Disconnect Blueprint

Use this Blueprint to disconnect from the game server before shutting it down.