Space Engineers
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | Events | List of all members
Sandbox.Game.Replication.MyEntityPhysicsStateGroup Class Reference

Responsible for synchronizing entity physics over network More...

Inheritance diagram for Sandbox.Game.Replication.MyEntityPhysicsStateGroup:
VRage.Network.IMyStateGroup VRage.Network.IMyNetObject VRage.Network.IMyEventOwner Sandbox.Game.Replication.MyEntityPhysicsStateGroupWithSupport Sandbox.Game.Replication.MyGridPhysicsStateGroup Sandbox.Game.Replication.MyCharacterPhysicsStateGroup Sandbox.Game.Replication.MySmallObjectPhysicsStateGroup Sandbox.Game.Replication.MyFloatingObjectPhysicsStateGroup

Classes

class  PrioritySettings
 

Public Member Functions

delegate void MovedDelegate (ref MatrixD oldTransform, ref MatrixD newTransform)
 
delegate void VelocityDelegate (ref Vector3 oldVelocity, ref Vector3 newVelocity)
 
 MyEntityPhysicsStateGroup (MyEntity entity, IMyReplicable ownerReplicable)
 
void CreateClientData (MyClientStateBase forClient)
 Called on server new clients starts replicating this group. More...
 
void DestroyClientData (MyClientStateBase forClient)
 Called on server when client stops replicating this group. More...
 
void ClientUpdate (uint timestamp)
 
virtual void Destroy ()
 Called when state group is being destroyed. More...
 
virtual MyPlayer GetControllingPlayer ()
 
virtual bool Serialize (BitStream stream, EndpointId forClient, uint timestamp, byte packetId, int maxBitPosition)
 
void OnAck (MyClientStateBase forClient, byte packetId, bool delivered)
 Called for each packet id sent to client from this state group. When ACK received, called immediatelly. When several other packets received from client, but some were missing, called for each missing packet. More...
 
void ForceSend (MyClientStateBase clientData)
 
- Public Member Functions inherited from VRage.Network.IMyStateGroup
void ClientUpdate (MyTimeSpan clientTimestamp)
 Update method called on client. More...
 
void Serialize (BitStream stream, EndpointId forClient, MyTimeSpan timestamp, byte packetId, int maxBitPosition)
 (De)serializes group state or it's diff for client. When writing, you can write beyond maxBitPosition, but message won't be sent and ACKs won't be received for it. ReplicationServer will detect, that state group written beyond packet size and revert it. When nothing written, ReplicationServer will detect that and state group won't receive ACK for that packet id. More...
 
void TimestampReset (MyTimeSpan timestamp)
 
bool IsStillDirty (EndpointId forClient)
 

Static Public Member Functions

static bool ResponsibleForUpdate (MyEntity entity, EndpointId endpointId)
 

Public Attributes

readonly MyEntity Entity
 
readonly IMyReplicable OwnerReplicable
 
const int NUM_DECIMAL_PRECISION = 3
 

Protected Member Functions

virtual bool IsMoving (MyEntity entity)
 
float GetBasicPhysicsPriority (MyClientInfo client)
 Takes into account: Static body (zero priority for static), ResponsibilityForUpdate by client (zero priority for not responsible), otherwise returns OwnerReplicable priority. More...
 
float GetMovementScale (PrioritySettings prioritySettings, out float updateOncePer)
 Gets priority scale and update rate based on prioritySettings. More...
 
