Quantum 3 3.1.0

Public Member Functions | Properties | List of all members
Photon.Deterministic.IDeterministicGame Interface Reference

The deterministic game interface is the main hub that holds information about the simulation on the Quantum.Deterministic level. More...

Inheritance diagram for Photon.Deterministic.IDeterministicGame:
Quantum.QuantumGame

Public Member Functions

void AssignSession (DeterministicSession session)
 The DeterministicSession creates this reference during its initialization. More...
 
DeterministicFrame CreateFrame (IDisposable context, bool verified=false, bool enableHeapTrackerDuringInit=false)
 Creates a new frame object using the context. More...
 
DeterministicFrame CreateFrame (IDisposable context, Byte[] data)
 Creates a new frame object using the context and external frame data. More...
 
IDisposable CreateFrameContext ()
 Creates a frame context in the beginning of the simulation. More...
 
void DeserializeInputInto (int player, byte[] data, byte *buffer, bool verified)
 Asks the game to de-serialize input into the buffers, because it's game specific it cannot be done from here. More...
 
byte[] GetExtraErrorFrameDumpData (DeterministicFrame frame)
 Creates information send to the server when detecting a checksum error. More...
 
Int32 GetInputInMemorySize ()
 Return the in memory input size. More...
 
Int32 GetInputSerializedFixedSize ()
 Returns the serialized input size. More...
 
DeterministicFrame GetVerifiedFrame (int tick)
 Try to get the verified frame for a given tick from the snapshot buffer. More...
 
void OnBeforeSimulationStage (SimulatorContext context)
 The callback is called once before the Verification and once before the Prediction stage of each session update. More...
 
void OnChecksumComputed (Int32 frame, ulong checksum)
 The callback is called when the local checksum was computed. More...
 
void OnChecksumError (DeterministicTickChecksumError error, DeterministicFrame[] frames)
 The callback is called when a checksum error was detected. More...
 
void OnChecksumErrorFrameDump (Int32 actorId, Int32 frameNumber, DeterministicSessionConfig sessionConfig, byte[] runtimeConfig, byte[] frameData, byte[] extraData)
 The callback is called when the clients receive a frame dump of another client from the server. More...
 
void OnDestroy ()
 The callback is called when the simulation is destroyed. More...
 
void OnGameEnded ()
 Not implemented. More...
 
void OnGameResultResponse (bool success, GameResultResponseCode code)
 Is invoked when the server received the game result. More...
 
void OnGameResync ()
 The callback is called when the game is starting from a snapshot after the snapshot has been received. More...
 
void OnGameStart (DeterministicFrame state)
 The callback is called when the actual simulation starts after the online protocol start sequence was successful. More...
 
void OnInputConfirmed (DeterministicFrameInputTemp input)
 The callback is called when an input object was confirmed by the server. More...
 
void OnInputSetConfirmed (Int32 tick, Int32 length, byte[] data)
 The callback is called when an input set (all clients) was confirmed by the server. The data array is a reused internal buffer that is only valid for the duration of the call and may be larger than length . Copy the first length bytes to retain them. More...
 
DeterministicFrameInputTemp OnLocalInput (Int32 frame, Int32 playerSlot)
 Polls the game for local input. More...
 
void OnLocalPlayerAddConfirmed (DeterministicFrame frame, int playerSlot, PlayerRef player)
 The callback is called when the server confirmed the addition of a (local) player. More...
 
void OnLocalPlayerAddFailed (int playerSlot, string message)
 The callback is called when the server failed to process the add player request. More...
 
void OnLocalPlayerRemoveConfirmed (DeterministicFrame frame, int playerSlot, PlayerRef player)
 The callback is called when the server confirmed the removal of a (local) player. More...
 
void OnLocalPlayerRemoveFailed (int playerSlot, string message)
 The callback is called when the server failed to process the remove player request. More...
 
void OnPluginDisconnect (string reason)
 The callback is called when the server plugin disconnected the client. More...
 
void OnSerializedInput (byte *encoded, Array dst)
 Asks the game to serialize the input, because it's game specific it cannot be done from here. More...
 
void OnSimulate (DeterministicFrame state)
 The callback is called when any simulation step was executed. More...
 
void OnSimulateFinished (DeterministicFrame state, SimulatorContext context)
 The callback is called after any simulation step was executed and after the OnSimulate(DeterministicFrame) callback. More...
 
void OnSimulationBegin ()
 The callback is called before the session computes multiple simulation steps (frames). More...
 
