QuantumGame acts as an interface to the simulation from the client code's perspective. More...
Inherits Photon.Deterministic.IDeterministicGame.
Classes | |
class | FramesContainer |
Stores the different frames the simulation uses during one tick. More... | |
Public Member Functions | |
Int32[] | GetLocalPlayers () |
Returns an array that is unique on every client and represents the indexes for players that your local machine controls in the Quantum simulation. More... | |
Boolean | PlayerIsLocal (PlayerRef playerRef) |
Helps to decide if a PlayerRef is associated with the local player. More... | |
void | SendCommand (DeterministicCommand command) |
Sends a command to the server. More... | |
void | SendCommand (Int32 player, DeterministicCommand command) |
Sends a command to the server. More... | |
void | SendPlayerData (Int32 player, RuntimePlayer data) |
Send data for one local player to join the online match. More... | |
void | SendPlayerData (RuntimePlayer data) |
Send data for the local player to join the online match. If the client has multiple local players, the data will be sent for the first of them (smallest player index). More... | |
void | SetPredictionArea (FPVector2 position, FP radius) |
See SetPredictionArea(FPVector3, FP). More... | |
void | SetPredictionArea (FPVector3 position, FP radius) |
Set the prediction area. More... | |
Public Attributes | |
int | GameFlags => _flags |
QuantumGameFlags More... | |
bool | IsSessionDestroyed => Session != null && Session.IsDestroyed |
Returns true when the session has been assigned and has been destroyed. The session assignment happens during the DeterministicSession contructor which is usually during QuantumRunner.StartGame(). More... | |
Properties | |
IAssetSerializer | AssetSerializer [get] |
ConfigurationsContainer | Configurations [get] |
Access the configurations that the simulation is running with. More... | |
FramesContainer | Frames [get] |
Access the frames of various times available during one tick. More... | |
int | HeapExtraCount [get] |
Extra heaps to allocate for a session in case you need to create 'auxiliary' frames than actually required for the simulation itself. More... | |
InstantReplaySettings | InstantReplayConfig [get] |
Single | InterpolationFactor [get] |
Used for position interpolation on the client for smoother interpolation results. More... | |
DeterministicSession | Session [get] |
Access the Deterministic session object to query more internals. More... | |
QuantumGame acts as an interface to the simulation from the client code's perspective.
Access and method to this class is always safe from the clients point of view.
|
inline |
Returns an array that is unique on every client and represents the indexes for players that your local machine controls in the Quantum simulation.
|
inline |
Helps to decide if a PlayerRef is associated with the local player.
playerRef | Player reference |
|
inline |
Sends a command to the server.
command | Command to send |
Commands are similar to input, they drive the simulation, but do not have to be sent regularly.
|
inline |
Sends a command to the server.
player | Specify the player index (PlayerRef) when you have multiple players controlled from the same machine. |
command | Command to send |
See SendCommand(DeterministicCommand)
Games that only have one local player can ignore the player index field.
|
inline |
Send data for the local player to join the online match. If the client has multiple local players, the data will be sent for the first of them (smallest player index).
data | Player data |
After starting, joining the Quantum Game and after the OnGameStart signal has been fired each player needs to call the SendPlayerData method to be added as a player in every ones simulation.
The reason this needs to be called explicitly is that it greatly simplifies late-joining players.
|
inline |
Send data for one local player to join the online match.
player | Local player index |
data | Player data |
After starting, joining the Quantum Game and after the OnGameStart signal has been fired each player needs to call the SendPlayerData method to be added as a player in every ones simulation.
The reason this needs to be called explicitly is that it greatly simplifies late-joining players.
Set the prediction area.
position | Center of the prediction area |
radius | Radius of the prediction area |
The Prediction Culling feature must be explicitly enabled in SimulationConfig.UsePredictionArea.
This can be safely called from the main-thread.
Prediction Culling allows developers to save CPU time in games where the player has only a partial view of the game scene. Quantum prediction and rollbacks, which are time consuming, will only run for important entities that are visible to the local player(s). Leaving anything outside that area to be simulated only once per tick with no rollbacks as soon as the inputs are confirmed from server. It is safe and simple to activate and, depending on the game, the performance difference can be quite large.Imagine a 30Hz game to constantly rollback ten ticks for every confirmed input (with more players, the predictor eventually misses at least for one of them). This requires the game simulation to be lightweight to be able to run at almost 300Hz(because of the rollbacks). With Prediction Culling enabled the full frames will be simulated at the expected 30Hz all the time while the much smaller prediction area is the only one running within the prediction buffer.
See SetPredictionArea(FPVector3, FP).
position | |
radius |
bool Quantum.QuantumGame.IsSessionDestroyed => Session != null && Session.IsDestroyed |
Returns true when the session has been assigned and has been destroyed. The session assignment happens during the DeterministicSession contructor which is usually during QuantumRunner.StartGame().
int Quantum.QuantumGame.GameFlags => _flags |
|
get |
Access the frames of various times available during one tick.
|
get |
Access the configurations that the simulation is running with.
|
get |
Access the Deterministic session object to query more internals.
|
get |
Used for position interpolation on the client for smoother interpolation results.
|
get |
|
get |
|
get |
Extra heaps to allocate for a session in case you need to create 'auxiliary' frames than actually required for the simulation itself.