The Quantum server class. Override virtual methods to extend its functionality. More...
Public Member Functions | |
bool | CanSendInput (Int32 player, int tick) |
Prevent sending input for slots that just disconnected (previous player) More... | |
void | Close () |
Called by the plugin before the plugin is destroyed and the room closed. More... | |
void | DisconnectClient (DeterministicPluginClient client, String message) |
Disconnect a client. More... | |
void | GetActorIds (List< Int32 > actorIds) |
Fill a list of all actor ids. More... | |
Int32 | GetClientActorId (int playerIndex) |
Map a player index to an actor id. More... | |
Int32 | GetClientActorId (String clientId) |
Map a client id to an Photon actor id. More... | |
DeterministicPluginClient | GetClientForActor (Int32 actorNr) |
Retrieve the client object by actor number. More... | |
DeterministicPluginClient | GetClientForPlayer (PlayerRef player) |
Retrieve the client object by player ref. Can be null if the client disconnected. More... | |
DeterministicPluginClient | GetClientForUser (string userId) |
Retrieve client object by user id. More... | |
void | GetClientIds (List< string > clientIds) |
Retrieve a list of all client ids. More... | |
Boolean | IsRealPlayer (Int32 playerIndex, int tick) |
Check if the player index is valid and has or ever had a client connected. More... | |
Int32 | MaxPing () |
Get the largest ping (Rtt) of all players. More... | |
virtual void | OnDeltaCompressedInput (int tick, byte[] data) |
This callback is invoked when the delta compressed input if finalized and can be used to stream the replay. More... | |
virtual void | OnDeterministicClientJoinedSession (DeterministicPluginClient client) |
This method is not invoked anymore. More... | |
virtual Boolean | OnDeterministicClientJoinRequestSession (DeterministicPluginClient client, Protocol.Join joinData) |
This method is not invoked anymore. An equivalent would be OnDeterministicStartRequest(DeterministicPluginClient, Protocol.StartRequest). More... | |
virtual Boolean | OnDeterministicCommand (DeterministicPluginClient client, Protocol.Command cmd) |
Is called before a player command issues by a client it applied to the simulation. This method can be deferred by returning false and calling SendDeterministicCommand(Protocol.Command) later. More... | |
virtual void | OnDeterministicGameConfigs (ref byte[] runtimeConfig, ref DeterministicSessionConfig sessionConfig) |
The callback is called once just before the server starts the Quantum simulation. This is the last time that RuntimeConfig and/or SessionConfig can be changed and overwritten. Both configs passed here have values that were originally send either by a client or a webhook. More... | |
virtual void | OnDeterministicInputConfirmed (DeterministicPluginClient client, Int32 tick, Int32 playerIndex, DeterministicTickInput input) |
Is called when input for a client and tick is confirmed. More... | |
virtual void | OnDeterministicInputReceived (DeterministicPluginClient client, DeterministicTickInput input) |
Is called then input is received from a client (input is still acceptable based on the time) and also when the server generated the input. More... | |
virtual ? int | OnDeterministicLateStart (DeterministicPluginClient client, Protocol.SimulationStart startData) |
Is called when a late-joining or reconnecting client is about to receive the simulation start event. More... | |
virtual void | OnDeterministicPlayerAdd (DeterministicPluginClient client, int playerSlot, ref byte[] runtimePlayer) |
Is called before runtime player data for a client is processed after the client sent it or the webhook (if enabled) return it. The runtimePlayer data can be changed in this callback. More... | |
virtual Boolean | OnDeterministicPlayerDataSet (DeterministicPluginClient client, Protocol.AddPlayer playerData) |
Has been replaced by OnDeterministicPlayerAdd(DeterministicPluginClient, int, ref byte[]) More... | |
virtual void | OnDeterministicPlayerRemove (DeterministicPluginClient client, int playerSlot) |
Is called when a client sends a remove player operation. More... | |
virtual bool | OnDeterministicRuntimeConfig (DeterministicPluginClient client, Protocol.RuntimeConfig configData) |
This method is not invoked anymore. Use OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig)"/>. More... | |
virtual void | OnDeterministicServerClose () |
Is called when the room is closed and the server shuts down. More... | |
virtual Boolean | OnDeterministicServerInput (DeterministicTickInput input) |
Override to set the input data for a server controlled player. Tick and player index have already been set on the input object. DeterministicInputFlags.PlayerNotPresent is always applied to to the input.Flags after this callback. More... | |
virtual void | OnDeterministicServerReplacedInput (DeterministicTickInput input) |
Is called when the input for a real player has been replaced by the server. More... | |
virtual void | OnDeterministicServerSetup (IHost host, IEventSender eventSender, IWebhookHost webhookHost, Dictionary< string, string > config, ref Boolean runServerSimulation) |
Is called when the server object is initialized by the plugin. More... | |
virtual bool | OnDeterministicSessionCanStart () |
Is polled repeatedly before the Quantum session is stated until true is returned. More... | |
virtual bool | OnDeterministicSessionConfig (DeterministicPluginClient client, Protocol.SessionConfig configData) |
This method is not invoked anymore. Use OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig). More... | |
virtual Boolean | OnDeterministicSnapshotRequested (ref Int32 tick, ref byte[] data) |
This callback is called when a late-joining or reconnecting client request a snapshot before the request is forwarded to other clients. When running server simulation the snapshot is send directly in the default implementation of this method. Overload to change the behaviour. More... | |
virtual Boolean | OnDeterministicStartRequest (DeterministicPluginClient client, Protocol.StartRequest startRequestData) |
Is called before a client is permitted to request the start of the simulation. More... | |
virtual void | OnDeterministicStartSession () |
Is called when the simulation has been started. More... | |
virtual void | OnDeterministicUpdate () |
Is called for running sessions during each server update after the input has been processed and the server simulation (if any) was processed. More... | |
void | SendDeterministicCommand (Protocol.Command command) |
Call this method to inject a command into the simulation from the server. More... | |
void | SetDeterministicPlayerData (DeterministicPluginClient client, Protocol.AddPlayer playerData) |
This method has been made obsolete by the internal webhook system. More... | |
void | SetDeterministicRuntimeConfig (Byte[] configData) |
Securing RuntimeConfig should be done via webhook or from OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig)"/> More... | |
void | SetDeterministicSessionConfig (DeterministicSessionConfig config) |
Securing SessionConfig should be done via webhook or from OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig)"/> More... | |
void | SetGameConfigs (byte[] runtimeConfig, object sessionConfig) |
Sets the game configs used for the session. This method is used for webhooks inside the DeterministicPlugin library. To overwrite game configs in the custom plugin SDK use OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig) instead. Will not overwrite configs that were set by other means before. The server will try to progress from Idle to Ready state if possible. More... | |
void | SetPlayerData (int actorNr, string userId, byte[] runtimePlayer) |
Sets clients binary RuntimePlayer that will overwrite the data sent by it during the AddPlayer operation. This is called during Join webhook for example. Only works for the first slot of a client (slot=0) and only if the slot hat not been assigned yet. More... | |
void | SetPlayerData (int actorNr, string userId, PlayerData playerData) |
Sets the max players slots a client can request. More... | |
void | SetServerData (ServerData severData) |
Late configuration data from the plugin to the server class. E.g. data arriving from a webhook. More... | |
Public Attributes | |
int | ClientInputExceptionTolerance = 2 |
The number of times clients can cause an input deserialization exception before getting disconnected. Initially set by dashboard value "ClientInputExceptionTolerance". Default is 2. More... | |
IEnumerable< DeterministicPluginClient > | Clients => _clients |
Access the connected client objects. More... | |
int | ClientsCount => _clients.Count |
Number of clients connected and registered by the plugin. Corresponds to the number of Clients. More... | |
Int32 | PlayerCount => _session.SessionConfig == null ? 0 : _session.SessionConfig.PlayerCount |
Quantum player count as set in DeterministicSessionConfig.PlayerCount. May return 0 while the DeterministicPluginSession.SessionConfig has not been yet confirmed and set. More... | |
IHost | PluginHost => _host |
Access the plugin host object More... | |
DeterministicReplayStreaming | ReplayStreaming => _replayStreaming |
Access the replay streaming to send final chunk. More... | |
DeterministicPluginSession | Session => _session |
Access the current running session. More... | |
IDeterministicSessionContext | SessionContext => _sessionContext |
Access to session context including command serializer and resource manager. More... | |
IDeterministicSessionRunner | SessionRunner => _sessionRunner |
Grants access to the server simulation that can be casted into QuantumServerSimulation object. More... | |
The Quantum server class. Override virtual methods to extend its functionality.
|
inlinevirtual |
Is called when the server object is initialized by the plugin.
host | The plugin object |
eventSender | The event sender object |
webhookHost | The webhook api object |
config | The dashboard configuration dictionary |
runServerSimulation | Final control to run or skip the server simulation. Ignores the setting when no session runner was passed in the constructor. /// |
|
inlinevirtual |
Is called when the room is closed and the server shuts down.
|
inlinevirtual |
Is called before a client is permitted to request the start of the simulation.
client | Client object |
startRequestData | Join message data |
true
to let the client request the start, false
to disconnect.
|
inlinevirtual |
The callback is called once just before the server starts the Quantum simulation. This is the last time that RuntimeConfig and/or SessionConfig can be changed and overwritten. Both configs passed here have values that were originally send either by a client or a webhook.
runtimeConfig | RuntimeConfig in bytes |
sessionConfig | SessionConfig object |
|
inlinevirtual |
Is called before runtime player data for a client is processed after the client sent it or the webhook (if enabled) return it. The runtimePlayer data can be changed in this callback.
client | Client object |
playerSlot | Player slot |
runtimePlayer | Runtime player object |
|
inlinevirtual |
Is called when a client sends a remove player operation.
client | Client object |
playerSlot | Player slot |
|
inlinevirtual |
This callback is called when a late-joining or reconnecting client request a snapshot before the request is forwarded to other clients. When running server simulation the snapshot is send directly in the default implementation of this method. Overload to change the behaviour.
tick | The tick of the snapshot |
data | The serialized snapshot |
true
to signal that parameters have been set and the snapshot can be send directly.
|
inlinevirtual |
Is called before a player command issues by a client it applied to the simulation. This method can be deferred by returning false
and calling SendDeterministicCommand(Protocol.Command) later.
client | Client that sent the command |
cmd | Command object |
true
to continue processing the command
|
inlinevirtual |
Is called when a late-joining or reconnecting client is about to receive the simulation start event.
client | Client object |
startData | SimulationStart message include serialized runtime config |
|
inlinevirtual |
Is called then input is received from a client (input is still acceptable based on the time) and also when the server generated the input.
client | Client object |
input | Input object |
|
inlinevirtual |
Is called when input for a client and tick is confirmed.
client | Client object |
tick | The input tick |
playerIndex | Player index |
input | Input object |
|
inlinevirtual |
Override to set the input data for a server controlled player. Tick and player index have already been set on the input object. DeterministicInputFlags.PlayerNotPresent is always applied to to the input.Flags after this callback.
input | Input data |
true
when the input is modified in this callback
|
inlinevirtual |
Is called when the input for a real player has been replaced by the server.
input | Input object |
|
inlinevirtual |
Is polled repeatedly before the Quantum session is stated until true
is returned.
true
to commence the session start or false
to delay it.
|
inlinevirtual |
Is called when the simulation has been started.
|
inlinevirtual |
Is called for running sessions during each server update after the input has been processed and the server simulation (if any) was processed.
|
inlinevirtual |
This callback is invoked when the delta compressed input if finalized and can be used to stream the replay.
tick | Tick |
data | Delta compressed input for one tick |
|
inline |
Call this method to inject a command into the simulation from the server.
command | Command object |
|
inline |
This method has been made obsolete by the internal webhook system.
|
inline |
Securing SessionConfig should be done via webhook or from OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig)"/>
|
inline |
Securing RuntimeConfig should be done via webhook or from OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig)"/>
|
inlinevirtual |
Has been replaced by OnDeterministicPlayerAdd(DeterministicPluginClient, int, ref byte[])
|
inlinevirtual |
This method is not invoked anymore. An equivalent would be OnDeterministicStartRequest(DeterministicPluginClient, Protocol.StartRequest).
|
inlinevirtual |
This method is not invoked anymore.
|
inlinevirtual |
This method is not invoked anymore. Use OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig).
|
inlinevirtual |
This method is not invoked anymore. Use OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig)"/>.
|
inline |
Called by the plugin before the plugin is destroyed and the room closed.
|
inline |
Sets clients binary RuntimePlayer that will overwrite the data sent by it during the AddPlayer operation. This is called during Join webhook for example. Only works for the first slot of a client (slot=0) and only if the slot hat not been assigned yet.
actorNr | Client Photon actor number |
userId | Photon user id |
runtimePlayer | Binary RuntimePlayer |
|
inline |
Sets the max players slots a client can request.
actorNr | Photon Actor id |
userId | Photon user id |
playerData | Additional player data used by the server. |
|
inline |
Late configuration data from the plugin to the server class. E.g. data arriving from a webhook.
severData | Server configuration data to process. |
|
inline |
Sets the game configs used for the session. This method is used for webhooks inside the DeterministicPlugin library. To overwrite game configs in the custom plugin SDK use OnDeterministicGameConfigs(ref byte[], ref DeterministicSessionConfig) instead. Will not overwrite configs that were set by other means before. The server will try to progress from Idle to Ready state if possible.
runtimeConfig | Binary RuntimePlayer |
sessionConfig | SessionConfig as object (original type has to be DeterministicSessionConfig) |
|
inline |
Get the largest ping (Rtt) of all players.
|
inline |
Disconnect a client.
client | Client object |
message | Disconnect message |
|
inline |
Retrieve a list of all client ids.
clientIds | List that is filled with DeterministicPluginClient.ClientId |
|
inline |
Fill a list of all actor ids.
|
inline |
Map a client id to an Photon actor id.
clientId | Client id |
|
inline |
Map a player index to an actor id.
playerIndex |
|
inline |
Check if the player index is valid and has or ever had a client connected.
playerIndex | Player index |
tick | The tick is used to exclude freshly disconnected players. |
true
is the player is a valid and is backed by a client.
|
inline |
Prevent sending input for slots that just disconnected (previous player)
|
inline |
Retrieve the client object by actor number.
actorNr | Actor id |
null
|
inline |
Retrieve client object by user id.
userId | User id. |
null
|
inline |
Retrieve the client object by player ref. Can be null if the client disconnected.
player | Player ref |
null
if not present or in use.IDeterministicSessionContext Photon.Deterministic.Server.DeterministicServer.SessionContext => _sessionContext |
Access to session context including command serializer and resource manager.
IDeterministicSessionRunner Photon.Deterministic.Server.DeterministicServer.SessionRunner => _sessionRunner |
Grants access to the server simulation that can be casted into QuantumServerSimulation object.
Int32 Photon.Deterministic.Server.DeterministicServer.PlayerCount => _session.SessionConfig == null ? 0 : _session.SessionConfig.PlayerCount |
Quantum player count as set in DeterministicSessionConfig.PlayerCount. May return 0 while the DeterministicPluginSession.SessionConfig has not been yet confirmed and set.
DeterministicPluginSession Photon.Deterministic.Server.DeterministicServer.Session => _session |
Access the current running session.
IEnumerable<DeterministicPluginClient> Photon.Deterministic.Server.DeterministicServer.Clients => _clients |
Access the connected client objects.
int Photon.Deterministic.Server.DeterministicServer.ClientsCount => _clients.Count |
Number of clients connected and registered by the plugin. Corresponds to the number of Clients.
int Photon.Deterministic.Server.DeterministicServer.ClientInputExceptionTolerance = 2 |
The number of times clients can cause an input deserialization exception before getting disconnected. Initially set by dashboard value "ClientInputExceptionTolerance". Default is 2.
DeterministicReplayStreaming Photon.Deterministic.Server.DeterministicServer.ReplayStreaming => _replayStreaming |
Access the replay streaming to send final chunk.
IHost Photon.Deterministic.Server.DeterministicServer.PluginHost => _host |
Access the plugin host object