void OnSimulationEnd ()
 The callback is called when multiple simulation steps (frames) were executed. More...
 
void OnSimulationStageFinished (SimulatorContext context)
 The callback is called once after the Verification and once after the Prediction stages of each session update. More...
 
void OnUpdateCopyPreviousPredicted (DeterministicFrame previousPredicted, SimulatorContext context)
 The callback is called just before the tick the local input was polled up to is simulated, before input is applied to it. More...
 
void OnUpdateCopyPreviousUpdatePredicted (DeterministicFrame previousUpdatePredicted, SimulatorContext context)
 The callback is called when the frame last predicted in the previous update is available in the current update. More...
 
void OnUpdateDone ()
 The callback is called when the session completed its DeterministicSession.Update loop. More...
 
void SendBufferedCommands ()
 Sends commands queued during the last frame to the server. More...
 

Properties

DeterministicSession Session [get]
 Get the deterministic session. More...
 

Detailed Description

The deterministic game interface is the main hub that holds information about the simulation on the Quantum.Deterministic level.

Member Function Documentation

◆ SendBufferedCommands()

void Photon.Deterministic.IDeterministicGame.SendBufferedCommands ( )

Sends commands queued during the last frame to the server.

Implemented in Quantum.QuantumGame.

◆ GetInputSerializedFixedSize()

Int32 Photon.Deterministic.IDeterministicGame.GetInputSerializedFixedSize ( )

Returns the serialized input size.

Returns
Serialized input size

Implemented in Quantum.QuantumGame.

◆ GetInputInMemorySize()

Int32 Photon.Deterministic.IDeterministicGame.GetInputInMemorySize ( )

Return the in memory input size.

Returns
Input object size

Implemented in Quantum.QuantumGame.

◆ DeserializeInputInto()

void Photon.Deterministic.IDeterministicGame.DeserializeInputInto ( int  player,
byte[]  data,
byte *  buffer,
bool  verified 
)

Asks the game to de-serialize input into the buffers, because it's game specific it cannot be done from here.

Parameters
playerThe player the input is for
dataThe input data
bufferThe destination buffer
verifiedIs the input verified

Implemented in Quantum.QuantumGame.

◆ OnLocalInput()

DeterministicFrameInputTemp Photon.Deterministic.IDeterministicGame.OnLocalInput ( Int32  frame,
Int32  playerSlot 
)

Polls the game for local input.

Parameters
frameThe frame that the input is for
playerSlotThe player slot that is polling
Returns
The polled input

Implemented in Quantum.QuantumGame.

◆ OnSerializedInput()

void Photon.Deterministic.IDeterministicGame.OnSerializedInput ( byte *  encoded,
Array  dst 
)

Asks the game to serialize the input, because it's game specific it cannot be done from here.

Parameters
encoded
dst

Implemented in Quantum.QuantumGame.

◆ CreateFrameContext()

IDisposable Photon.Deterministic.IDeterministicGame.CreateFrameContext ( )

Creates a frame context in the beginning of the simulation.

Returns
Frame context.

Implemented in Quantum.QuantumGame.

◆ CreateFrame() [1/2]

DeterministicFrame Photon.Deterministic.IDeterministicGame.CreateFrame ( IDisposable  context,
bool  verified = false,
bool  enableHeapTrackerDuringInit = false 
)

Creates a new frame object using the context.

Parameters
contextThe context the frame should be created under.
verifiedWhether or not this is a verified frame.
enableHeapTrackerDuringInitEnables frame heap tracking immediately.
Returns
Frame object

◆ CreateFrame() [2/2]

DeterministicFrame Photon.Deterministic.IDeterministicGame.CreateFrame ( IDisposable  context,
Byte[]  data 
)

Creates a new frame object using the context and external frame data.

Parameters
contextFrame context
data
Returns

◆ GetVerifiedFrame()

DeterministicFrame Photon.Deterministic.IDeterministicGame.GetVerifiedFrame ( int  tick)

Try to get the verified frame for a given tick from the snapshot buffer.

Parameters
tickRequested tick
Returns
The frame object or null

Implemented in Quantum.QuantumGame.

◆ GetExtraErrorFrameDumpData()

byte [] Photon.Deterministic.IDeterministicGame.GetExtraErrorFrameDumpData ( DeterministicFrame  frame)

Creates information send to the server when detecting a checksum error.

Parameters
frameFrame
Returns
Serialized frame dump context

