Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Properties | List of all members
Photon.Deterministic.DeterministicFrame Class Referenceabstract

The base class for the simulation frame. Also referred as rollback-able game state. More...

Public Member Functions

abstract UInt64 CalculateChecksum ()
 Calculates the checksum of the frame. More...
 
void CopyFrom (DeterministicFrame frame)
 Copies the data from the specified frame to this frame. More...
 
abstract void Deserialize (Byte[] data)
 Load all frame data from the serialized frame. More...
 
abstract String DumpFrame (int dumpFlags=0)
 Dumps the frame with the specified dump flags. More...
 
abstract void Free ()
 Frees the resources used by the frame. More...
 
DeterministicCommand GetPlayerCommand (PlayerRef player)
 Get the player command for this frame. More...
 
DeterministicInputFlags GetPlayerInputFlags (PlayerRef player)
 Get the player input flags DeterministicInputFlags. More...
 
unsafe Byte * GetRawInput (PlayerRef player)
 Get the raw input for a player. Result can be casted to simulation specific Input pointer. More...
 
Int32[] GetRawInputs ()
 Get the raw inputs for delta compression. More...
 
Byte[] GetRawRpc (PlayerRef player)
 Get the raw RPC data for the player. More...
 
void Init (int playerCount, int inputSize, Native.Allocator allocator, bool resetRawInputs=true)
 Initialize the frame. More...
 
abstract Byte[] Serialize (DeterministicFrameSerializeMode mode)
 Save all frame data. More...
 
void SetRawInputs (Int32[] inputs, int length)
 Set the raw inputs for the delta compression. More...
 

Static Public Member Functions

static void OnPlayerAdded (DeterministicFrame frame, DeterministicSession session, int playerSlot, int actorNumber, Quantum.PlayerRef player)
 Handles the event when a player is added to the session. More...
 
static void OnPlayerRemoved (DeterministicFrame frame, DeterministicSession session, Quantum.PlayerRef player)
 Handles the event when a player is removed from the session. More...
 

Public Attributes

Boolean IsPredicted => Verified == false
 The frame is predicted (input may be incorrect and rolled-back by the server). More...
 
Int32 Number
 The frame(/tick) number. More...
 
Int32[] RawInputs
 The raw inputs for the delta compressed input. More...
 
Int32 RawInputSize => Input.InputSize
 The raw input size. More...
 

Static Public Attributes

const int DumpFlag_NoHeap = 1 << 0
 This flag controls if the heap data is dumped when calling DumpFrame(int). More...
 

Protected Member Functions

abstract void Copy (DeterministicFrame frame)
 Copy the internal frame data. Is called from CopyFrom. More...
 

Properties

Boolean IsVerified [get]
 The frame is verified (all input has been validated by the server). More...
 

Detailed Description

The base class for the simulation frame. Also referred as rollback-able game state.

Member Function Documentation

◆ SetRawInputs()

void Photon.Deterministic.DeterministicFrame.SetRawInputs ( Int32[]  inputs,
int  length 
)
inline

Set the raw inputs for the delta compression.

Parameters
inputsInputs data
lengthInput data length

◆ GetRawInputs()

Int32 [] Photon.Deterministic.DeterministicFrame.GetRawInputs ( )
inline

Get the raw inputs for delta compression.

Returns
Raw inputs

◆ Init()

void Photon.Deterministic.DeterministicFrame.Init ( int  playerCount,
int  inputSize,
Native.Allocator  allocator,
bool  resetRawInputs = true 
)
inline

Initialize the frame.

Parameters
playerCountSimulation player count
inputSizeInput fixed size
allocatorNative allocator
resetRawInputsRestarting a replay requires the raw input to be not reset

◆ GetRawRpc()

Byte [] Photon.Deterministic.DeterministicFrame.GetRawRpc ( PlayerRef  player)
inline

Get the raw RPC data for the player.

Parameters
playerPlayer
Returns
Raw RPC data

◆ GetRawInput()

unsafe Byte* Photon.Deterministic.DeterministicFrame.GetRawInput ( PlayerRef  player)
inline

