Beamable SDK
|
This type defines the Client main entry point for the Multiplayer feature. More...
Public Member Functions | |
delegate void | EventCallback< T > (T body) |
SimClient (SimNetworkInterface network, long framesPerSecond, long targetNetworkLead) | |
Create a new relay client that can be used to communicate with other players. More... | |
SimLog.Snapshot | TakeSnapshot () |
Create a snapshot at the current frame. More... | |
void | RestoreSnapshot (SimLog.Snapshot snapshot) |
Given a SimLog.Snapshot, restore the internal simulation to that point More... | |
void | SendEvent (object evt) |
Add an event to the log eventually. It won't be 'real' until it's in the log. The network decides when/how that happens This will run the SendEvent(string, object) method by using the evt's class name as the name, and the evt itself as the body More... | |
void | SendEvent (string name, object evt) |
Send an event to the relay log. The event won't be validated until it round-trips through the other clients. Use the On<T> event to register a callback for when the event is put onto the log. More... | |
void | Update () |
Call this method on the Unity update loop. It will make sure to sync the relay state with the configured network frames per second. | |
T | Spawn< T > (SimBehavior original, string id="") |
Create a new GameObject from the given SimBehavior prefab More... | |
void | RemoveSimBehavior (SimBehavior simObj) |
Remove a SimBehavior More... | |
EventCallback< string > | On< T > (string evt, string origin, EventCallback< T > callback) |
Run a callback anytime a certain relay event is received onto the simulation log. More... | |
void | Remove (EventCallback< string > callback) |
Remove a handler registered with the On<T> method More... | |
EventCallback< string > | OnInit (EventCallback< string > callback) |
Add a callback that will trigger after the relay has been initialized. More... | |
EventCallback< string > | OnConnect (EventCallback< string > callback) |
Add a callback that will trigger after each player joins the game relay. More... | |
EventCallback< string > | OnDisconnect (EventCallback< string > callback) |
Add a callback that will trigger after a player disconnects from the game realy. More... | |
EventCallback< string > | OnTick (EventCallback< long > callback) |
Add a callback that will trigger on every network tick More... | |
int | RandomInt () |
Get a deterministically random number. The seed for the random values is shared among all players in the relay. If all clients use this method to get random values, then all clients will get the same random values. More... | |
Public Attributes | |
SimNetworkInterface | Network |
Properties | |
int | LogHash [get] |
int | StateHash [get] |
long | Ping [get] |
string | ClientId [get] |
This type defines the Client main entry point for the Multiplayer feature.
|
inline |
Create a new relay client that can be used to communicate with other players.
network | A SimNetworkInterface that controls how the events are passed between players. |
framesPerSecond | A target network frame rate. |
targetNetworkLead | Number of frames desired for the network to be ahead of the live simulation |
|
inline |
Run a callback anytime a certain relay event is received onto the simulation log.
evt | The type of event |
origin | the origin string for who sent the event |
callback | A callback to run when the event is recieved |
T | The type to deserialize the event json into |
|
inline |
Add a callback that will trigger after each player joins the game relay.
callback | a callback where the only argument is the gamertag of the player that joined. |
|
inline |
Add a callback that will trigger after a player disconnects from the game realy.
callback | a callback where the only argument is the gamertag of the player that disconnected. |
|
inline |
Add a callback that will trigger after the relay has been initialized.
callback | A callback where the only argument is the relay room id |
|
inline |
Add a callback that will trigger on every network tick
callback | A callback where the only argument is the current tick number of the simulation |
|
inline |
Get a deterministically random number. The seed for the random values is shared among all players in the relay. If all clients use this method to get random values, then all clients will get the same random values.
|
inline |
|
inline |
Remove a SimBehavior
simObj |
|
inline |
Given a SimLog.Snapshot, restore the internal simulation to that point
snapshot | A SimLog.Snapshot generated with the TakeSnapshot method |
|
inline |
Add an event to the log eventually. It won't be 'real' until it's in the log. The network decides when/how that happens This will run the SendEvent(string, object) method by using the evt's class name as the name, and the evt itself as the body
evt | Any json serializable object |
|
inline |
Send an event to the relay log. The event won't be validated until it round-trips through the other clients. Use the On<T> event to register a callback for when the event is put onto the log.
name | A name for the event. This can be any string, but should be a consistent channel name. |
evt | Any json serializable object. The object will be sent to JSON and sent to the relay server. |
|
inline |
Create a new GameObject from the given SimBehavior prefab
original | |
id |
T |
|
inline |
Create a snapshot at the current frame.