Implemented in Quantum.QuantumGame.

◆ OnDestroy()

void Photon.Deterministic.IDeterministicGame.OnDestroy ( )

The callback is called when the simulation is destroyed.

Implemented in Quantum.QuantumGame.

◆ AssignSession()

void Photon.Deterministic.IDeterministicGame.AssignSession ( DeterministicSession  session)

The DeterministicSession creates this reference during its initialization.

Parameters
sessionDeterministic session that this game uses

Implemented in Quantum.QuantumGame.

◆ OnGameStart()

void Photon.Deterministic.IDeterministicGame.OnGameStart ( DeterministicFrame  state)

The callback is called when the actual simulation starts after the online protocol start sequence was successful.

Parameters
stateInitial deterministic frame

Implemented in Quantum.QuantumGame.

◆ OnGameResync()

void Photon.Deterministic.IDeterministicGame.OnGameResync ( )

The callback is called when the game is starting from a snapshot after the snapshot has been received.

Implemented in Quantum.QuantumGame.

◆ OnGameEnded()

void Photon.Deterministic.IDeterministicGame.OnGameEnded ( )

Not implemented.

Implemented in Quantum.QuantumGame.

◆ OnBeforeSimulationStage()

void Photon.Deterministic.IDeterministicGame.OnBeforeSimulationStage ( SimulatorContext  context)

The callback is called once before the Verification and once before the Prediction stage of each session update.

Parameters
contextThe current SimulatorContext.

Implemented in Quantum.QuantumGame.

◆ OnSimulationStageFinished()

void Photon.Deterministic.IDeterministicGame.OnSimulationStageFinished ( SimulatorContext  context)

The callback is called once after the Verification and once after the Prediction stages of each session update.

Parameters
contextThe current SimulatorContext.

Implemented in Quantum.QuantumGame.

◆ OnSimulate()

void Photon.Deterministic.IDeterministicGame.OnSimulate ( DeterministicFrame  state)

The callback is called when any simulation step was executed.

Parameters
stateFrame that was simulated

Implemented in Quantum.QuantumGame.

◆ OnSimulateFinished()

void Photon.Deterministic.IDeterministicGame.OnSimulateFinished ( DeterministicFrame  state,
SimulatorContext  context 
)

The callback is called after any simulation step was executed and after the OnSimulate(DeterministicFrame) callback.

Parameters
stateFrame that was simulated
contextThe current SimulatorContext.

Implemented in Quantum.QuantumGame.

◆ OnUpdateCopyPreviousPredicted()

void Photon.Deterministic.IDeterministicGame.OnUpdateCopyPreviousPredicted ( DeterministicFrame  previousPredicted,
SimulatorContext  context 
)

The callback is called just before the tick the local input was polled up to is simulated, before input is applied to it.

previousPredicted still holds the tick that frame advances from, i.e. previousPredicted.Number == context.NextTickToSimulate - 1. It is the live simulation frame and is mutated right after the callback returns, read it during the callback only.

This callback can be used to interpolate transforms (or any other data) between previousPredicted and the predicted frame.

Parameters
previousPredictedThe state the last frame simulated in the current update advances from.
contextThe current SimulatorContext.

Implemented in Quantum.QuantumGame.

◆ OnUpdateCopyPreviousUpdatePredicted()

void Photon.Deterministic.IDeterministicGame.OnUpdateCopyPreviousUpdatePredicted ( DeterministicFrame  previousUpdatePredicted,
SimulatorContext  context 
)

The callback is called when the frame last predicted in the previous update is available in the current update.

If the last frame predicted in the previous update is re-simulated in the current update, previousUpdatePredicted will be the updated version.

This callback can be used to calculate and smoothly correct transform (or any other data) view errors caused by misprediction.

Parameters
previousUpdatePredictedThe latest version of the last frame simulated in the previous update.
contextThe current SimulatorContext.

Implemented in Quantum.QuantumGame.

◆ OnUpdateDone()

void Photon.Deterministic.IDeterministicGame.OnUpdateDone ( )

The callback is called when the session completed its DeterministicSession.Update loop.

Implemented in Quantum.QuantumGame.

◆ OnChecksumError()

void Photon.Deterministic.IDeterministicGame.OnChecksumError ( DeterministicTickChecksumError  error,
DeterministicFrame[]  frames 
)

The callback is called when a checksum error was detected.

Parameters
errorChecksum error information
framesContains the verified frame that was failed to validate

Implemented in Quantum.QuantumGame.

◆ OnChecksumErrorFrameDump()

void Photon.Deterministic.IDeterministicGame.OnChecksumErrorFrameDump ( Int32  actorId,
Int32  frameNumber,
DeterministicSessionConfig  sessionConfig,
byte[]  runtimeConfig,
byte[]  frameData,
byte[]  extraData 
)

The callback is called when the clients receive a frame dump of another client from the server.

Parameters
actorIdThe Photon actor id that the dump belongs to
frameNumberThe frame number of the dump
sessionConfigThe session config
runtimeConfigThe runtime config
frameDataThe frame data
extraDataExtra dump meta information

◆ OnInputConfirmed()

void Photon.Deterministic.IDeterministicGame.OnInputConfirmed ( DeterministicFrameInputTemp  input)

The callback is called when an input object was confirmed by the server.

Parameters
inputInput object

Implemented in Quantum.QuantumGame.

◆ OnInputSetConfirmed()

void Photon.Deterministic.IDeterministicGame.OnInputSetConfirmed ( Int32  tick,
Int32  length,
byte[]  data 
)

The callback is called when an input set (all clients) was confirmed by the server. The data array is a reused internal buffer that is only valid for the duration of the call and may be larger than length . Copy the first length bytes to retain them.

Parameters
tickTick
lengthNumber of valid bytes in data
dataDelta compressed input set, only valid during the call

◆ OnChecksumComputed()

void Photon.Deterministic.IDeterministicGame.OnChecksumComputed ( Int32  frame,
ulong  checksum 
)

The callback is called when the local checksum was computed.

Parameters
frameThe frame the checksum belongs to
checksumThe checksum that will be sent to the server

Implemented in Quantum.QuantumGame.

◆ OnSimulationBegin()

void Photon.Deterministic.IDeterministicGame.OnSimulationBegin ( )

The callback is called before the session computes multiple simulation steps (frames).

Implemented in Quantum.QuantumGame.

◆ OnSimulationEnd()

void Photon.Deterministic.IDeterministicGame.OnSimulationEnd ( )

The callback is called when multiple simulation steps (frames) were executed.

Implemented in Quantum.QuantumGame.

◆ OnPluginDisconnect()

void Photon.Deterministic.IDeterministicGame.OnPluginDisconnect ( string  reason)

The callback is called when the server plugin disconnected the client.

Parameters
reasonDebug string

Implemented in Quantum.QuantumGame.

◆ OnLocalPlayerAddConfirmed()

void Photon.Deterministic.IDeterministicGame.OnLocalPlayerAddConfirmed ( DeterministicFrame  frame,
int  playerSlot,
PlayerRef  player 
)

The callback is called when the server confirmed the addition of a (local) player.

Parameters
frameThe frame the player has been added
playerSlotThe player slot that was used to assign the player
playerThe player

Implemented in Quantum.QuantumGame.

◆ OnLocalPlayerRemoveConfirmed()

void Photon.Deterministic.IDeterministicGame.OnLocalPlayerRemoveConfirmed ( DeterministicFrame  frame,
int  playerSlot,
PlayerRef  player 
)

The callback is called when the server confirmed the removal of a (local) player.

Parameters
frameThe frame when the request was confirmed
playerSlotThe player slot of the removed player
playerThe player that was removed

Implemented in Quantum.QuantumGame.

◆ OnLocalPlayerAddFailed()

void Photon.Deterministic.IDeterministicGame.OnLocalPlayerAddFailed ( int  playerSlot,
string  message 
)

The callback is called when the server failed to process the add player request.

Parameters
playerSlotThe player slot that was requested
messageDebug message

Implemented in Quantum.QuantumGame.

◆ OnLocalPlayerRemoveFailed()

void Photon.Deterministic.IDeterministicGame.OnLocalPlayerRemoveFailed ( int  playerSlot,
string  message 
)

The callback is called when the server failed to process the remove player request.

Parameters
playerSlotThe player slot that was tried to remove
messageDebug message

Implemented in Quantum.QuantumGame.

◆ OnGameResultResponse()

void Photon.Deterministic.IDeterministicGame.OnGameResultResponse ( bool  success,
GameResultResponseCode  code 
)

Is invoked when the server received the game result.

Implemented in Quantum.QuantumGame.

Property Documentation

◆ Session

DeterministicSession Photon.Deterministic.IDeterministicGame.Session
get

Get the deterministic session.