Get the raw input for a player. Result can be casted to simulation specific Input pointer.

Parameters
playerPlayer
Returns
Pointer to input memory block

◆ GetPlayerInputFlags()

DeterministicInputFlags Photon.Deterministic.DeterministicFrame.GetPlayerInputFlags ( PlayerRef  player)
inline

Get the player input flags DeterministicInputFlags.

Parameters
playerPlayer
Returns
Input flags.

◆ GetPlayerCommand()

DeterministicCommand Photon.Deterministic.DeterministicFrame.GetPlayerCommand ( PlayerRef  player)
inline

Get the player command for this frame.

Parameters
playerPlayer
Returns
A command if one is available.

◆ DumpFrame()

abstract String Photon.Deterministic.DeterministicFrame.DumpFrame ( int  dumpFlags = 0)
pure virtual

Dumps the frame with the specified dump flags.

Parameters
dumpFlagsThe dump flags.
Returns
The dumped frame as a string.

◆ CalculateChecksum()

abstract UInt64 Photon.Deterministic.DeterministicFrame.CalculateChecksum ( )
pure virtual

Calculates the checksum of the frame.

Returns
The calculated checksum.

◆ Free()

abstract void Photon.Deterministic.DeterministicFrame.Free ( )
pure virtual

Frees the resources used by the frame.

◆ Serialize()

abstract Byte [] Photon.Deterministic.DeterministicFrame.Serialize ( DeterministicFrameSerializeMode  mode)
pure virtual

Save all frame data.

Parameters
modeThe serialization mode.
Returns
The serialized frame.

◆ Deserialize()

abstract void Photon.Deterministic.DeterministicFrame.Deserialize ( Byte[]  data)
pure virtual

Load all frame data from the serialized frame.

Parameters
dataSerialized frame.

◆ Copy()

abstract void Photon.Deterministic.DeterministicFrame.Copy ( DeterministicFrame  frame)
protectedpure virtual

Copy the internal frame data. Is called from CopyFrom.

Parameters
frameFrame to copy

◆ CopyFrom()

void Photon.Deterministic.DeterministicFrame.CopyFrom ( DeterministicFrame  frame)
inline

Copies the data from the specified frame to this frame.

Parameters
frameThe frame to copy from.

◆ OnPlayerAdded()

static void Photon.Deterministic.DeterministicFrame.OnPlayerAdded ( DeterministicFrame  frame,
DeterministicSession  session,
int  playerSlot,
int  actorNumber,
Quantum.PlayerRef  player 
)
inlinestatic

Handles the event when a player is added to the session.

Parameters
frameThe frame.
sessionThe session.
playerSlotThe player slot.
actorNumberThe actor number.
playerThe player reference.

◆ OnPlayerRemoved()

static void Photon.Deterministic.DeterministicFrame.OnPlayerRemoved ( DeterministicFrame  frame,
DeterministicSession  session,
Quantum.PlayerRef  player 
)
inlinestatic

Handles the event when a player is removed from the session.

Parameters
frameThe frame.
sessionThe session.
playerThe player reference.

Member Data Documentation

◆ DumpFlag_NoHeap

const int Photon.Deterministic.DeterministicFrame.DumpFlag_NoHeap = 1 << 0
static

This flag controls if the heap data is dumped when calling DumpFrame(int).

◆ RawInputs

Int32 [] Photon.Deterministic.DeterministicFrame.RawInputs

The raw inputs for the delta compressed input.

◆ Number

Int32 Photon.Deterministic.DeterministicFrame.Number

The frame(/tick) number.

◆ IsPredicted

Boolean Photon.Deterministic.DeterministicFrame.IsPredicted => Verified == false

The frame is predicted (input may be incorrect and rolled-back by the server).

◆ RawInputSize

Int32 Photon.Deterministic.DeterministicFrame.RawInputSize => Input.InputSize

The raw input size.

Property Documentation

◆ IsVerified

Boolean Photon.Deterministic.DeterministicFrame.IsVerified
get

The frame is verified (all input has been validated by the server).