Main simulation class More...
Inherits ILogSource, and INetPeerGroupCallbacks.
Classes | |
struct | AreaOfInterest |
Static access to AreaOfInterest for backwards compatibility More... | |
struct | AreaOfInterestState |
Area of Interest Definition More... | |
Public Member Functions | |
void | GetAreaOfInterestGizmoData (List<(Vector3 center, Vector3 size, int playerCount, int objectCount)> result) |
Clears the provided list and populates it with data about the current Area of Interest (AOI) cells. Each tuple in the list represents one AOI cell, containing its center, size, player count, and object count. More... | |
PlayerRef | GetInputAuthority (NetworkObject networkObject) |
Get the Input Authority PlayerRef for a NetworkObject More... | |
SimulationInput | GetInputForPlayer (PlayerRef player) |
Get the Simulation Input for a specific Player More... | |
void | GetObjectsAndPlayersInAreaOfInterestCell (int cellKey, List< PlayerRef > players, List< NetworkId > objects) |
Used by RunnerAOIGizmos component. Supplies data about current active AOI cells. More... | |
List< NetworkId > | GetObjectsInAreaOfInterestForPlayer (PlayerRef player) |
Retrieves a list of network object IDs that are in the area of interest for the specified player. More... | |
PlayerRef | GetStateAuthority (NetworkObject networkObject) |
Get the State Authority PlayerRef for a NetworkObject More... | |
bool | HasAnyActiveConnections () |
Signal if the Server has any Active Connection with any number of Clients. More... | |
bool | IsInputAuthority (NetworkObject networkObject, PlayerRef playerRef) |
Check if a Player is the Input Authority over an NetworkObject More... | |
bool? | IsInterestedIn (NetworkObject obj, PlayerRef player) |
Check if a NetworkObject is interested by a specific Player More... | |
bool | IsLocalSimulationInputAuthority (NetworkObject obj) |
Check if the Local Player is the Input Authority over a NetworkObject More... | |
bool | IsLocalSimulationStateAuthority (NetworkId id) |
Check if a Player is the State Authority over a NetworkObject by NetworkId More... | |
bool | IsLocalSimulationStateAuthority (NetworkObject obj) |
Check if the Local Player is the State Authority over a NetworkObject More... | |
bool | IsLocalSimulationStateOrInputSource (NetworkObject obj) |
Check if the Local Player is the State Authority or Input Authority over a NetworkObject More... | |
bool | IsStateAuthority (NetworkObject networkObject, PlayerRef playerRef) |
Check if a Player is the State Authority over a NetworkObject More... | |
bool | IsStateAuthority (PlayerRef stateSource, PlayerRef playerRef) |
Check if a Player is the State Authority in relation to another Player More... | |
bool | TryGetHostPlayer (out PlayerRef player) |
Try to get the Host Player More... | |
int | Update (double dt) |
Forwards the Simulation based on the Delta Time More... | |
Protected Member Functions | |
virtual void | AfterSimulation () |
Callback invoked after the Simulation Update More... | |
virtual void | AfterUpdate () |
Callback invoked After the Simulation Update More... | |
virtual void | BeforeFirstTick () |
Callback invoked before the First Tick More... | |
virtual int | BeforeSimulation () |
Callback invoked before the Simulation Loop More... | |
virtual void | BeforeUpdate () |
Callback invoked before the Simulation Update More... | |
virtual void | NetworkConnected (NetConnection *connection) |
Callback invoked on the Connected More... | |
virtual void | NetworkDisconnected (NetConnection *connection, NetDisconnectReason reason) |
Callback invoked on the Disconnected More... | |
virtual void | NetworkReceiveDone () |
Callback invoked when the Network Receive is completed More... | |
virtual void | NoSimulation () |
Callback invoked when there is no simulation More... | |
Properties | |
virtual IEnumerable< PlayerRef > | ActivePlayers [get] |
List of Active players in the Simulation More... | |
SimulationConfig | Config [get] |
The SimulationConfig file used by this Simulation. More... | |
float | DeltaTime [get] |
Gets the fixed tick time interval. Derived from the SimulationRuntimeConfig.TickRate. More... | |
int | InputCount [get] |
The current input collection size More... | |
bool | IsClient [get] |
If this peer is a client. True for client peers in Server/Client topologies, and true for all peers in Shared Mode. More... | |
bool | IsFirstTick [get] |
Use in conjunction with IsResimulation/IsForward inside of FixedUpdateNetwork to determine if the current tick being simulated is the first tick of the resimulation or forward phase of the simulation loop. More... | |
bool | IsForward [get] |
Use inside of FixedUpdateNetwork to determine if the tick currently being simulated has NOT previously been simulated locally. More... | |
bool | IsLastTick [get] |
Use in conjunction with IsResimulation/IsForward inside of FixedUpdateNetwork to determine if the current tick being simulated is the last tick of the resimulation or forward phase of the simulation loop. More... | |
bool | IsLocalPlayerFirstExecution [get] |
True if the current stage of the simulation loop is Forward. False during resimulations. More... | |
bool | IsMasterClient [get] |
Only valid in Shared Mode. Indicates if this peer is flagged as the MasterClient, which means it is default StateAuthority More... | |
bool | IsPlayer [get] |
True for any peer that represents a human player. This is true for all peers except a dedicated server. More... | |
bool | IsResimulation [get] |
Use inside of FixedUpdateNetwork to determine if the tick currently being simulated has previously been simulated locally. Resimulation occurs in client prediction when new states arrive from the StateAuthority. Networked objects are set to the most current authority state tick, and simulations are repeated from that tick to the local current tick. More... | |
bool | IsRunning [get] |
Signal if the Simulation is currently running More... | |
bool | IsServer [get] |
If this peer is the server. True for the Server or Host peer in Server/Client topologies, and always false for all peers in Shared Mode (the relay is the server). More... | |
bool | IsShutdown [get] |
bool | IsSinglePlayer [get] |
Indicates that this simulation is operating in Single Player mode, which is a Host that accepts no connections. More... | |
abstract Tick | LatestServerTick [get] |
latest tick on server we are aware of More... | |
NetAddress | LocalAddress [get] |
Bound Address of the internal socket More... | |
float | LocalAlpha [get] |
abstract PlayerRef | LocalPlayer [get] |
Get LocalPlayer PlayerRef More... | |
SimulationModes | Mode [get] |
Gets the SimulationModes flags for The type of network peer this simulation represents. More... | |
NetConfig * | NetConfigPointer [get] |
Current NetConfig More... | |
int | ObjectCount [get] |
Returns the number of objects in the simulation. More... | |
Dictionary< NetworkId, NetworkObjectMeta > | Objects [get] |
Returns a map of all objects in the simulation. More... | |
NetworkProjectConfig | ProjectConfig [get] |
The NetworkProjectConfig file used by this Simulation. More... | |
float | RemoteAlpha [get] |
Remote Interpolation Alpha More... | |
Tick | RemoteTick [get] |
Remote Tick More... | |
Tick | RemoteTickPrevious [get] |
Remote previous Tick More... | |
double | SendDelta [get] |
The packet send delta time More... | |
int | SendRate [get] |
The packet send rate More... | |
SimulationStages | Stage [get] |
Gets the current SimulationStages value. More... | |
Tick | Tick [get] |
The tick associated with the current state of networked objects, or the current simulation tick being processed (when evaluated during FixedUpdateNetwork). More... | |
double | TickDeltaDouble [get] |
The delta time of each tick as a double More... | |
float | TickDeltaFloat [get] |
The delta time of each tick as a float More... | |
Tick | TickPrevious [get] |
The previous tick More... | |
int | TickRate [get] |
The current tick rate of the simulation More... | |
int | TickStride [get] |
How large the ticks the current simulation takes are More... | |
double | Time [get] |
The current simulation time in seconds More... | |
Topologies | Topology [get] |
Indicates if a Server/Client or Shared Mode (relay server) topology is being used. More... | |
Main simulation class
|
protectedvirtual |
Callback invoked after the Simulation Update
|
protectedvirtual |
Callback invoked After the Simulation Update
|
protectedvirtual |
Callback invoked before the First Tick
|
protectedvirtual |
Callback invoked before the Simulation Loop
|
protectedvirtual |
Callback invoked before the Simulation Update
void GetAreaOfInterestGizmoData | ( | List<(Vector3 center, Vector3 size, int playerCount, int objectCount)> | result | ) |
Clears the provided list and populates it with data about the current Area of Interest (AOI) cells. Each tuple in the list represents one AOI cell, containing its center, size, player count, and object count.
result | The list to be populated with AOI cell data. |
PlayerRef GetInputAuthority | ( | NetworkObject | networkObject | ) |
Get the Input Authority PlayerRef for a NetworkObject
networkObject | NetworkObject to check |
SimulationInput GetInputForPlayer | ( | PlayerRef | player | ) |
Get the Simulation Input for a specific Player
player | Player to check for the Simulation Input |
void GetObjectsAndPlayersInAreaOfInterestCell | ( | int | cellKey, |
List< PlayerRef > | players, | ||
List< NetworkId > | objects | ||
) |
Used by RunnerAOIGizmos component. Supplies data about current active AOI cells.
Retrieves a list of network object IDs that are in the area of interest for the specified player.
player | The player for whom the area of interest is being queried. |
PlayerRef GetStateAuthority | ( | NetworkObject | networkObject | ) |
Get the State Authority PlayerRef for a NetworkObject
networkObject | NetworkObject to check |
bool HasAnyActiveConnections | ( | ) |
Signal if the Server has any Active Connection with any number of Clients.
bool IsInputAuthority | ( | NetworkObject | networkObject, |
PlayerRef | playerRef | ||
) |
Check if a Player is the Input Authority over an NetworkObject
networkObject | NetworkObject to check |
playerRef | Player to check |
bool? IsInterestedIn | ( | NetworkObject | obj, |
PlayerRef | player | ||
) |
Check if a NetworkObject is interested by a specific Player
obj | NetworkObject to check |
player | Player to check |
bool IsLocalSimulationInputAuthority | ( | NetworkObject | obj | ) |
Check if the Local Player is the Input Authority over a NetworkObject
obj | NetworkObject to check |
bool IsLocalSimulationStateAuthority | ( | NetworkId | id | ) |
Check if a Player is the State Authority over a NetworkObject by NetworkId
id | NetworkId of the NetworkObject to check |
bool IsLocalSimulationStateAuthority | ( | NetworkObject | obj | ) |
Check if the Local Player is the State Authority over a NetworkObject
obj | NetworkObject to check |
bool IsLocalSimulationStateOrInputSource | ( | NetworkObject | obj | ) |
Check if the Local Player is the State Authority or Input Authority over a NetworkObject
obj | NetworkObject to check |
bool IsStateAuthority | ( | NetworkObject | networkObject, |
PlayerRef | playerRef | ||
) |
Check if a Player is the State Authority over a NetworkObject
networkObject | NetworkObject to check |
playerRef | Player to check |
Check if a Player is the State Authority in relation to another Player
stateSource | State Source Player |
playerRef | Player to check |
|
protectedvirtual |
Callback invoked on the Connected
connection | Connection that was connected |
|
protectedvirtual |
Callback invoked on the Disconnected
connection | Connection that was disconnected |
reason | Reason for the disconnection |
|
protectedvirtual |
Callback invoked when the Network Receive is completed
|
protectedvirtual |
Callback invoked when there is no simulation
bool TryGetHostPlayer | ( | out PlayerRef | player | ) |
Try to get the Host Player
player | Host Player |
int Update | ( | double | dt | ) |
Forwards the Simulation based on the Delta Time
dt | Delta Time used to forward the simulation |
|
get |
List of Active players in the Simulation
|
get |
The SimulationConfig file used by this Simulation.
|
get |
Gets the fixed tick time interval. Derived from the SimulationRuntimeConfig.TickRate.
|
get |
The current input collection size
|
get |
If this peer is a client. True for client peers in Server/Client topologies, and true for all peers in Shared Mode.
|
get |
Use in conjunction with IsResimulation/IsForward inside of FixedUpdateNetwork to determine if the current tick being simulated is the first tick of the resimulation or forward phase of the simulation loop.
'Resimulation' describes simulating a tick that has been previously been simulated.
'Forward' describes simulating a tick that is being simulated for the first time locally.
'Prediction' describes simulating ticks higher than the most current known StateAuthority snapshot tick.
|
get |
Use inside of FixedUpdateNetwork to determine if the tick currently being simulated has NOT previously been simulated locally.
|
get |
Use in conjunction with IsResimulation/IsForward inside of FixedUpdateNetwork to determine if the current tick being simulated is the last tick of the resimulation or forward phase of the simulation loop.
'Resimulation' describes simulating a tick that has been previously been simulated.
'Forward' describes simulating a tick that is being simulated for the first time locally.
'Prediction' describes simulating ticks higher than the most current known StateAuthority snapshot tick.
|
get |
True if the current stage of the simulation loop is Forward. False during resimulations.
'Resimulation' describes simulating a tick that has been previously been simulated.
'Forward' describes simulating a tick that is being simulated for the first time locally.
'Prediction' describes simulating ticks higher than the most current known StateAuthority snapshot tick.
|
get |
Only valid in Shared Mode. Indicates if this peer is flagged as the MasterClient, which means it is default StateAuthority
|
get |
True for any peer that represents a human player. This is true for all peers except a dedicated server.
|
get |
Use inside of FixedUpdateNetwork to determine if the tick currently being simulated has previously been simulated locally. Resimulation occurs in client prediction when new states arrive from the StateAuthority. Networked objects are set to the most current authority state tick, and simulations are repeated from that tick to the local current tick.
|
get |
Signal if the Simulation is currently running
|
get |
If this peer is the server. True for the Server or Host peer in Server/Client topologies, and always false for all peers in Shared Mode (the relay is the server).
|
get |
|
get |
Indicates that this simulation is operating in Single Player mode, which is a Host that accepts no connections.
|
get |
latest tick on server we are aware of
|
get |
Bound Address of the internal socket
|
get |
|
get |
Gets the SimulationModes flags for The type of network peer this simulation represents.
|
get |
Current NetConfig
|
get |
Returns the number of objects in the simulation.
|
get |
Returns a map of all objects in the simulation.
|
get |
The NetworkProjectConfig file used by this Simulation.
|
get |
Remote Interpolation Alpha
|
get |
The packet send delta time
|
get |
The packet send rate
|
get |
Gets the current SimulationStages value.
The tick associated with the current state of networked objects, or the current simulation tick being processed (when evaluated during FixedUpdateNetwork).
|
get |
The delta time of each tick as a double
|
get |
The delta time of each tick as a float
|
get |
The previous tick
|
get |
The current tick rate of the simulation
|
get |
How large the ticks the current simulation takes are
|
get |
The current simulation time in seconds
|
get |
Indicates if a Server/Client or Shared Mode (relay server) topology is being used.