virtual float GetGroupPriority (int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
 
bool SerializeServerTransform (BitStream stream, MyEntity entity, Vector3D?deltaPosBase, bool movingOnServer, uint timeStamp, bool lowPrecisionOrientation, ref Vector3D outPosition, ref Quaternion outOrientation, ref MatrixD outWorldMartix, Func< MyEntity, Vector3D, bool > posValidation=null)
 
void SerializeServerVelocities (BitStream stream, MyEntity entity, float simulationRatio, bool movingOnServer, ref Vector3 outLinearVelocity, ref Vector3 outAngularVelocity)
 

Static Protected Member Functions

static bool SerializeTransform (BitStream stream, MyEntity entity, Vector3D?deltaPosBase, bool lowPrecisionOrientation, bool applyWhenReading, bool movingOnServer, uint timeStamp, Func< MyEntity, Vector3D, bool > posValidation=null, MovedDelegate moveHandler=null)
 Serializes transform into 10 to 30.5 bytes. More...
 
static void SerializeVelocities (BitStream stream, MyEntity entity, float simulationRatio, bool applyWhenReading, bool movingOnServer, VelocityDelegate velocityHandler=null)
 Serializes velocities into 12 bytes. More...
 

Protected Attributes

Func< MyEntity, Vector3D, bool > m_positionValidation
 
readonly PrioritySettings m_prioritySettings = new PrioritySettings()
 
uint m_lastMovementFrame = 0
 
bool m_lowPrecisionOrientation
 

Static Protected Attributes

static float PRECISION = 1/(float)Math.Pow(10,NUM_DECIMAL_PRECISION)
 

Properties

bool IsAccelerating [get]
 
virtual bool IsControlledLocally [get]
 
static float EffectiveSimulationRatio [get]
 
MovedDelegate MoveHandler [get]
 
VelocityDelegate VelocityHandler [get]
 
virtual StateGroupEnum GroupType [get]
 
- Properties inherited from VRage.Network.IMyStateGroup
StateGroupEnum GroupType [get]
 
IMyReplicable Owner [get]
 

Events

MovedDelegate OnMoved
 Event which occurs when entity is moved by network. More...
 
VelocityDelegate OnVelocityChanged
 

Detailed Description

Responsible for synchronizing entity physics over network

Definition at line 24 of file MyEntityPhysicsStateGroup.cs.

Constructor & Destructor Documentation

Sandbox.Game.Replication.MyEntityPhysicsStateGroup.MyEntityPhysicsStateGroup ( MyEntity  entity,
IMyReplicable  ownerReplicable 
)
inline

Definition at line 105 of file MyEntityPhysicsStateGroup.cs.

Member Function Documentation

void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.ClientUpdate ( uint  timestamp)
inline

Definition at line 119 of file MyEntityPhysicsStateGroup.cs.

void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.CreateClientData ( MyClientStateBase  forClient)
inline

Called on server new clients starts replicating this group.

Implements VRage.Network.IMyStateGroup.

Definition at line 111 of file MyEntityPhysicsStateGroup.cs.

virtual void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.Destroy ( )
inlinevirtual

Called when state group is being destroyed.

Implements VRage.Network.IMyStateGroup.

Reimplemented in Sandbox.Game.Replication.MyEntityPhysicsStateGroupWithSupport.

Definition at line 123 of file MyEntityPhysicsStateGroup.cs.

void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.DestroyClientData ( MyClientStateBase  forClient)
inline

Called on server when client stops replicating this group.

Implements VRage.Network.IMyStateGroup.

Definition at line 115 of file MyEntityPhysicsStateGroup.cs.

void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.ForceSend ( MyClientStateBase  clientData)
inline

Implements VRage.Network.IMyStateGroup.

Definition at line 445 of file MyEntityPhysicsStateGroup.cs.

float Sandbox.Game.Replication.MyEntityPhysicsStateGroup.GetBasicPhysicsPriority ( MyClientInfo  client)
inlineprotected

Takes into account: Static body (zero priority for static), ResponsibilityForUpdate by client (zero priority for not responsible), otherwise returns OwnerReplicable priority.

Definition at line 133 of file MyEntityPhysicsStateGroup.cs.

virtual MyPlayer Sandbox.Game.Replication.MyEntityPhysicsStateGroup.GetControllingPlayer ( )
inlinevirtual
virtual float Sandbox.Game.Replication.MyEntityPhysicsStateGroup.GetGroupPriority ( int  frameCountWithoutSync,
MyClientInfo  client,
PrioritySettings  settings 
)
inlineprotectedvirtual
float Sandbox.Game.Replication.MyEntityPhysicsStateGroup.GetMovementScale ( PrioritySettings  prioritySettings,
out float  updateOncePer 
)
inlineprotected

Gets priority scale and update rate based on prioritySettings.

Definition at line 172 of file MyEntityPhysicsStateGroup.cs.

virtual bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.IsMoving ( MyEntity  entity)
inlineprotectedvirtual
delegate void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.MovedDelegate ( ref MatrixD  oldTransform,
ref MatrixD  newTransform 
)
void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.OnAck ( MyClientStateBase  forClient,
byte  packetId,
bool  delivered 
)
inline

Called for each packet id sent to client from this state group. When ACK received, called immediatelly. When several other packets received from client, but some were missing, called for each missing packet.

Parameters
forClientThe client.
packetIdId of the delivered or lost packet.
deliveredTrue when packet was delivered, false when packet is considered lost.

Implements VRage.Network.IMyStateGroup.

Definition at line 441 of file MyEntityPhysicsStateGroup.cs.

static bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.ResponsibleForUpdate ( MyEntity  entity,
EndpointId  endpointId 
)
inlinestatic

Definition at line 142 of file MyEntityPhysicsStateGroup.cs.

virtual bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.Serialize ( BitStream  stream,
EndpointId  forClient,
uint  timestamp,
byte  packetId,
int  maxBitPosition 
)
inlinevirtual
bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.SerializeServerTransform ( BitStream  stream,
MyEntity  entity,
Vector3D deltaPosBase,
bool  movingOnServer,
uint  timeStamp,
bool  lowPrecisionOrientation,
ref Vector3D  outPosition,
ref Quaternion  outOrientation,
ref MatrixD  outWorldMartix,
Func< MyEntity, Vector3D, bool >  posValidation = null 
)
inlineprotected

Definition at line 353 of file MyEntityPhysicsStateGroup.cs.

void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.SerializeServerVelocities ( BitStream  stream,
MyEntity  entity,
float  simulationRatio,
bool  movingOnServer,
ref Vector3  outLinearVelocity,
ref Vector3  outAngularVelocity 
)
inlineprotected

Definition at line 404 of file MyEntityPhysicsStateGroup.cs.

static bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.SerializeTransform ( BitStream  stream,
MyEntity  entity,
Vector3D deltaPosBase,
bool  lowPrecisionOrientation,
bool  applyWhenReading,
bool  movingOnServer,
uint  timeStamp,
Func< MyEntity, Vector3D, bool >  posValidation = null,
MovedDelegate  moveHandler = null 
)
inlinestaticprotected

Serializes transform into 10 to 30.5 bytes.

Definition at line 253 of file MyEntityPhysicsStateGroup.cs.

static void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.SerializeVelocities ( BitStream  stream,
MyEntity  entity,
float  simulationRatio,
bool  applyWhenReading,
bool  movingOnServer,
VelocityDelegate  velocityHandler = null 
)
inlinestaticprotected

Serializes velocities into 12 bytes.

Definition at line 370 of file MyEntityPhysicsStateGroup.cs.

delegate void Sandbox.Game.Replication.MyEntityPhysicsStateGroup.VelocityDelegate ( ref Vector3  oldVelocity,
ref Vector3  newVelocity 
)

Member Data Documentation

readonly MyEntity Sandbox.Game.Replication.MyEntityPhysicsStateGroup.Entity

Definition at line 43 of file MyEntityPhysicsStateGroup.cs.

uint Sandbox.Game.Replication.MyEntityPhysicsStateGroup.m_lastMovementFrame = 0
protected

Definition at line 47 of file MyEntityPhysicsStateGroup.cs.

bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.m_lowPrecisionOrientation
protected

Definition at line 48 of file MyEntityPhysicsStateGroup.cs.

Func<MyEntity, Vector3D, bool> Sandbox.Game.Replication.MyEntityPhysicsStateGroup.m_positionValidation
protected

Definition at line 26 of file MyEntityPhysicsStateGroup.cs.

readonly PrioritySettings Sandbox.Game.Replication.MyEntityPhysicsStateGroup.m_prioritySettings = new PrioritySettings()
protected

Definition at line 46 of file MyEntityPhysicsStateGroup.cs.

const int Sandbox.Game.Replication.MyEntityPhysicsStateGroup.NUM_DECIMAL_PRECISION = 3

Definition at line 56 of file MyEntityPhysicsStateGroup.cs.

readonly IMyReplicable Sandbox.Game.Replication.MyEntityPhysicsStateGroup.OwnerReplicable

Definition at line 44 of file MyEntityPhysicsStateGroup.cs.

float Sandbox.Game.Replication.MyEntityPhysicsStateGroup.PRECISION = 1/(float)Math.Pow(10,NUM_DECIMAL_PRECISION)
staticprotected

Definition at line 57 of file MyEntityPhysicsStateGroup.cs.

Property Documentation

float Sandbox.Game.Replication.MyEntityPhysicsStateGroup.EffectiveSimulationRatio
staticget

Definition at line 90 of file MyEntityPhysicsStateGroup.cs.

virtual StateGroupEnum Sandbox.Game.Replication.MyEntityPhysicsStateGroup.GroupType
get

Definition at line 97 of file MyEntityPhysicsStateGroup.cs.

bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.IsAccelerating
getprotected

Definition at line 69 of file MyEntityPhysicsStateGroup.cs.

virtual bool Sandbox.Game.Replication.MyEntityPhysicsStateGroup.IsControlledLocally
getprotected

Definition at line 81 of file MyEntityPhysicsStateGroup.cs.

MovedDelegate Sandbox.Game.Replication.MyEntityPhysicsStateGroup.MoveHandler
get

Definition at line 94 of file MyEntityPhysicsStateGroup.cs.

VelocityDelegate Sandbox.Game.Replication.MyEntityPhysicsStateGroup.VelocityHandler
getprotected

Definition at line 95 of file MyEntityPhysicsStateGroup.cs.

Event Documentation

MovedDelegate Sandbox.Game.Replication.MyEntityPhysicsStateGroup.OnMoved

Event which occurs when entity is moved by network.

Definition at line 102 of file MyEntityPhysicsStateGroup.cs.

VelocityDelegate Sandbox.Game.Replication.MyEntityPhysicsStateGroup.OnVelocityChanged

Definition at line 103 of file MyEntityPhysicsStateGroup.cs.


The documentation for this class was generated from the following file: