PlayerIO

The fastest way to build online games without breaking a sweat.

Unity3D Client Reference

Multiplayer  class documentationClass Multiplayer

Namespace: PlayerIOClient
Language: C# / .NET

The Player.IO Multiplayer Service

.

Properties

 
public ServerEndpoint
DevelopmentServer

If not null, rooms will be created on the development server at the address defined by the server endpoint, instead of using the live Player.IO serveer. If not null, property GameServerEndpointFilter is ignored.

public GameServerEndpointFilterDelegate
GameServerEndpointFilter

If not null, allows you to filter, rearrange, or completely redefine the game server enpoints. Endpoints are tried one after the other until there is one successful connection to a game server. If DevelopmentServer property is not null, this property is ignored.

public bool
UseSecureConnections

If true, the multiplayer connections will be encrypted using TLS/SSL. Beaware that this will cause a performance degredation by introducting secure connection negotiation latency.

Methods

 
public void
CreateJoinRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Dictionary<string, string> joinData, Callback<Connection> successCallback)

Creates a multiplayer room (if it does not exist already) and joins it.

public void
CreateJoinRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Dictionary<string, string> joinData, Callback<Connection> successCallback, Callback<PlayerIOError> errorCallback)

Creates a multiplayer room (if it does not exist already) and joins it.

public void
CreateRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Callback<string> successCallback)

Create a multiplayer room on the Player.IO infrastructure

public void
CreateRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Callback<string> successCallback, Callback<PlayerIOError> errorCallback)

Create a multiplayer room on the Player.IO infrastructure

public void
JoinRoom (string roomId, Dictionary<string, string> joinData, Callback<Connection> successCallback)

Create an multiplayer room on the Player.IO infrastructure

public void
JoinRoom (string roomId, Dictionary<string, string> joinData, Callback<Connection> successCallback, Callback<PlayerIOError> errorCallback)

Create an multiplayer room on the Player.IO infrastructure

public void
ListRooms (string roomType, Dictionary<string, string> searchCriteria, int resultLimit, int resultOffset, Callback<RoomInfo[]> successCallback, Callback<PlayerIOError> errorCallback)

List the currently running multiplayer rooms

public void
ListRooms (string roomType, Dictionary<string, string> searchCriteria, int resultLimit, int resultOffset, Callback<RoomInfo[]> successCallback)

List the currently running multiplayer rooms

Multiplayer.DevelopmentServer

public ServerEndpoint
DevelopmentServer

If not null, rooms will be created on the development server at the address defined by the server endpoint, instead of using the live Player.IO serveer. If not null, property GameServerEndpointFilter is ignored.

Multiplayer.GameServerEndpointFilter

public GameServerEndpointFilterDelegate
GameServerEndpointFilter

If not null, allows you to filter, rearrange, or completely redefine the game server enpoints. Endpoints are tried one after the other until there is one successful connection to a game server. If DevelopmentServer property is not null, this property is ignored.

Multiplayer.UseSecureConnections

public bool
UseSecureConnections

If true, the multiplayer connections will be encrypted using TLS/SSL. Beaware that this will cause a performance degredation by introducting secure connection negotiation latency.

Multiplayer.CreateJoinRoom

public void
CreateJoinRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Dictionary<string, string> joinData, Callback<Connection> successCallback)

Creates a multiplayer room (if it does not exist already) and joins it.

Arguments

string roomId
The id of the room you wish to create/join
string roomType
The name of the room type you wish to run the room as. This value should match one of the [RoomType(...)] attributes of your uploaded code. A room type of 'bounce' is always available.
bool visible
If the room doesn't exist: Should the room be visible when listing rooms with GetRooms upon creation
Dictionary<string, string> roomData
If the room doesn't exist: The data to initialize the room with upon creation
Dictionary<string, string> joinData
Data to send to the room with additional information about the join
Callback<Connection> successCallback
Callback with a connection into the room that was created

Multiplayer.CreateJoinRoom

public void
CreateJoinRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Dictionary<string, string> joinData, Callback<Connection> successCallback, Callback<PlayerIOError> errorCallback)

Creates a multiplayer room (if it does not exist already) and joins it.

Arguments

string roomId
The id of the room you wish to create/join
string roomType
The name of the room type you wish to run the room as. This value should match one of the [RoomType(...)] attributes of your uploaded code. A room type of 'bounce' is always available.
bool visible
If the room doesn't exist: Should the room be visible when listing rooms with GetRooms upon creation
Dictionary<string, string> roomData
If the room doesn't exist: The data to initialize the room with upon creation
Dictionary<string, string> joinData
Data to send to the room with additional information about the join
Callback<Connection> successCallback
Callback with a connection into the room that was created
Callback<PlayerIOError> errorCallback
Callback that will be called instead of successCallback if an error occurs

Multiplayer.CreateRoom

public void
CreateRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Callback<string> successCallback)

Create a multiplayer room on the Player.IO infrastructure

Arguments

string roomId
The id you wish to assign to your new room - You can use this to connect to the specific room later as long as it still exists
string roomType
The name of the room type you wish to run the room as. This value should match one of the [RoomType(...)] attributes of your uploaded code. A room type of 'bounce' is always available.
bool visible
Should the room be visible when listing rooms with GetRooms
Dictionary<string, string> roomData
The data to initialize the room with, this can be read with ListRooms and changed from the serverside
Callback<string> successCallback
Callback with the id of the room that was created

Multiplayer.CreateRoom

public void
CreateRoom (string roomId, string roomType, bool visible, Dictionary<string, string> roomData, Callback<string> successCallback, Callback<PlayerIOError> errorCallback)

Create a multiplayer room on the Player.IO infrastructure

Arguments

string roomId
The id you wish to assign to your new room - You can use this to connect to the specific room later as long as it still exists
string roomType
The name of the room type you wish to run the room as. This value should match one of the [RoomType(...)] attributes of your uploaded code. A room type of 'bounce' is always available.
bool visible
Should the room be visible when listing rooms with GetRooms
Dictionary<string, string> roomData
The data to initialize the room with, this can be read with ListRooms and changed from the serverside
Callback<string> successCallback
Callback with the id of the room that was created
Callback<PlayerIOError> errorCallback
Callback that will be called instead of successCallback if an error occurs during the room creation.

Multiplayer.JoinRoom

public void
JoinRoom (string roomId, Dictionary<string, string> joinData, Callback<Connection> successCallback)

Create an multiplayer room on the Player.IO infrastructure

Arguments

string roomId
The id of the room you wish to connect to
Dictionary<string, string> joinData
Data to send to the room with additional information about the join
Callback<Connection> successCallback
Callback with a connection into the room

Multiplayer.JoinRoom

public void
JoinRoom (string roomId, Dictionary<string, string> joinData, Callback<Connection> successCallback, Callback<PlayerIOError> errorCallback)

Create an multiplayer room on the Player.IO infrastructure

Arguments

string roomId
The id of the room you wish to connect to
Dictionary<string, string> joinData
Data to send to the room with additional information about the join
Callback<Connection> successCallback
Callback with a connection into the room
Callback<PlayerIOError> errorCallback
Callback that will be called instead of successCallback if an error occurs

Multiplayer.ListRooms

public void
ListRooms (string roomType, Dictionary<string, string> searchCriteria, int resultLimit, int resultOffset, Callback<RoomInfo[]> successCallback, Callback<PlayerIOError> errorCallback)

List the currently running multiplayer rooms

Arguments

string roomType
The type of room you wish to list
Dictionary<string, string> searchCriteria
Only rooms with the same values in their roomdata will be returned. To use search criteria you must first define searchable properties in the Multiplayer Settings page in the Control Panel for your game.
int resultLimit
The maximum amount of rooms you want to receive. Use 0 for 'as many as possible'.
int resultOffset
The offset into the list you wish
Callback<RoomInfo[]> successCallback
Callback with a list of rooms matching the search criteria
Callback<PlayerIOError> errorCallback
Callback that will be called instead of successCallback if an error occurs

Multiplayer.ListRooms

public void
ListRooms (string roomType, Dictionary<string, string> searchCriteria, int resultLimit, int resultOffset, Callback<RoomInfo[]> successCallback)

List the currently running multiplayer rooms

Arguments

string roomType
The type of room you wish to list
Dictionary<string, string> searchCriteria
Only rooms with the same values in their roomdata will be returned. To use search criteria you must first define searchable properties in the Multiplayer Settings page in the Control Panel for your game.
int resultLimit
The maximum amount of rooms you want to receive. Use 0 for 'as many as possible'.
int resultOffset
The offset into the list you wish
Callback<RoomInfo[]> successCallback
Callback with a list of rooms matching the search criteria