Server Transfers
The transfer APIs allow you to move players between servers. You can access server transfer functions using Platform.Server.Transfer
.
Transfer Functions
Transfer to Game
Transfers a group of players to the given game, additionally you can provide a preferred server ID. This preferred server ID can be on any scene. Access checks will be applied for all players. If any players cannot be transferred to the preferred server, a default server will be found or created and all players will be transferred there.
Transfer to Matching Server
This function uses the parameters you provide to find a game server for a group of players. This function does not check that players are allowed to access the matching server. If you want to use access checks, use the "TransferToServer" function.
This function is useful for cases where you already know access is allowed, or you explicitly want to ignore access rules.
Transfer to Server
This function allows you to transfer a group of players to a specific server ID. If any players are unable to access the provided server ID, the function will fail. If you want to ignore access checks, use the "TransferToMatchingServer" function instead.
Transfer to Player
Transfers a group of players to a target player. If any of the players are unable to access the server the target player is on, the players without access will be left behind and remain in their current server.
Common Behaviors
There are a few common behaviors for all transfer functions:
A player can only be transferred by a game server if the player is currently playing that game.
Any game server can transfer any player playing the game.
Transfers are not guaranteed. It is possible for the client to cancel or ignore the transfer request. The success value returned by the API only indicates that the transfer request was submitted, not that the transfer has occurred.
Generally transfers happen almost instantly, but it is possible for a transfer to occur after a few minutes depending on server availability and startup time.
Starting Scenes
When a server is created, a starting scene is provided to the server. This starting scene is recorded for the lifetime of the server, and is used when deciding how to route players to a server. If the server changes its scene while running, server selection and transfer behavior will not be affected and the starting scene will continue to be used.
TransferToServer()
Ignores the server starting scene entirely. Players are always moved to the server if access is allowed.
TransferToGame()
Will first attempt to transfer the players to the preferred server first, this attempt does not check the starting scene. If the preferred server cannot be joined, a server on the default scene is found or created instead.
TransferToMatchingServer()
Matches the starting scene provided in the configuration parameters. If no sceneId is provided, any scene will be accepted.
TransferToPlayer()
Ignores the server starting scene entirely. Players are always moved to the server if access is allowed.
Access Modes
All game servers are assigned an access mode when they are created. Access modes control which players can join a given game server and the methods by which they can join the server. Default servers a client joins through the main menu will always have the "Open" access mode. You can create servers with different access modes using the CreateServer
function.
Open
Any player is allowed to join the server.
Closed
Clients cannot join the server through their friends list or client side transfer requests. Players can only join if a game server requests the transfer. This is the default mode for new servers created with CreateServer()
Friends Only
Only users that have friends on the server can join. Server side transfer requests will also respect this mode. This means that the first player to join the server must be transferred using TransferToMatchingServer (see examples below).
Transfer Data
When transferring a player or group of players, you can optionally specify a few configuration fields:
clientTransferData
An object that will be passed to the client. This is also visible to the server they join.
serverTransferData
An object that will be passed to the game server when the client joins. This is not visible to the client.
loadingScreenImageId
Common Patterns
Transfer Players to Default Servers
Create a Match Server Anyone Can Join
Find or Create a Server
Create a Private Match
Transfer to Another Player
Create a Friends Only Match
Last updated