Photon Quantum 3.0.0

Public Member Functions | List of all members
Quantum.InputProvider Class Reference

The input provider is used to push recorded inputs into the simulation. This class uses the full input history instead of delta compressed input stream which uses a large memory footprint. More...

Inheritance diagram for Quantum.InputProvider:
Photon.Deterministic.IDeterministicReplayProvider Photon.Deterministic.IDeterministicRpcProvider Photon.Deterministic.IDeterministicInputProvider

Public Member Functions

 InputProvider (DeterministicSessionConfig config, int capacity=60 *60, int growSize=0)
 Construct an input provider with a given capacity and grow size. More...
 
 InputProvider (DeterministicTickInputSet[] inputList)
 Construct an input provider with a given list of inputs. More...
 
 InputProvider (int playerCount, int startFrame, int capacity, int growSize)
 Construct an input provider with a given player count, start frame, capacity and grow size. More...
 
void AddRpc (int player, byte[] data, bool command)
 Unused. More...
 
bool CanSimulate (int frame)
 Returns true if the input provider can simulate the given frame. More...
 
void Clear (int startFrame)
 Clear all recorded inputs. Usually called after a resync. More...
 
DeterministicTickInputSet[] ExportToList (int verifiedFrame)
 Export the inputs to a list. More...
 
DeterministicFrameInputTemp GetInput (int frame, int player)
 Returns input for a given frame and player. More...
 
QTuple< byte[], bool > GetRpc (int frame, int player)
 Reads a rpc from the input provider. More...
 
void ImportFromList (DeterministicTickInputSet[] inputList)
 Import a list of inputs into the input provider. More...
 
void InjectInput (DeterministicTickInput input, bool localReplay)
 Injects a random input. More...
 
void OnInputConfirmed (QuantumGame game, DeterministicFrameInputTemp input)
 This callback is called when an input was confirmed and can be recorded. More...
 

Detailed Description

The input provider is used to push recorded inputs into the simulation. This class uses the full input history instead of delta compressed input stream which uses a large memory footprint.

Constructor & Destructor Documentation

◆ InputProvider() [1/3]

Quantum.InputProvider.InputProvider ( DeterministicSessionConfig  config,
int  capacity = 60 * 60,
int  growSize = 0 
)
inline

Construct an input provider with a given capacity and grow size.

Parameters
configSession config used to gather PlayerCount and RollbackWindow
capacityThe initial capacity
growSizeThe grow size, 0 means doubling the buffer

◆ InputProvider() [2/3]

Quantum.InputProvider.InputProvider ( DeterministicTickInputSet[]  inputList)
inline

Construct an input provider with a given list of inputs.

Parameters
inputListInput list

◆ InputProvider() [3/3]

Quantum.InputProvider.InputProvider ( int  playerCount,
int  startFrame,
int  capacity,
int  growSize 
)
inline

Construct an input provider with a given player count, start frame, capacity and grow size.

Parameters
playerCountPlayer count
startFrameStart frame
capacityThe initial capacity
growSizeThe grow size, 0 means doubling the buffer

Member Function Documentation

◆ CanSimulate()

bool Quantum.InputProvider.CanSimulate ( int  frame)
inline

Returns true if the input provider can simulate the given frame.

Parameters
frameRequested frame
Returns
True if the input for this frame is available

Implements Photon.Deterministic.IDeterministicInputProvider.

◆ Clear()

void Quantum.InputProvider.Clear ( int  startFrame)
inline

Clear all recorded inputs. Usually called after a resync.

Parameters
startFrameNew start frame

◆ ImportFromList()

void Quantum.InputProvider.ImportFromList ( DeterministicTickInputSet[]  inputList)
inline

Import a list of inputs into the input provider.

Parameters
inputListA reference to the imported list is internally copied.

◆ ExportToList()

DeterministicTickInputSet [] Quantum.InputProvider.ExportToList ( int  verifiedFrame)
inline

Export the inputs to a list.

Parameters
verifiedFrameThe max frame that in input available for
Returns
A list on inputs that can be saved to a file.

◆ OnInputConfirmed()

void Quantum.InputProvider.OnInputConfirmed ( QuantumGame  game,
DeterministicFrameInputTemp  input 
)
inline

This callback is called when an input was confirmed and can be recorded.

Parameters
gameThe game
inputThe confirmed input

◆ InjectInput()

void Quantum.InputProvider.InjectInput ( DeterministicTickInput  input,
bool  localReplay 
)
inline

Injects a random input.

Parameters
inputInput to inject
localReplayIf set to true the input sent flag is set to true

◆ AddRpc()

void Quantum.InputProvider.AddRpc ( int  player,
byte[]  data,
bool  command 
)
inline

◆ GetRpc()

QTuple<byte[], bool> Quantum.InputProvider.GetRpc ( int  frame,
int  player 
)
inline

Reads a rpc from the input provider.

Parameters
frameFrame
playerPlayer
Returns
The rpc and a bool that is true when the rpc is a command

Implements Photon.Deterministic.IDeterministicRpcProvider.

◆ GetInput()

DeterministicFrameInputTemp Quantum.InputProvider.GetInput ( int  frame,
int  player 
)
inline

Returns input for a given frame and player.

Parameters
frameRequested frame
playerRequested player
Returns
Input object for that player and frame

Implements Photon.Deterministic.IDeterministicInputProvider.