SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Enumerations
ReplicaManager3
Plugins

Third implementation of object replication. More...

## Classes

class | SLNet::ReplicaManager3
| System to help automate game object construction, destruction, and serialization. More...
struct | SLNet::LastSerializationResultBS
struct | SLNet::LastSerializationResult
struct | SLNet::SerializeParameters
struct | SLNet::DeserializeParameters
class | SLNet::Connection_RM3
| Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated. More...
class | SLNet::Replica3
| Base class for your replicated objects for the ReplicaManager3 system. More...
struct | SLNet::ReplicaManager3::RM3World

## Typedefs

typedef uint8_t | SLNet::WorldId

## Enumerations

enum | SLNet::SendSerializeIfChangedResult { SLNet::SSICR_SENT_DATA, SLNet::SSICR_DID_NOT_SEND_DATA, SLNet::SSICR_NEVER_SERIALIZE }
enum | SLNet::RM3ConstructionState { SLNet::RM3CS_SEND_CONSTRUCTION, SLNet::RM3CS_ALREADY_EXISTS_REMOTELY, SLNet::RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT, SLNet::RM3CS_NEVER_CONSTRUCT, SLNet::RM3CS_NO_ACTION, SLNet::RM3CS_MAX }
| Return codes for Connection_RM3::GetConstructionState() and Replica3::QueryConstruction() More...
enum | SLNet::RM3DestructionState { SLNet::RM3DS_SEND_DESTRUCTION, SLNet::RM3DS_DO_NOT_QUERY_DESTRUCTION, SLNet::RM3DS_NO_ACTION, SLNet::RM3DS_MAX }
enum | SLNet::RM3SerializationResult { SLNet::RM3SR_BROADCAST_IDENTICALLY, SLNet::RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION, SLNet::RM3SR_SERIALIZED_UNIQUELY, SLNet::RM3SR_SERIALIZED_ALWAYS, SLNet::RM3SR_SERIALIZED_ALWAYS_IDENTICALLY, SLNet::RM3SR_DO_NOT_SERIALIZE, SLNet::RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION, SLNet::RM3SR_MAX }
enum | SLNet::RM3QuerySerializationResult { SLNet::RM3QSR_CALL_SERIALIZE, SLNet::RM3QSR_DO_NOT_CALL_SERIALIZE, SLNet::RM3QSR_NEVER_CALL_SERIALIZE, SLNet::RM3QSR_MAX }
enum | SLNet::RM3ActionOnPopConnection { SLNet::RM3AOPC_DO_NOTHING, SLNet::RM3AOPC_DELETE_REPLICA, SLNet::RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION, SLNet::RM3AOPC_MAX }
enum | SLNet::Replica3P2PMode { SLNet::R3P2PM_SINGLE_OWNER, SLNet::R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE, SLNet::R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE }

## Detailed Description

Third implementation of object replication.

## Class Documentation

class SLNet::ReplicaManager3

System to help automate game object construction, destruction, and serialization.

ReplicaManager3 tracks your game objects and automates the networking for replicating them across the network
As objects are created, destroyed, or serialized differently, those changes are pushed out to other systems.
To use:

1. Derive from Connection_RM3 and implement Connection_RM3::AllocReplica(). This is a factory function where given a user-supplied identifier for a class (such as name) return an instance of that class. Should be able to return any networked object in your game.
2. Derive from ReplicaManager3 and implement AllocConnection() and DeallocConnection() to return the class you created in step 1.
3. Derive your networked game objects from Replica3. All pure virtuals have to be implemented, however defaults are provided for Replica3::QueryConstruction(), Replica3::QueryRemoteConstruction(), and Replica3::QuerySerialization() depending on your network architecture.
4. When a new game object is created on the local system, pass it to ReplicaManager3::Reference().
5. When a game object is destroyed on the local system, and you want other systems to know about it, call Replica3::BroadcastDestruction()

At this point, all new connections will automatically download, get construction messages, get destruction messages, and update serialization automatically.

Definition at line 86 of file ReplicaManager3.h.

Inheritance diagram for SLNet::ReplicaManager3:

### Public Member Functions

| ReplicaManager3 ()
virtual | ~ReplicaManager3 ()
virtual Connection_RM3 * | AllocConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID) const =0
| Implement to return a game specific derivation of Connection_RM3.
virtual void | DeallocConnection (Connection_RM3 *connection) const =0
| Implement to destroy a class instanced returned by AllocConnection()
void | SetAutoManageConnections (bool autoCreate, bool autoDestroy)
| Enable or disable automatically assigning connections to new instances of Connection_RM3.
bool | GetAutoCreateConnections (void) const
bool | GetAutoDestroyConnections (void) const
void | AutoCreateConnectionList (DataStructures::List< RakNetGUID > &participantListIn, DataStructures::List< Connection_RM3 * > &participantListOut, WorldId worldId=0)
| Call AllocConnection() and PushConnection() for each connection in participantList.
bool | PushConnection (SLNet::Connection_RM3 *newConnection, WorldId worldId=0)
| Track a new Connection_RM3 instance.
SLNet::Connection_RM3 * | PopConnection (RakNetGUID guid, WorldId worldId=0)
| Stop tracking a connection.
void | Reference (SLNet::Replica3 *replica3, WorldId worldId=0)
| Adds a replicated object to the system.
void | Dereference (SLNet::Replica3 *replica3, WorldId worldId=0)
| Removes a replicated object from the system.
void | DereferenceList (DataStructures::List< Replica3 * > &replicaListIn, WorldId worldId=0)
| Removes multiple replicated objects from the system.
void | GetReplicasCreatedByGuid (RakNetGUID guid, DataStructures::List< Replica3 * > &replicaListOut, WorldId worldId=0)
| Returns all objects originally created by a particular system.
void | GetReplicasCreatedByMe (DataStructures::List< Replica3 * > &replicaListOut, WorldId worldId=0)
| Returns all objects originally created by your system.
void | GetReferencedReplicaList (DataStructures::List< Replica3 * > &replicaListOut, WorldId worldId=0)
| Returns the entire list of Replicas that we know about.
unsigned | GetReplicaCount (WorldId worldId=0) const
| Returns the number of replicas known about.
Replica3 * | GetReplicaAtIndex (unsigned index, WorldId worldId=0)
| Returns a replica by index.
unsigned int | GetConnectionCount (WorldId worldId=0) const
| Returns the number of connections.
Connection_RM3 * | GetConnectionAtIndex (unsigned index, WorldId worldId=0) const
| Returns a connection pointer previously added with PushConnection()
Connection_RM3 * | GetConnectionBySystemAddress (const SystemAddress &sa, WorldId worldId=0) const
| Returns a connection pointer previously added with PushConnection()
Connection_RM3 * | GetConnectionByGUID (RakNetGUID guid, WorldId worldId=0) const
| Returns a connection pointer previously added with PushConnection.()
void | SetDefaultOrderingChannel (char def)
void | SetDefaultPacketPriority (PacketPriority def)
void | SetDefaultPacketReliability (PacketReliability def)
void | SetAutoSerializeInterval (SLNet::Time intervalMS)
void | GetConnectionsThatHaveReplicaConstructed (Replica3 *replica, DataStructures::List< Connection_RM3 * > &connectionsThatHaveConstructedThisReplica, WorldId worldId=0)
| Return the connections that we think have an instance of the specified Replica3 instance.
bool | GetAllConnectionDownloadsCompleted (WorldId worldId=0) const
| Returns if GetDownloadWasCompleted() returns true for all connections.
void | AddWorld (WorldId worldId)
| ReplicaManager3 can support multiple worlds, where each world has a separate NetworkIDManager, list of connections, replicas, etc A world with id 0 is created automatically. If you want multiple worlds, use this function, and ReplicaManager3::SetNetworkIDManager() to have a different NetworkIDManager instance per world.
void | RemoveWorld (WorldId worldId)
| Deallocate a world added with AddWorld, or the default world with id 0 Deallocating a world will also stop tracking and updating all connections and replicas associated with that world.
WorldId | GetWorldIdAtIndex (unsigned int index)
| Get one of the WorldId values added with AddWorld()
unsigned int | GetWorldCount (void) const
| Returns the number of world id specifiers in memory, added with AddWorld() and removed with RemoveWorld()
void | SetNetworkIDManager (NetworkIDManager *_networkIDManager, WorldId worldId=0)
NetworkIDManager * | GetNetworkIDManager (WorldId worldId=0) const
void | BroadcastDestructionList (DataStructures::List< Replica3 * > &replicaListSource, const SystemAddress &exclusionAddress, WorldId worldId=0)
void | BroadcastDestruction (Replica3 *replica, const SystemAddress &exclusionAddress)
void | Clear (bool deleteWorlds=false)
PRO | GetDefaultSendParameters (void) const
virtual void | Update (void)
| Call interfaces, send data.
Public Member Functions inherited from SLNet::PluginInterface2
| PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
| Called when the interface is attached.
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

### Protected Member Functions

virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnDetach (void)
| Called when the interface is detached.
PluginReceiveResult | OnConstruction (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
PluginReceiveResult | OnSerialize (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, SLNet::Time timestamp, unsigned char packetDataOffset, WorldId worldId)
PluginReceiveResult | OnDownloadStarted (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
PluginReceiveResult | OnDownloadComplete (Packet *packet, unsigned char *packetData, int packetDataLength, RakNetGUID senderGuid, unsigned char packetDataOffset, WorldId worldId)
void | DeallocReplicaNoBroadcastDestruction (SLNet::Connection_RM3 *connection, SLNet::Replica3 *replica3)
SLNet::Connection_RM3 * | PopConnection (unsigned int index, WorldId worldId)
Replica3 * | GetReplicaByNetworkID (NetworkID networkId, WorldId worldId)
unsigned int | ReferenceInternal (SLNet::Replica3 *replica3, WorldId worldId)
Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

### Protected Attributes

PRO | defaultSendParameters
SLNet::Time | autoSerializeInterval
SLNet::Time | lastAutoSerializeOccurance
bool | autoCreateConnections
bool | autoDestroyConnections
Replica3 * | currentlyDeallocatingReplica
uint32_t | nextReferenceIndex
RM3World * | worldsArray [255]
DataStructures::List< RM3World * > | worldsList
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

#### Constructor & Destructor Documentation

SLNet::ReplicaManager3::ReplicaManager3 | ( |  | ) |

virtual SLNet::ReplicaManager3::~ReplicaManager3 | ( |  | ) |

virtual

#### Member Function Documentation

void SLNet::ReplicaManager3::AddWorld | ( | WorldId | worldId | ) |

ReplicaManager3 can support multiple worlds, where each world has a separate NetworkIDManager, list of connections, replicas, etc A world with id 0 is created automatically. If you want multiple worlds, use this function, and ReplicaManager3::SetNetworkIDManager() to have a different NetworkIDManager instance per world.

Parameters

  [in] | worldId | A unique identifier for this world. User-defined

virtual Connection_RM3* SLNet::ReplicaManager3::AllocConnection | ( | const SystemAddress & | systemAddress,
|  | RakNetGUID | rakNetGUID
| ) |  | const

pure virtual

Implement to return a game specific derivation of Connection_RM3.

The connection object represents a remote system connected to you that is using the ReplicaManager3 system.
It has functions to perform operations per-connection.
AllocConnection() and DeallocConnection() are factory functions to create and destroy instances of the connection object.
It is used if autoCreate is true via SetAutoManageConnections() (true by default). Otherwise, the function is not called, and you will have to call PushConnection() manually

Note
  If you do not want a new network connection to immediately download game objects, SetAutoManageConnections() and PushConnection() are how you do this.

See Also
  SetAutoManageConnections()

Parameters

  [in] | systemAddress | Address of the system you are adding
  [in] | rakNetGUID | GUID of the system you are adding. See Packet::rakNetGUID or RakPeerInterface::GetGUIDFromSystemAddress()

Returns
  The new connection instance.

void SLNet::ReplicaManager3::AutoCreateConnectionList | ( | DataStructures::List< RakNetGUID > & | participantListIn,
|  | DataStructures::List< Connection_RM3 * > & | participantListOut,
|  | WorldId | worldId = `0`
| ) |  |

Call AllocConnection() and PushConnection() for each connection in participantList.

Parameters

  [in] | participantListIn | The list of connections to allocate
  [in] | participantListOut | The connections allocated, if any
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

void SLNet::ReplicaManager3::BroadcastDestruction | ( | Replica3 * | replica,
|  | const SystemAddress & | exclusionAddress
| ) |  |

void SLNet::ReplicaManager3::BroadcastDestructionList | ( | DataStructures::List< Replica3 * > & | replicaListSource,
|  | const SystemAddress & | exclusionAddress,
|  | WorldId | worldId = `0`
| ) |  |

Send a network command to destroy one or more Replica3 instances Usually you won't need this, but use Replica3::BroadcastDestruction() instead. The objects are unaffected locally

Parameters

  [in] | replicaList | List of Replica3 objects to tell other systems to destroy.
  [in] | exclusionAddress | Which system to not send to. UNASSIGNED_SYSTEM_ADDRESS to send to all.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

void SLNet::ReplicaManager3::Clear | ( | bool | deleteWorlds = `false` | ) |

virtual void SLNet::ReplicaManager3::DeallocConnection | ( | Connection_RM3 * | connection | ) | const

pure virtual

Implement to destroy a class instanced returned by AllocConnection()

Most likely just implement as {delete connection;}
It is used if autoDestroy is true via SetAutoManageConnections() (true by default). Otherwise, the function is not called and you would then be responsible for deleting your own connection objects.

Parameters

  [in] | connection | The pointer instance to delete

void SLNet::ReplicaManager3::DeallocReplicaNoBroadcastDestruction | ( | SLNet::Connection_RM3 * | connection,
|  | SLNet::Replica3 * | replica3
| ) |  |

protected

void SLNet::ReplicaManager3::Dereference | ( | SLNet::Replica3 * | replica3,
|  | WorldId | worldId = `0`
| ) |  |

Removes a replicated object from the system.

The object is not deallocated, it is up to the caller to do so.
This is called automatically from the destructor of Replica3, so you don't need to call it manually unless you want to stop tracking an object before it is destroyed.

Parameters

  [in] | replica3 | The object to stop tracking
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

void SLNet::ReplicaManager3::DereferenceList | ( | DataStructures::List< Replica3 * > & | replicaListIn,
|  | WorldId | worldId = `0`
| ) |  |

Removes multiple replicated objects from the system.

Same as Dereference(), but for a list of objects.
Useful with the lists returned by GetReplicasCreatedByGuid(), GetReplicasCreatedByMe(), or GetReferencedReplicaList().

Parameters

  [in] | replicaListIn | List of objects
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

bool SLNet::ReplicaManager3::GetAllConnectionDownloadsCompleted | ( | WorldId | worldId = `0` | ) | const

Returns if GetDownloadWasCompleted() returns true for all connections.

Parameters

  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  True when all downloads have been completed

bool SLNet::ReplicaManager3::GetAutoCreateConnections | ( | void |  | ) | const

Returns
  What was passed to the autoCreate parameter of SetAutoManageConnections()

bool SLNet::ReplicaManager3::GetAutoDestroyConnections | ( | void |  | ) | const

Returns
  What was passed to the autoDestroy parameter of SetAutoManageConnections()

Connection_RM3* SLNet::ReplicaManager3::GetConnectionAtIndex | ( | unsigned | index,
|  | WorldId | worldId = `0`
| ) |  | const

Returns a connection pointer previously added with PushConnection()

Parameters

  [in] | index | An index, from 0 to GetConnectionCount()-1.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  A Connection_RM3 pointer

Connection_RM3* SLNet::ReplicaManager3::GetConnectionByGUID | ( | RakNetGUID | guid,
|  | WorldId | worldId = `0`
| ) |  | const

Returns a connection pointer previously added with PushConnection.()

Parameters

  [in] | guid | The guid of the connection to return
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  A Connection_RM3 pointer, or 0 if not found

Connection_RM3* SLNet::ReplicaManager3::GetConnectionBySystemAddress | ( | const SystemAddress & | sa,
|  | WorldId | worldId = `0`
| ) |  | const

Returns a connection pointer previously added with PushConnection()

Parameters

  [in] | sa | The system address of the connection to return
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  A Connection_RM3 pointer, or 0 if not found

unsigned int SLNet::ReplicaManager3::GetConnectionCount | ( | WorldId | worldId = `0` | ) | const

Returns the number of connections.

Returns the number of connections added with ReplicaManager3::PushConnection(), minus the number removed with ReplicaManager3::PopConnection()

Parameters

  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  The number of registered connections

void SLNet::ReplicaManager3::GetConnectionsThatHaveReplicaConstructed | ( | Replica3 * | replica,
|  | DataStructures::List< Connection_RM3 * > & | connectionsThatHaveConstructedThisReplica,
|  | WorldId | worldId = `0`
| ) |  |

Return the connections that we think have an instance of the specified Replica3 instance.

This can be wrong, for example if that system locally deleted the outside the scope of ReplicaManager3, if QueryRemoteConstruction() returned false, or if DeserializeConstruction() returned false.

Parameters

  [in] | replica | The replica to check against.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()
  [out] | connectionsThatHaveConstructedThisReplica | Populated with connection instances that we believe have replica allocated

PRO SLNet::ReplicaManager3::GetDefaultSendParameters | ( | void |  | ) | const

NetworkIDManager* SLNet::ReplicaManager3::GetNetworkIDManager | ( | WorldId | worldId = `0` | ) | const

Returns what was passed to SetNetworkIDManager(), or the instance on RakPeerInterface if unset.

Parameters

  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

void SLNet::ReplicaManager3::GetReferencedReplicaList | ( | DataStructures::List< Replica3 * > & | replicaListOut,
|  | WorldId | worldId = `0`
| ) |  |

Returns the entire list of Replicas that we know about.

This is all Replica3 instances passed to Reference, as well as instances we downloaded and created via Connection_RM3::AllocReference()

Parameters

  [out] | List | of Replica3 instances to be returned
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Replica3* SLNet::ReplicaManager3::GetReplicaAtIndex | ( | unsigned | index,
|  | WorldId | worldId = `0`
| ) |  |

Returns a replica by index.

Returns one of the items in the list that would be returned by GetReferencedReplicaList()

Parameters

  [in] | index | An index, from 0 to GetReplicaCount()-1.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  A Replica3 instance

Replica3* SLNet::ReplicaManager3::GetReplicaByNetworkID | ( | NetworkID | networkId,
|  | WorldId | worldId
| ) |  |

protected

unsigned SLNet::ReplicaManager3::GetReplicaCount | ( | WorldId | worldId = `0` | ) | const

Returns the number of replicas known about.

Returns the size of the list that would be returned by GetReferencedReplicaList()

Parameters

  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

Returns
  How many replica objects are in the list of replica objects

void SLNet::ReplicaManager3::GetReplicasCreatedByGuid | ( | RakNetGUID | guid,
|  | DataStructures::List< Replica3 * > & | replicaListOut,
|  | WorldId | worldId = `0`
| ) |  |

Returns all objects originally created by a particular system.

Originally created is defined as the value of Replica3::creatingSystemGUID, which is automatically assigned in ReplicaManager3::Reference().
You do not have to be directly connected to that system to get the objects originally created by that system.

Parameters

  [in] | guid | GUID of the system we are referring to. Originally passed as the guid parameter to ReplicaManager3::AllocConnection()
  [out] | List | of Replica3 instances to be returned
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

void SLNet::ReplicaManager3::GetReplicasCreatedByMe | ( | DataStructures::List< Replica3 * > & | replicaListOut,
|  | WorldId | worldId = `0`
| ) |  |

Returns all objects originally created by your system.

Calls GetReplicasCreatedByGuid() for your own system guid.

Parameters

  [out] | List | of Replica3 instances to be returned
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

unsigned int SLNet::ReplicaManager3::GetWorldCount | ( | void |  | ) | const

Returns the number of world id specifiers in memory, added with AddWorld() and removed with RemoveWorld()

Returns
  The number of worlds added

WorldId SLNet::ReplicaManager3::GetWorldIdAtIndex | ( | unsigned int | index | ) |

Get one of the WorldId values added with AddWorld()

WorldId 0 is created by default. Worlds will not necessarily be in the order added with AddWorld(). Edit RemoveWorld() changing RemoveAtIndexFast() to RemoveAtIndex() to preserve order.

Parameters

  [in] | index | A value between 0 and GetWorldCount()-1

Returns
  One of the WorldId values added with AddWorld()

virtual void SLNet::ReplicaManager3::OnClosedConnection | ( | const SystemAddress & | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | PI2_LostConnectionReason | lostConnectionReason
| ) |  |

protectedvirtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters

  [in] | systemAddress | The system whose connection was closed
  [in] | rakNetGuid | The guid of the specified system
  [in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::ReplicaManager3::OnConstruction | ( | Packet * | packet,
|  | unsigned char * | packetData,
|  | int | packetDataLength,
|  | RakNetGUID | senderGuid,
|  | unsigned char | packetDataOffset,
|  | WorldId | worldId
| ) |  |

protected

virtual void SLNet::ReplicaManager3::OnDetach | ( | void |  | ) |

protectedvirtual

Called when the interface is detached.

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::ReplicaManager3::OnDownloadComplete | ( | Packet * | packet,
|  | unsigned char * | packetData,
|  | int | packetDataLength,
|  | RakNetGUID | senderGuid,
|  | unsigned char | packetDataOffset,
|  | WorldId | worldId
| ) |  |

protected

PluginReceiveResult SLNet::ReplicaManager3::OnDownloadStarted | ( | Packet * | packet,
|  | unsigned char * | packetData,
|  | int | packetDataLength,
|  | RakNetGUID | senderGuid,
|  | unsigned char | packetDataOffset,
|  | WorldId | worldId
| ) |  |

protected

virtual void SLNet::ReplicaManager3::OnNewConnection | ( | const SystemAddress & | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | bool | isIncoming
| ) |  |

protectedvirtual

Called when we got a new connection

Parameters

  [in] | systemAddress | Address of the new connection
  [in] | rakNetGuid | The guid of the specified system
  [in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from SLNet::PluginInterface2.

virtual void SLNet::ReplicaManager3::OnRakPeerShutdown | ( | void |  | ) |

protectedvirtual

Called when RakPeer is shutdown.

Reimplemented from SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::ReplicaManager3::OnReceive | ( | Packet * | packet | ) |

protectedvirtual

OnReceive is called for every packet.

Parameters

  [in] | packet | the packet that is being returned to the user

Returns
  True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from SLNet::PluginInterface2.

PluginReceiveResult SLNet::ReplicaManager3::OnSerialize | ( | Packet * | packet,
|  | unsigned char * | packetData,
|  | int | packetDataLength,
|  | RakNetGUID | senderGuid,
|  | SLNet::Time | timestamp,
|  | unsigned char | packetDataOffset,
|  | WorldId | worldId
| ) |  |

protected

SLNet::Connection_RM3* SLNet::ReplicaManager3::PopConnection | ( | RakNetGUID | guid,
|  | WorldId | worldId = `0`
| ) |  |

Stop tracking a connection.

On call, for each replica returned by GetReplicasCreatedByGuid(), QueryActionOnPopConnection() will be called. Depending on the return value, this may delete the corresponding replica.
If autoDestroy is true in the call to SetAutoManageConnections() (true by default) then this is called automatically when the connection is lost. In that case, the returned connection instance is deleted.

Parameters

  [in] | guid | of the connection to get. Passed to ReplicaManager3::AllocConnection() originally.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

SLNet::Connection_RM3* SLNet::ReplicaManager3::PopConnection | ( | unsigned int | index,
|  | WorldId | worldId
| ) |  |

protected

bool SLNet::ReplicaManager3::PushConnection | ( | SLNet::Connection_RM3 * | newConnection,
|  | WorldId | worldId = `0`
| ) |  |

Track a new Connection_RM3 instance.

If autoCreate is false for SetAutoManageConnections(), then you need this function to add new instances of Connection_RM3 yourself.
You don't need to track this pointer yourself, you can get it with GetConnectionAtIndex(), GetConnectionByGUID(), or GetConnectionBySystemAddress().

Parameters

  [in] | newConnection | The new connection instance to track.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

void SLNet::ReplicaManager3::Reference | ( | SLNet::Replica3 * | replica3,
|  | WorldId | worldId = `0`
| ) |  |

Adds a replicated object to the system.

Anytime you create a new object that derives from Replica3, and you want ReplicaManager3 to use it, pass it to Reference().
Remote systems already connected will potentially download this object the next time ReplicaManager3::Update() is called, which happens every time you call RakPeerInterface::Receive().
You can also call ReplicaManager3::Update() manually to send referenced objects right away

Parameters

  [in] | replica3 | The object to start tracking
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

unsigned int SLNet::ReplicaManager3::ReferenceInternal | ( | SLNet::Replica3 * | replica3,
|  | WorldId | worldId
| ) |  |

protected

void SLNet::ReplicaManager3::RemoveWorld | ( | WorldId | worldId | ) |

Deallocate a world added with AddWorld, or the default world with id 0 Deallocating a world will also stop tracking and updating all connections and replicas associated with that world.

Parameters

  [in] | worldId | A worldId value previously added with AddWorld()

void SLNet::ReplicaManager3::SetAutoManageConnections | ( | bool | autoCreate,
|  | bool | autoDestroy
| ) |  |

Enable or disable automatically assigning connections to new instances of Connection_RM3.

ReplicaManager3 can automatically create and/or destroy Connection_RM3 as systems connect or disconnect from RakPeerInterface.
By default this is on, to make the system easier to learn and setup.
If you don't want all connections to take part in the game, or you want to delay when a connection downloads the game, set autoCreate to false.
If you want to delay deleting a connection that has dropped, set autoDestroy to false. If you do this, then you must call PopConnection() to remove that connection from being internally tracked. You'll also have to delete the connection instance on your own.

Parameters

  [in] | autoCreate | Automatically call ReplicaManager3::AllocConnection() for each new connection. Defaults to true. Also see AutoCreateConnectionList()
  [in] | autoDestroy | Automatically call ReplicaManager3::DeallocConnection() for each dropped connection. Defaults to true.

void SLNet::ReplicaManager3::SetAutoSerializeInterval | ( | SLNet::Time | intervalMS | ) |

Every intervalMS milliseconds, Connection_RM3::OnAutoserializeInterval() will be called.
Defaults to 30.
Pass with <0 to disable. Pass 0 to Serialize() every time RakPeer::Recieve() is called
If you want to control the update interval with more granularity, use the return values from Replica3::Serialize().

Parameters

  [in] | intervalMS | How frequently to autoserialize all objects. This controls the maximum number of game object updates per second.

void SLNet::ReplicaManager3::SetDefaultOrderingChannel | ( | char | def | ) |

Parameters

  [in] | Default | ordering channel to use for object creation, destruction, and serializations

void SLNet::ReplicaManager3::SetDefaultPacketPriority | ( | PacketPriority | def | ) |

Parameters

  [in] | Default | packet priority to use for object creation, destruction, and serializations

void SLNet::ReplicaManager3::SetDefaultPacketReliability | ( | PacketReliability | def | ) |

Parameters

  [in] | Default | packet reliability to use for object creation, destruction, and serializations

void SLNet::ReplicaManager3::SetNetworkIDManager | ( | NetworkIDManager * | _networkIDManager,
|  | WorldId | worldId = `0`
| ) |  |

Sets the networkIDManager instance that this plugin relys upon.
Uses whatever instance is attached to RakPeerInterface if unset.
To support multiple worlds, you should set it to a different manager for each instance of the plugin

Parameters

  [in] | _networkIDManager | The externally allocated NetworkIDManager instance for this plugin to use.
  [in] | worldId | Used for multiple worlds. World 0 is created automatically by default. See AddWorld()

virtual void SLNet::ReplicaManager3::Update | ( | void |  | ) |

virtual

Call interfaces, send data.

Reimplemented from SLNet::PluginInterface2.

#### Member Data Documentation

bool SLNet::ReplicaManager3::autoCreateConnections

protected

Definition at line 342 of file ReplicaManager3.h.

bool SLNet::ReplicaManager3::autoDestroyConnections

protected

Definition at line 342 of file ReplicaManager3.h.

SLNet::Time SLNet::ReplicaManager3::autoSerializeInterval

protected

Definition at line 340 of file ReplicaManager3.h.

Replica3* SLNet::ReplicaManager3::currentlyDeallocatingReplica

protected

Definition at line 343 of file ReplicaManager3.h.

PRO SLNet::ReplicaManager3::defaultSendParameters

protected

Definition at line 339 of file ReplicaManager3.h.

SLNet::Time SLNet::ReplicaManager3::lastAutoSerializeOccurance

protected

Definition at line 341 of file ReplicaManager3.h.

uint32_t SLNet::ReplicaManager3::nextReferenceIndex

protected

Definition at line 346 of file ReplicaManager3.h.

RM3World* SLNet::ReplicaManager3::worldsArray[255]

protected

Definition at line 349 of file ReplicaManager3.h.

DataStructures::List<RM3World *> SLNet::ReplicaManager3::worldsList

protected

Definition at line 351 of file ReplicaManager3.h.

struct SLNet::LastSerializationResultBS

Definition at line 359 of file ReplicaManager3.h.

Class Members
BitStream | bitStream |
bool | indicesToSend |

struct SLNet::LastSerializationResult

Represents the serialized data for an object the last time it was sent. Used by Connection_RM3::OnAutoserializeInterval() and Connection_RM3::SendSerializeIfChanged()

Definition at line 367 of file ReplicaManager3.h.

### Public Member Functions

| LastSerializationResult ()
| ~LastSerializationResult ()
void | AllocBS (void)

### Public Attributes

SLNet::Replica3 * | replica
SLNet::Time | whenLastSerialized
LastSerializationResultBS * | lastSerializationResultBS

#### Constructor & Destructor Documentation

SLNet::LastSerializationResult::LastSerializationResult | ( |  | ) |

SLNet::LastSerializationResult::~LastSerializationResult | ( |  | ) |

#### Member Function Documentation

void SLNet::LastSerializationResult::AllocBS | ( | void |  | ) |

#### Member Data Documentation

LastSerializationResultBS* SLNet::LastSerializationResult::lastSerializationResultBS

Definition at line 380 of file ReplicaManager3.h.

SLNet::Replica3* SLNet::LastSerializationResult::replica

The replica instance we serialized

Note
  replica MUST be the first member of this struct because I cast from replica to LastSerializationResult in Update()

Definition at line 374 of file ReplicaManager3.h.

SLNet::Time SLNet::LastSerializationResult::whenLastSerialized

Definition at line 377 of file ReplicaManager3.h.

struct SLNet::SerializeParameters

Parameters passed to Replica3::Serialize()

Definition at line 385 of file ReplicaManager3.h.

Class Members
BitSize_t | bitsWrittenSoFar | For prior serializations this tick, for the same connection, how many bits have we written so far? Use this to limit how many objects you send to update per-tick if desired
Time | curTime | Current time, in milliseconds. curTime - whenLastSerialized is how long it has been since this object was last sent
Connection_RM3 * | destinationConnection | Passed to RakPeerInterface::Send().
BitStream * | lastSentBitstream | Last bitstream we sent for this replica to this system. Read, but DO NOT MODIFY
Time | messageTimestamp | Set to non-zero to transmit a timestamp with this message. Defaults to 0 Use SLNet::GetTime() for this
BitStream | outputBitstream | Write your output for serialization here If nothing is written, the serialization will not occur Write to any or all of the NUM_OUTPUT_BITSTREAM_CHANNELS channels available. Channels can hold independent data
PRO | pro | Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketPriority(). Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultPacketReliability(). Passed to RakPeerInterface::Send(). Defaults to ReplicaManager3::SetDefaultOrderingChannel().
Time | whenLastSerialized | When this object was last serialized to the connection 0 means never

struct SLNet::DeserializeParameters

Definition at line 423 of file ReplicaManager3.h.

Class Members
bool | bitstreamWrittenTo |
BitStream | serializationBitstream |
Connection_RM3 * | sourceConnection |
Time | timeStamp |

class SLNet::Connection_RM3

Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated.

Important function: AllocReplica() - must be overridden to create an object given an identifier for that object, which you define for all objects in your game

Definition at line 442 of file ReplicaManager3.h.

### Public Types

enum | ConstructionMode { QUERY_REPLICA_FOR_CONSTRUCTION, QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION, QUERY_CONNECTION_FOR_REPLICA_LIST }
| List of enumerations for how to get the list of valid objects for other systems. More...

### Public Member Functions

| Connection_RM3 (const SystemAddress &_systemAddress, RakNetGUID _guid)
virtual | ~Connection_RM3 ()
virtual Replica3 * | AllocReplica (SLNet::BitStream *allocationIdBitstream, ReplicaManager3 *replicaManager3)=0
| Class factory to create a Replica3 instance, given a user-defined identifier.
virtual void | GetConstructedReplicas (DataStructures::List< Replica3 * > &objectsTheyDoHave)
| Get list of all replicas that are constructed for this connection.
bool | HasReplicaConstructed (SLNet::Replica3 *replica)
virtual void | SerializeOnDownloadStarted (SLNet::BitStream *bitStream)
virtual void | DeserializeOnDownloadStarted (SLNet::BitStream *bitStream)
virtual void | SerializeOnDownloadComplete (SLNet::BitStream *bitStream)
virtual void | DeserializeOnDownloadComplete (SLNet::BitStream *bitStream)
SystemAddress | GetSystemAddress (void) const
RakNetGUID | GetRakNetGUID (void) const
bool | GetDownloadWasCompleted (void) const
virtual bool | QueryGroupDownloadMessages (void) const
| Return whether or not downloads to our system should all be processed the same tick (call to RakPeer::Receive() )
virtual ConstructionMode | QueryConstructionMode (void) const
| Queries how to get the list of objects that exist on remote systems.
virtual void | QueryReplicaList (DataStructures::List< Replica3 * > &newReplicasToCreate, DataStructures::List< Replica3 * > &existingReplicasToDestroy)
| Callback used when QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST.
virtual bool | QuerySerializationList (DataStructures::List< Replica3 * > &replicasToSerialize)
| Override which replicas to serialize and in what order for a connection for a ReplicaManager3::Update() cycle.
virtual SendSerializeIfChangedResult | SendSerialize (SLNet::Replica3 *replica, bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::BitStream serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time timestamp, PRO sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::RakPeerInterface *rakPeer, unsigned char worldId, SLNet::Time curTime)
virtual SendSerializeIfChangedResult | SendSerializeIfChanged (LastSerializationResult *lsr, SerializeParameters *sp, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager, SLNet::Time curTime)
virtual void | SendConstruction (DataStructures::List< Replica3 * > &newObjects, DataStructures::List< Replica3 * > &deletedObjects, PRO sendParameters, SLNet::RakPeerInterface *rakPeer, unsigned char worldId, ReplicaManager3 *replicaManager3)
void | SendValidation (SLNet::RakPeerInterface *rakPeer, WorldId worldId)
void | AutoConstructByQuery (ReplicaManager3 *replicaManager3, WorldId worldId)
void | ClearDownloadGroup (RakPeerInterface *rakPeerInterface)

### Static Public Member Functions

static int | Replica3LSRComp (Replica3 *const &replica3, LastSerializationResult *const &data)

### Public Attributes

bool | isValidated
bool | isFirstConstruction

### Protected Member Functions

void | OnLocalReference (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnDereference (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnDownloadFromThisSystem (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnDownloadFromOtherSystem (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnNeverConstruct (unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
void | OnConstructToThisConnection (unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
void | OnConstructToThisConnection (Replica3 *replica, ReplicaManager3 *replicaManager)
void | OnNeverSerialize (LastSerializationResult *lsr, ReplicaManager3 *replicaManager)
void | OnReplicaAlreadyExists (unsigned int queryToConstructIdx, ReplicaManager3 *replicaManager)
void | OnDownloadExisting (Replica3 *replica3, ReplicaManager3 *replicaManager)
void | OnSendDestructionFromQuery (unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager)
void | OnDoNotQueryDestruction (unsigned int queryToDestructIdx, ReplicaManager3 *replicaManager)
void | ValidateLists (ReplicaManager3 *replicaManager) const
void | SendSerializeHeader (SLNet::Replica3 *replica, SLNet::Time timestamp, SLNet::BitStream *bs, WorldId worldId)

### Protected Attributes

SystemAddress | systemAddress
RakNetGUID | guid
DataStructures::OrderedList < Replica3 *, LastSerializationResult *, Connection_RM3::Replica3LSRComp > | constructedReplicaList
DataStructures::List < LastSerializationResult * > | queryToConstructReplicaList
DataStructures::List < LastSerializationResult * > | queryToSerializeReplicaList
DataStructures::List < LastSerializationResult * > | queryToDestructReplicaList
DataStructures::List< Replica3 * > | constructedReplicasCulled
DataStructures::List< Replica3 * > | destroyedReplicasCulled
bool | groupConstructionAndSerialize
DataStructures::Queue< Packet * > | downloadGroup
bool | gotDownloadComplete

#### Member Enumeration Documentation

enum SLNet::Connection_RM3::ConstructionMode

List of enumerations for how to get the list of valid objects for other systems.

Enumerator:

  QUERY_REPLICA_FOR_CONSTRUCTION | For every object that does not exist on the remote system, call Replica3::QueryConstruction() every tick. Do not call Replica3::QueryDestruction() Do not call Connection_RM3::QueryReplicaList()

  QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION

  For every object that does not exist on the remote system, call Replica3::QueryConstruction() every tick. Based on the call, the object may be sent to the other system. For every object that does exist on the remote system, call Replica3::QueryDestruction() every tick. Based on the call, the object may be deleted on the other system. Do not call Connection_RM3::QueryReplicaList()

  QUERY_CONNECTION_FOR_REPLICA_LIST | Do not call Replica3::QueryConstruction() or Replica3::QueryDestruction() Call Connection_RM3::QueryReplicaList() to determine which objects exist on remote systems This can be faster than QUERY_REPLICA_FOR_CONSTRUCTION and QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION for large worlds See GridSectorizer.h under /Source for code that can help with this

Definition at line 497 of file ReplicaManager3.h.

#### Constructor & Destructor Documentation

SLNet::Connection_RM3::Connection_RM3 | ( | const SystemAddress & | _systemAddress,
|  | RakNetGUID | _guid
| ) |  |

virtual SLNet::Connection_RM3::~Connection_RM3 | ( |  | ) |

virtual

#### Member Function Documentation

virtual Replica3* SLNet::Connection_RM3::AllocReplica | ( | SLNet::BitStream * | allocationIdBitstream,
|  | ReplicaManager3 * | replicaManager3
| ) |  |

pure virtual

Class factory to create a Replica3 instance, given a user-defined identifier.

Identifier is returned by Replica3::WriteAllocationID() for what type of class to create.
This is called when you download a replica from another system.
See Replica3::Dealloc for the corresponding destruction message.
Return 0 if unable to create the intended object. Note, in that case the other system will still think we have the object and will try to serialize object updates to us. Generally, you should not send objects the other system cannot create.

See Also
  Replica3::WriteAllocationID(). Sample implementation:
  {SLNet::RakString typeName; allocationIdBitstream->Read(typeName); if (typeName=="Soldier") return new Soldier; return 0;}

Parameters

  [in] | allocationIdBitstream | user-defined bitstream uniquely identifying a game object type
  [in] | replicaManager3 | Instance of ReplicaManager3 that controls this connection

Returns
  The new replica instance

void SLNet::Connection_RM3::AutoConstructByQuery | ( | ReplicaManager3 * | replicaManager3,
|  | WorldId | worldId
| ) |  |

void SLNet::Connection_RM3::ClearDownloadGroup | ( | RakPeerInterface * | rakPeerInterface | ) |

virtual void SLNet::Connection_RM3::DeserializeOnDownloadComplete | ( | SLNet::BitStream * | bitStream | ) |

inlinevirtual

Receives whatever was written in DeserializeOnDownloadComplete()

Parameters

  [in] | bitStream | Written in SerializeOnDownloadComplete()

Definition at line 485 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::DeserializeOnDownloadStarted | ( | SLNet::BitStream * | bitStream | ) |

inlinevirtual

Receives whatever was written in SerializeOnDownloadStarted()

Parameters

  [in] | bitStream | Written in SerializeOnDownloadStarted()

Definition at line 477 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::GetConstructedReplicas | ( | DataStructures::List< Replica3 * > & | objectsTheyDoHave | ) |

virtual

Get list of all replicas that are constructed for this connection.

Parameters

  [out] | objectsTheyDoHave | Destination list. Returned in sorted ascending order, sorted on the value of the Replica3 pointer.

bool SLNet::Connection_RM3::GetDownloadWasCompleted | ( | void |  | ) | const

inline

Returns
  True if ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE arrived for this connection

Definition at line 494 of file ReplicaManager3.h.

RakNetGUID SLNet::Connection_RM3::GetRakNetGUID | ( | void |  | ) | const

inline

Returns
  Returns the RakNetGUID passed to the constructor of this object

Definition at line 491 of file ReplicaManager3.h.

SystemAddress SLNet::Connection_RM3::GetSystemAddress | ( | void |  | ) | const

inline

Returns
  The system address passed to the constructor of this object

Definition at line 488 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::HasReplicaConstructed | ( | SLNet::Replica3 * | replica | ) |

Returns true if we think this remote connection has this replica constructed

Parameters

  [in] | replica3 | Which replica we are querying

Returns
  True if constructed, false othewise

void SLNet::Connection_RM3::OnConstructToThisConnection | ( | unsigned int | queryToConstructIdx,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnConstructToThisConnection | ( | Replica3 * | replica,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnDereference | ( | Replica3 * | replica3,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnDoNotQueryDestruction | ( | unsigned int | queryToDestructIdx,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnDownloadExisting | ( | Replica3 * | replica3,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnDownloadFromOtherSystem | ( | Replica3 * | replica3,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnDownloadFromThisSystem | ( | Replica3 * | replica3,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnLocalReference | ( | Replica3 * | replica3,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnNeverConstruct | ( | unsigned int | queryToConstructIdx,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnNeverSerialize | ( | LastSerializationResult * | lsr,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnReplicaAlreadyExists | ( | unsigned int | queryToConstructIdx,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

void SLNet::Connection_RM3::OnSendDestructionFromQuery | ( | unsigned int | queryToDestructIdx,
|  | ReplicaManager3 * | replicaManager
| ) |  |

protected

virtual ConstructionMode SLNet::Connection_RM3::QueryConstructionMode | ( | void |  | ) | const

inlinevirtual

Queries how to get the list of objects that exist on remote systems.

The default of calling QueryConstruction for every known object is easy to use, but not efficient, especially for large worlds where many objects are outside of the player's circle of influence.
QueryDestruction is also not necessarily useful or efficient, as object destruction tends to happen in known cases, and can be accomplished by calling Replica3::BroadcastDestruction() QueryConstructionMode() allows you to specify more efficient algorithms than the default when overriden.

Returns
  How to get the list of objects that exist on the remote system. You should always return the same value for a given connection

Definition at line 531 of file ReplicaManager3.h.

virtual bool SLNet::Connection_RM3::QueryGroupDownloadMessages | ( | void |  | ) | const

inlinevirtual

Return whether or not downloads to our system should all be processed the same tick (call to RakPeer::Receive() )

Normally the system will send ID_REPLICA_MANAGER_DOWNLOAD_STARTED, ID_REPLICA_MANAGER_CONSTRUCTION for all downloaded objects, ID_REPLICA_MANAGER_SERIALIZE for each downloaded object, and lastly ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE. This enables the application to show a downloading splash screen on ID_REPLICA_MANAGER_DOWNLOAD_STARTED, a progress bar, and to close the splash screen and activate all objects on ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE However, if the application was not set up for this then it would result in incomplete objects spread out over time, and cause problems If you return true from QueryGroupDownloadMessages(), then these messages will be returned all in one tick, returned only when the download is complete

Note
  ID_REPLICA_MANAGER_DOWNLOAD_STARTED calls the callback DeserializeOnDownloadStarted()
  ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE calls the callback DeserializeOnDownloadComplete()

Definition at line 524 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::QueryReplicaList | ( | DataStructures::List< Replica3 * > & | newReplicasToCreate,
|  | DataStructures::List< Replica3 * > & | existingReplicasToDestroy
| ) |  |

inlinevirtual

Callback used when QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST.

This advantage of this callback is if that there are many objects that a particular connection does not have, then we do not have to iterate through those objects calling QueryConstruction() for each of them.
BR> See GridSectorizer in the Source directory as a method to find all objects within a certain radius in a fast way.
BR>

Parameters

  [out] | newReplicasToCreate | Anything in this list will be created on the remote system
  [out] | existingReplicasToDestroy | Anything in this list will be destroyed on the remote system

Definition at line 541 of file ReplicaManager3.h.

virtual bool SLNet::Connection_RM3::QuerySerializationList | ( | DataStructures::List< Replica3 * > & | replicasToSerialize | ) |

inlinevirtual

Override which replicas to serialize and in what order for a connection for a ReplicaManager3::Update() cycle.

By default, Connection_RM3 will iterate through queryToSerializeReplicaList and call QuerySerialization() on each Replica in that list queryToSerializeReplicaList is populated in the order in which ReplicaManager3::Reference() is called for those objects. If you write to to replicasToSerialize and return true, you can control in what order and for which replicas to call QuerySerialization() Example use case: We have more data to send then the bandwidth supports, so want to prioritize sends. For example enemies shooting are more important than animation effects When QuerySerializationList(), sort objects by priority, and write the list to replicasToSerialize, optionally skipping objects with a lower serialization frequency If you hit your bandwidth limit when checking SerializeParameters::bitsWrittenSoFar, you can return RM3SR_DO_NOT_SERIALIZE for all remaining items

Note
  Only replicas written to replicasToSerialize are transmitted. Even if you returned RM3SR_SERIALIZED_ALWAYS a prior ReplicaManager3::Update() cycle, the replica will not be transmitted if it is not in replicasToSerialize
  If you do not know what objects are candidates for serialization, you can use queryToSerializeReplicaList as a source for your filtering or sorting operations

Parameters

  [in] | replicasToSerialize | List of replicas to call QuerySerialization() on

Returns
  Return true to use replicasToSerialize (replicasToSerialize may be empty if desired). Otherwise return false.

Definition at line 557 of file ReplicaManager3.h.

static int SLNet::Connection_RM3::Replica3LSRComp | ( | Replica3 *const & | replica3,
|  | LastSerializationResult *const & | data
| ) |  |

static

virtual void SLNet::Connection_RM3::SendConstruction | ( | DataStructures::List< Replica3 * > & | newObjects,
|  | DataStructures::List< Replica3 * > & | deletedObjects,
|  | PRO | sendParameters,
|  | SLNet::RakPeerInterface * | rakPeer,
|  | unsigned char | worldId,
|  | ReplicaManager3 * | replicaManager3
| ) |  |

virtual

virtual SendSerializeIfChangedResult SLNet::Connection_RM3::SendSerialize | ( | SLNet::Replica3 * | replica,
|  | bool | indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
|  | SLNet::BitStream | serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
|  | SLNet::Time | timestamp,
|  | PRO | sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
|  | SLNet::RakPeerInterface * | rakPeer,
|  | unsigned char | worldId,
|  | SLNet::Time | curTime
| ) |  |

virtual

void SLNet::Connection_RM3::SendSerializeHeader | ( | SLNet::Replica3 * | replica,
|  | SLNet::Time | timestamp,
|  | SLNet::BitStream * | bs,
|  | WorldId | worldId
| ) |  |

protected

virtual SendSerializeIfChangedResult SLNet::Connection_RM3::SendSerializeIfChanged | ( | LastSerializationResult * | lsr,
|  | SerializeParameters * | sp,
|  | SLNet::RakPeerInterface * | rakPeer,
|  | unsigned char | worldId,
|  | ReplicaManager3 * | replicaManager,
|  | SLNet::Time | curTime
| ) |  |

virtual

void SLNet::Connection_RM3::SendValidation | ( | SLNet::RakPeerInterface * | rakPeer,
|  | WorldId | worldId
| ) |  |

virtual void SLNet::Connection_RM3::SerializeOnDownloadComplete | ( | SLNet::BitStream * | bitStream | ) |

inlinevirtual

When a new connection connects, after constructing and serialization all objects, SerializeOnDownloadComplete() is called

Parameters

  [out] | bitStream | Passed to DeserializeOnDownloadComplete()

Definition at line 481 of file ReplicaManager3.h.

virtual void SLNet::Connection_RM3::SerializeOnDownloadStarted | ( | SLNet::BitStream * | bitStream | ) |

inlinevirtual

When a new connection connects, before sending any objects, SerializeOnDownloadStarted() is called

Parameters

  [out] | bitStream | Passed to DeserializeOnDownloadStarted()

Definition at line 473 of file ReplicaManager3.h.

void SLNet::Connection_RM3::ValidateLists | ( | ReplicaManager3 * | replicaManager | ) | const

protected

#### Member Data Documentation

DataStructures::OrderedList<Replica3*, LastSerializationResult*, Connection_RM3::Replica3LSRComp> SLNet::Connection_RM3::constructedReplicaList

protected

Definition at line 675 of file ReplicaManager3.h.

DataStructures::List<Replica3*> SLNet::Connection_RM3::constructedReplicasCulled

protected

Definition at line 690 of file ReplicaManager3.h.

DataStructures::List<Replica3*> SLNet::Connection_RM3::destroyedReplicasCulled

protected

Definition at line 690 of file ReplicaManager3.h.

DataStructures::Queue<Packet*> SLNet::Connection_RM3::downloadGroup

protected

Definition at line 695 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::gotDownloadComplete

protected

Definition at line 698 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::groupConstructionAndSerialize

protected

Definition at line 694 of file ReplicaManager3.h.

RakNetGUID SLNet::Connection_RM3::guid

protected

Definition at line 610 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::isFirstConstruction

Definition at line 601 of file ReplicaManager3.h.

bool SLNet::Connection_RM3::isValidated

Definition at line 599 of file ReplicaManager3.h.

DataStructures::List<LastSerializationResult*> SLNet::Connection_RM3::queryToConstructReplicaList

protected

Definition at line 680 of file ReplicaManager3.h.

DataStructures::List<LastSerializationResult*> SLNet::Connection_RM3::queryToDestructReplicaList

protected

Definition at line 687 of file ReplicaManager3.h.

DataStructures::List<LastSerializationResult*> SLNet::Connection_RM3::queryToSerializeReplicaList

protected

Definition at line 684 of file ReplicaManager3.h.

SystemAddress SLNet::Connection_RM3::systemAddress

protected

Definition at line 609 of file ReplicaManager3.h.

class SLNet::Replica3

Base class for your replicated objects for the ReplicaManager3 system.

To use, derive your class, or a member of your class, from Replica3.

Definition at line 847 of file ReplicaManager3.h.

Inheritance diagram for SLNet::Replica3:

### Public Member Functions

| Replica3 ()
virtual | ~Replica3 ()
virtual void | WriteAllocationID (SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const =0
| Write a unique identifer that can be read on a remote system to create an object of this same class.
virtual RM3ConstructionState | QueryConstruction (SLNet::Connection_RM3 *destinationConnection, ReplicaManager3 *replicaManager3)=0
| Ask if this object, which does not exist on destinationConnection should (now) be sent to that system.
virtual RM3DestructionState | QueryDestruction (SLNet::Connection_RM3 *destinationConnection, ReplicaManager3 *replicaManager3)
| Ask if this object, which does exist on destinationConnection should be removed from the remote system.
virtual bool | QueryRemoteConstruction (SLNet::Connection_RM3 *sourceConnection)=0
| We're about to call DeserializeConstruction() on this Replica3. If QueryRemoteConstruction() returns false, this object is deleted instead.
virtual bool | QueryRelayDestruction (Connection_RM3 *sourceConnection) const

We got a message from a connection to destroy this replica Return true to automatically relay the destruction message to all our other connections For a client in client/server, it does not matter what this funtion returns For a server in client/server, this should normally return true For a peer in peer to peer, you can normally return false since the original destroying peer would have told all other peers about the destruction If a system gets a destruction command for an object that was already destroyed, the destruction message is ignored.

virtual void | SerializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)=0
| Write data to be sent only when the object is constructed on a remote system.
virtual bool | DeserializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)=0
| Read data written by Replica3::SerializeConstruction()
virtual void | SerializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
virtual void | DeserializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
virtual void | SerializeDestruction (SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection)=0
| Write extra data to send with the object deletion event, if desired.
virtual bool | DeserializeDestruction (SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection)=0
| Read data written by Replica3::SerializeDestruction()
virtual SLNet::RM3ActionOnPopConnection | QueryActionOnPopConnection (SLNet::Connection_RM3 *droppedConnection) const =0
| The system is asking what to do with this replica when the connection is dropped.
virtual void | OnPoppedConnection (SLNet::Connection_RM3 *droppedConnection)
| Notification called for each of our replicas when a connection is popped.
virtual void | DeallocReplica (SLNet::Connection_RM3 *sourceConnection)=0
| Override with {delete this;}.
virtual SLNet::RM3QuerySerializationResult | QuerySerialization (SLNet::Connection_RM3 *destinationConnection)=0
| Implement with QuerySerialization_ClientSerializable(), QuerySerialization_ServerSerializable(), or QuerySerialization_PeerToPeer()
virtual void | OnUserReplicaPreSerializeTick (void)
| Called for each replica owned by the user, once per Serialization tick, before Serialize() is called. If you want to do some kind of operation on the Replica objects that you own, just before Serialization(), then overload this function.
virtual RM3SerializationResult | Serialize (SLNet::SerializeParameters *serializeParameters)=0
| Serialize our class to a bitstream.
virtual void | OnSerializeTransmission (SLNet::BitStream *bitStream, SLNet::Connection_RM3 *destinationConnection, BitSize_t bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], SLNet::Time curTime)
| Called when the class is actually transmitted via Serialize()
virtual void | Deserialize (SLNet::DeserializeParameters *deserializeParameters)=0
| Read what was written in Serialize()
virtual void | PostSerializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
| Called after SerializeConstruction completes for all objects in a given update tick. Writes to PostDeserializeConstruction(), which is called after all objects are created for a given Construction tick(). Override to send data to PostDeserializeConstruction(), such as the NetworkID of other objects to resolve pointers to.
virtual void | PostDeserializeConstruction (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
virtual void | PostSerializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
| Same as PostSerializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.
virtual void | PostDeserializeConstructionExisting (SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
| Same as PostDeserializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.
virtual void | PreDestruction (SLNet::Connection_RM3 *sourceConnection)
virtual RM3ConstructionState | QueryConstruction_ClientConstruction (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
| Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_ClientConstruction (SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
virtual RM3ConstructionState | QueryConstruction_ServerConstruction (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
| Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_ServerConstruction (SLNet::Connection_RM3 *sourceConnection, bool isThisTheServer)
| Default call for QueryRemoteConstruction(). Allow the server to create this object, but not the client.
virtual RM3ConstructionState | QueryConstruction_PeerToPeer (SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER)
| Default call for QueryConstruction().
virtual bool | QueryRemoteConstruction_PeerToPeer (SLNet::Connection_RM3 *sourceConnection)
| Default call for QueryRemoteConstruction().
virtual SLNet::RM3QuerySerializationResult | QuerySerialization_ClientSerializable (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
| Default call for QuerySerialization().
virtual SLNet::RM3QuerySerializationResult | QuerySerialization_ServerSerializable (SLNet::Connection_RM3 *destinationConnection, bool isThisTheServer)
| Default call for QuerySerialization().
virtual SLNet::RM3QuerySerializationResult | QuerySerialization_PeerToPeer (SLNet::Connection_RM3 *destinationConnection, Replica3P2PMode p2pMode=R3P2PM_SINGLE_OWNER)
| Default call for QuerySerialization().
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_Client (SLNet::Connection_RM3 *droppedConnection) const
| Default: If we are a client, and the connection is lost, delete the server's objects.
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_Server (SLNet::Connection_RM3 *droppedConnection) const
| Default: If we are a server, and the connection is lost, delete the client's objects and broadcast the destruction.
virtual RM3ActionOnPopConnection | QueryActionOnPopConnection_PeerToPeer (SLNet::Connection_RM3 *droppedConnection) const
| Default: If we are a peer, and the connection is lost, delete the peer's objects.
virtual void | BroadcastDestruction (void)
RakNetGUID | GetCreatingSystemGUID (void) const
bool | WasReferenced (void) const
Public Member Functions inherited from SLNet::NetworkIDObject
| NetworkIDObject ()
virtual | ~NetworkIDObject ()
virtual void | SetNetworkIDManager (NetworkIDManager *manager)
virtual NetworkIDManager * | GetNetworkIDManager (void) const
| Returns what was passed to SetNetworkIDManager.
virtual NetworkID | GetNetworkID (void)
virtual void | SetNetworkID (NetworkID id)
virtual void | SetParent (void *_parent)
virtual void * | GetParent (void) const

### Public Attributes

RakNetGUID | creatingSystemGUID
RakNetGUID | deletingSystemGUID
| GUID of the system that caused the item to send a deletion command over the network.
ReplicaManager3 * | replicaManager
LastSerializationResultBS | lastSentSerialization
bool | forceSendUntilNextUpdate
LastSerializationResult * | lsr
uint32_t | referenceIndex

## Additional Inherited Members

Protected Attributes inherited from SLNet::NetworkIDObject
NetworkID | networkID
| The network ID of this object.
NetworkIDManager * | networkIDManager
void * | parent
| The parent set by SetParent()
NetworkIDObject * | nextInstanceForNetworkIDManager

#### Constructor & Destructor Documentation

SLNet::Replica3::Replica3 | ( |  | ) |

virtual SLNet::Replica3::~Replica3 | ( |  | ) |

virtual

Before deleting a local instance of Replica3, call Replica3::BroadcastDestruction() for the deletion notification to go out on the network. It is not necessary to call ReplicaManager3::Dereference(), as this happens automatically in the destructor

#### Member Function Documentation

virtual void SLNet::Replica3::BroadcastDestruction | ( | void |  | ) |

virtual

Call to send a network message to delete this object on other systems.
Call it before deleting the object

virtual void SLNet::Replica3::DeallocReplica | ( | SLNet::Connection_RM3 * | sourceConnection | ) |

pure virtual

Override with {delete this;}.

1. Got a remote message to delete this object which passed DeserializeDestruction(), OR
2. ReplicaManager3::SetAutoManageConnections() was called autoDestroy true (which is the default setting), and a remote system that owns this object disconnected) OR <>
   Override with {delete this;} to actually delete the object (and any other processing you wish).
   If you don't want to delete the object, just do nothing, however, the system will not know this. You may wish to call Dereference() if the object should no longer be networked, but remain in memory. You are responsible for deleting it yoruself later.
   destructionBitstream may be 0 if the object was deleted locally

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::Deserialize | ( | SLNet::DeserializeParameters * | deserializeParameters | ) |

pure virtual

Read what was written in Serialize()

Reads the contents of the class from SerializationParamters::serializationBitstream.
Called whenever Serialize() is called with different data from the last send.

Parameters

  [in] | serializationBitstream | Bitstream passed to Serialize()
  [in] | timeStamp | 0 if unused, else contains the time the message originated on the remote system
  [in] | sourceConnection | Which system sent to us

Implemented in SLNet::Replica3Composite< parent_type >.

virtual bool SLNet::Replica3::DeserializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | sourceConnection
| ) |  |

pure virtual

Read data written by Replica3::SerializeConstruction()

Reads whatever data was written to constructionBitstream in Replica3::SerializeConstruction()

Parameters

  [out] | constructionBitstream | Bitstream written to in Replica3::SerializeConstruction()
  [in] | sourceConnection | System that sent us this network message.

Returns
  true to accept construction of the object. false to reject, in which case the object will be deleted via Replica3::DeallocReplica()

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::DeserializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | sourceConnection
| ) |  |

inlinevirtual

Same as DeserializeConstruction(), but for an object that already exists on the remote system. Used if you return RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 924 of file ReplicaManager3.h.

virtual bool SLNet::Replica3::DeserializeDestruction | ( | SLNet::BitStream * | destructionBitstream,
|  | SLNet::Connection_RM3 * | sourceConnection
| ) |  |

pure virtual

Read data written by Replica3::SerializeDestruction()

Return true to delete the object. BroadcastDestruction() will be called automatically, followed by ReplicaManager3::Dereference.
Return false to not delete it. If you delete it at a later point, you are responsible for calling BroadcastDestruction() yourself.

Implemented in SLNet::Replica3Composite< parent_type >.

RakNetGUID SLNet::Replica3::GetCreatingSystemGUID | ( | void |  | ) | const

creatingSystemGUID is set the first time Reference() is called, or if we get the object from another system

Returns
  System that originally created this object

virtual void SLNet::Replica3::OnPoppedConnection | ( | SLNet::Connection_RM3 * | droppedConnection | ) |

inlinevirtual

Notification called for each of our replicas when a connection is popped.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 943 of file ReplicaManager3.h.

virtual void SLNet::Replica3::OnSerializeTransmission | ( | SLNet::BitStream * | bitStream,
|  | SLNet::Connection_RM3 * | destinationConnection,
|  | BitSize_t | bitsPerChannel[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS],
|  | SLNet::Time | curTime
| ) |  |

inlinevirtual

Called when the class is actually transmitted via Serialize()

Use to track how much bandwidth this class it taking

Definition at line 979 of file ReplicaManager3.h.

virtual void SLNet::Replica3::OnUserReplicaPreSerializeTick | ( | void |  | ) |

inlinevirtual

Called for each replica owned by the user, once per Serialization tick, before Serialize() is called. If you want to do some kind of operation on the Replica objects that you own, just before Serialization(), then overload this function.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 966 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostDeserializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | sourceConnection
| ) |  |

inlinevirtual

Called after DeserializeConstruction completes for all objects in a given update tick.
This is used to resolve dependency chains, where two objects would refer to each other in DeserializeConstruction, yet one had not been constructed yet In PostDeserializeConstruction(), you know that all objects have already been created, so can resolve NetworkIDs to pointers safely. You can also use it to trigger some sort of event when you know the object has completed deserialization.

Parameters

  [in] | constructionBitstream | BitStream written in PostSerializeConstruction()
  [in] | sourceConnection | System that sent us this network message.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1000 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostDeserializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | sourceConnection
| ) |  |

inlinevirtual

Same as PostDeserializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1006 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostSerializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | destinationConnection
| ) |  |

inlinevirtual

Called after SerializeConstruction completes for all objects in a given update tick.
Writes to PostDeserializeConstruction(), which is called after all objects are created for a given Construction tick(). Override to send data to PostDeserializeConstruction(), such as the NetworkID of other objects to resolve pointers to.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 992 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PostSerializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | destinationConnection
| ) |  |

inlinevirtual

Same as PostSerializeConstruction(), but for objects that returned RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1003 of file ReplicaManager3.h.

virtual void SLNet::Replica3::PreDestruction | ( | SLNet::Connection_RM3 * | sourceConnection | ) |

inlinevirtual

Called after DeserializeDestruction completes for the object successfully, but obviously before the object is deleted.
Override to trigger some sort of event when you know the object has completed destruction.

Parameters

  [in] | sourceConnection | System that sent us this network message.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 1011 of file ReplicaManager3.h.

virtual SLNet::RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection | ( | SLNet::Connection_RM3 * | droppedConnection | ) | const

pure virtual

The system is asking what to do with this replica when the connection is dropped.

Return QueryActionOnPopConnection_Client, QueryActionOnPopConnection_Server, or QueryActionOnPopConnection_PeerToPeer

Implemented in SLNet::Replica3Composite< parent_type >.

virtual RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection_Client | ( | SLNet::Connection_RM3 * | droppedConnection | ) | const

virtual

Default: If we are a client, and the connection is lost, delete the server's objects.

virtual RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection_PeerToPeer | ( | SLNet::Connection_RM3 * | droppedConnection | ) | const

virtual

Default: If we are a peer, and the connection is lost, delete the peer's objects.

virtual RM3ActionOnPopConnection SLNet::Replica3::QueryActionOnPopConnection_Server | ( | SLNet::Connection_RM3 * | droppedConnection | ) | const

virtual

Default: If we are a server, and the connection is lost, delete the client's objects and broadcast the destruction.

virtual RM3ConstructionState SLNet::Replica3::QueryConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | ReplicaManager3 * | replicaManager3
| ) |  |

pure virtual

Ask if this object, which does not exist on destinationConnection should (now) be sent to that system.

If ReplicaManager3::QueryConstructionMode() returns QUERY_CONNECTION_FOR_REPLICA_LIST or QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION (default), then QueyrConstruction() is called once per tick from ReplicaManager3::Update() to determine if an object should exist on a given system.
Based on the return value, a network message may be sent to the other system to create the object.
If QueryConstructionMode() is overriden to return QUERY_CONNECTION_FOR_REPLICA_LIST, this function is unused.

Note
  Defaults are provided: QueryConstruction_PeerToPeer(), QueryConstruction_ServerConstruction(), QueryConstruction_ClientConstruction(). Return one of these functions for a working default for the relevant topology.

Parameters

  [in] | destinationConnection | Which system we will send to
  [in] | replicaManager3 | Plugin instance for this Replica3

Returns
  What action to take

Implemented in SLNet::Replica3Composite< parent_type >.

virtual RM3ConstructionState SLNet::Replica3::QueryConstruction_ClientConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | bool | isThisTheServer
| ) |  |

virtual

Default call for QueryConstruction().

Both the client and the server is allowed to create this object. The network topology is client/server

Parameters

  [in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | isThisTheServer | True if this system is the server, false if not.

virtual RM3ConstructionState SLNet::Replica3::QueryConstruction_PeerToPeer | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | Replica3P2PMode | p2pMode = `R3P2PM_SINGLE_OWNER`
| ) |  |

virtual

Default call for QueryConstruction().

All clients are allowed to create all objects. The object is not relayed when remotely created

Parameters

  [in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | p2pMode | If controlled only by this system ever, pass R3P2PM_SINGLE_OWNER. Otherwise pass R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE or R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE

virtual RM3ConstructionState SLNet::Replica3::QueryConstruction_ServerConstruction | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | bool | isThisTheServer
| ) |  |

virtual

Default call for QueryConstruction().

Only the server is allowed to create this object. The network topology is client/server

Parameters

  [in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | isThisTheServer | True if this system is the server, false if not.

virtual RM3DestructionState SLNet::Replica3::QueryDestruction | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | ReplicaManager3 * | replicaManager3
| ) |  |

inlinevirtual

Ask if this object, which does exist on destinationConnection should be removed from the remote system.

If ReplicaManager3::QueryConstructionMode() returns QUERY_REPLICA_FOR_CONSTRUCTION_AND_DESTRUCTION (default), then QueryDestruction() is called once per tick from ReplicaManager3::Update() to determine if an object that exists on a remote system should be destroyed for a given system.
Based on the return value, a network message may be sent to the other system to destroy the object.
Note that you can also destroy objects with BroadcastDestruction(), so this function is not useful unless you plan to delete objects for only a particular connection.
If QueryConstructionMode() is overriden to return QUERY_CONNECTION_FOR_REPLICA_LIST, this function is unused.

Parameters

  [in] | destinationConnection | Which system we will send to
  [in] | replicaManager3 | Plugin instance for this Replica3

Returns
  What action to take. Only RM3CS_SEND_DESTRUCTION does anything at this time.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 883 of file ReplicaManager3.h.

References SLNet::RM3DS_DO_NOT_QUERY_DESTRUCTION.

virtual bool SLNet::Replica3::QueryRelayDestruction | ( | Connection_RM3 * | sourceConnection | ) | const

inlinevirtual

We got a message from a connection to destroy this replica Return true to automatically relay the destruction message to all our other connections For a client in client/server, it does not matter what this funtion returns For a server in client/server, this should normally return true For a peer in peer to peer, you can normally return false since the original destroying peer would have told all other peers about the destruction If a system gets a destruction command for an object that was already destroyed, the destruction message is ignored.

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 900 of file ReplicaManager3.h.

virtual bool SLNet::Replica3::QueryRemoteConstruction | ( | SLNet::Connection_RM3 * | sourceConnection | ) |

pure virtual

We're about to call DeserializeConstruction() on this Replica3. If QueryRemoteConstruction() returns false, this object is deleted instead.

By default, QueryRemoteConstruction_ServerConstruction() does not allow clients to create objects. The client will get Replica3::DeserializeConstructionRequestRejected().
If you want the client to be able to potentially create objects for client/server, override accordingly.
Other variants of QueryRemoteConstruction_* just return true.

Note
  Defaults are provided: QueryRemoteConstruction_PeerToPeer(), QueryRemoteConstruction_ServerConstruction(), QueryRemoteConstruction_ClientConstruction(). Return one of these functions for a working default for the relevant topology.

Parameters

  [in] | sourceConnection | Which system sent us the object creation request message.

Returns
  True to allow the object to pass onto DeserializeConstruction() (where it may also be rejected), false to immediately reject the remote construction request

Implemented in SLNet::Replica3Composite< parent_type >.

virtual bool SLNet::Replica3::QueryRemoteConstruction_ClientConstruction | ( | SLNet::Connection_RM3 * | sourceConnection,
|  | bool | isThisTheServer
| ) |  |

virtual

Default call for QueryRemoteConstruction().

Both the client and the server is allowed to create this object. The network topology is client/server The code means on the client or the server, allow creation of Replica3 instances

Parameters

  [in] | sourceConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | isThisTheServer | True if this system is the server, false if not.

virtual bool SLNet::Replica3::QueryRemoteConstruction_PeerToPeer | ( | SLNet::Connection_RM3 * | sourceConnection | ) |

virtual

Default call for QueryRemoteConstruction().

All clients are allowed to create all objects. The object is not relayed when remotely created

Parameters

  [in] | sourceConnection | destinationConnection parameter passed to QueryConstruction()

virtual bool SLNet::Replica3::QueryRemoteConstruction_ServerConstruction | ( | SLNet::Connection_RM3 * | sourceConnection,
|  | bool | isThisTheServer
| ) |  |

virtual

Default call for QueryRemoteConstruction(). Allow the server to create this object, but not the client.

Only the server is allowed to create this object. The network topology is client/server The code means if this is the server, and I got a command to create a Replica3 to ignore it. If this is the client, to allow it.

Parameters

  [in] | sourceConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | isThisTheServer | True if this system is the server, false if not.

virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization | ( | SLNet::Connection_RM3 * | destinationConnection | ) |

pure virtual

Implement with QuerySerialization_ClientSerializable(), QuerySerialization_ServerSerializable(), or QuerySerialization_PeerToPeer()

QuerySerialization() is a first pass query to check if a given object should serializable to a given system. The intent is that the user implements with one of the defaults for client, server, or peer to peer.
Without this function, a careless implementation would serialize an object anytime it changed to all systems. This would give you feedback loops as the sender gets the same message back from the recipient it just sent to.
If more than one system can serialize the same object then you will need to override to return true, and control the serialization result from Replica3::Serialize(). Be careful not to send back the same data to the system that just sent to you!

Returns
  True to allow calling Replica3::Serialize() for this connection, false to not call.

Implemented in SLNet::Replica3Composite< parent_type >.

virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization_ClientSerializable | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | bool | isThisTheServer
| ) |  |

virtual

Default call for QuerySerialization().

Use if the values you are serializing are generated by the client that owns the object. The serialization will be relayed through the server to the other clients.

Parameters

  [in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | isThisTheServer | True if this system is the server, false if not.

virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization_PeerToPeer | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | Replica3P2PMode | p2pMode = `R3P2PM_SINGLE_OWNER`
| ) |  |

virtual

Default call for QuerySerialization().

Use if the values you are serializing are on a peer to peer network. The peer that owns the object will send to all. Remote peers will not send.

Parameters

  [in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | p2pMode | If controlled only by this system ever, pass R3P2PM_SINGLE_OWNER. Otherwise pass R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE or R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE

virtual SLNet::RM3QuerySerializationResult SLNet::Replica3::QuerySerialization_ServerSerializable | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | bool | isThisTheServer
| ) |  |

virtual

Default call for QuerySerialization().

Use if the values you are serializing are generated only by the server. The serialization will be sent to all clients, but the clients will not send back to the server.

Parameters

  [in] | destinationConnection | destinationConnection parameter passed to QueryConstruction()
  [in] | isThisTheServer | True if this system is the server, false if not.

virtual RM3SerializationResult SLNet::Replica3::Serialize | ( | SLNet::SerializeParameters * | serializeParameters | ) |

pure virtual

Serialize our class to a bitstream.

User should implement this function to write the contents of this class to SerializationParamters::serializationBitstream.
If data only needs to be written once, you can write it to SerializeConstruction() instead for efficiency.
Transmitted over the network if it changed from the last time we called Serialize().
Called every time the time interval to ReplicaManager3::SetAutoSerializeInterval() elapses and ReplicaManager3::Update is subsequently called.

Parameters

  in/out] | serializeParameters Parameters controlling the serialization, including destination bitstream to write to

Returns
  Whether to serialize, and if so, how to optimize the results

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::SerializeConstruction | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | destinationConnection
| ) |  |

pure virtual

Write data to be sent only when the object is constructed on a remote system.

SerializeConstruction is used to write out data that you need to create this object in the context of your game, such as health, score, name. Use it for data you only need to send when the object is created.
After SerializeConstruction() is called, Serialize() will be called immediately thereafter. However, they are sent in different messages, so Serialize() may arrive a later frame than SerializeConstruction() For that reason, the object should be valid after a call to DeserializeConstruction() for at least a short time.

Note
  The object's NetworkID and allocation id are handled by the system automatically, you do not need to write these values to constructionBitstream

Parameters

  [out] | constructionBitstream | Destination bitstream to write your data to
  [in] | destinationConnection | System that will receive this network message.

Implemented in SLNet::Replica3Composite< parent_type >.

virtual void SLNet::Replica3::SerializeConstructionExisting | ( | SLNet::BitStream * | constructionBitstream,
|  | SLNet::Connection_RM3 * | destinationConnection
| ) |  |

inlinevirtual

Same as SerializeConstruction(), but for an object that already exists on the remote system. Used if you return RM3CS_ALREADY_EXISTS_REMOTELY from QueryConstruction

Reimplemented in SLNet::Replica3Composite< parent_type >.

Definition at line 920 of file ReplicaManager3.h.

virtual void SLNet::Replica3::SerializeDestruction | ( | SLNet::BitStream * | destructionBitstream,
|  | SLNet::Connection_RM3 * | destinationConnection
| ) |  |

pure virtual

Write extra data to send with the object deletion event, if desired.

Replica3::SerializeDestruction() will be called to write any object destruction specific data you want to send with this event. destructionBitstream can be read in DeserializeDestruction()

Parameters

  [out] | destructionBitstream | Bitstream for you to write to
  [in] | destinationConnection | System that will receive this network message.

Implemented in SLNet::Replica3Composite< parent_type >.

bool SLNet::Replica3::WasReferenced | ( | void |  | ) | const

inline

Returns
  If ReplicaManager3::Reference() was called on this object.

Definition at line 1081 of file ReplicaManager3.h.

virtual void SLNet::Replica3::WriteAllocationID | ( | SLNet::Connection_RM3 * | destinationConnection,
|  | SLNet::BitStream * | allocationIdBitstream
| ) |  | const

pure virtual

Write a unique identifer that can be read on a remote system to create an object of this same class.

The value written to allocationIdBitstream will be passed to Connection_RM3::AllocReplica().
Sample implementation:
{allocationIdBitstream->Write(SLNet::RakString("Soldier");}

Parameters

  [out] | allocationIdBitstream | Bitstream for the user to write to, to identify this class

Implemented in SLNet::Replica3Composite< parent_type >.

#### Member Data Documentation

RakNetGUID SLNet::Replica3::creatingSystemGUID

GUID of the system that first called Reference() on this object. Transmitted automatically when the object is constructed

Definition at line 1085 of file ReplicaManager3.h.

RakNetGUID SLNet::Replica3::deletingSystemGUID

GUID of the system that caused the item to send a deletion command over the network.

Definition at line 1087 of file ReplicaManager3.h.

bool SLNet::Replica3::forceSendUntilNextUpdate

Definition at line 1094 of file ReplicaManager3.h.

LastSerializationResultBS SLNet::Replica3::lastSentSerialization

Definition at line 1093 of file ReplicaManager3.h.

LastSerializationResult* SLNet::Replica3::lsr

Definition at line 1095 of file ReplicaManager3.h.

uint32_t SLNet::Replica3::referenceIndex

Definition at line 1096 of file ReplicaManager3.h.

ReplicaManager3* SLNet::Replica3::replicaManager

Definition at line 1091 of file ReplicaManager3.h.

struct SLNet::ReplicaManager3::RM3World

Definition at line 312 of file ReplicaManager3.h.

### Public Member Functions

| RM3World ()
void | Clear (ReplicaManager3 *replicaManager3)

### Public Attributes

DataStructures::List < Connection_RM3 * > | connectionList
DataStructures::List< Replica3 * > | userReplicaList
WorldId | worldId
NetworkIDManager * | networkIDManager

#### Constructor & Destructor Documentation

SLNet::ReplicaManager3::RM3World::RM3World | ( |  | ) |

#### Member Function Documentation

void SLNet::ReplicaManager3::RM3World::Clear | ( | ReplicaManager3 * | replicaManager3 | ) |

#### Member Data Documentation

DataStructures::List<Connection_RM3*> SLNet::ReplicaManager3::RM3World::connectionList

Definition at line 317 of file ReplicaManager3.h.

NetworkIDManager* SLNet::ReplicaManager3::RM3World::networkIDManager

Definition at line 320 of file ReplicaManager3.h.

DataStructures::List<Replica3*> SLNet::ReplicaManager3::RM3World::userReplicaList

Definition at line 318 of file ReplicaManager3.h.

WorldId SLNet::ReplicaManager3::RM3World::worldId

Definition at line 319 of file ReplicaManager3.h.

## Typedef Documentation

typedef uint8_t SLNet::WorldId

Used for multiple worlds. World 0 is created automatically by default

Used for multiple worlds.

Definition at line 44 of file ReplicaManager3.h.

## Enumeration Type Documentation

enum SLNet::Replica3P2PMode

Used for Replica3::QueryConstruction_PeerToPeer() and Replica3::QuerySerialization_PeerToPeer() to describe how the object replicates between hosts

Enumerator:

  R3P2PM_SINGLE_OWNER | The Replica3 instance is constructed and serialized by one system only. Example: Your avatar. No other player serializes or can create your avatar.
  R3P2PM_MULTI_OWNER_CURRENTLY_AUTHORITATIVE | The Replica3 instance is constructed and/or serialized by different systems This system is currently in charge of construction and/or serialization Example: A pickup. When an avatar holds it, that avatar controls it. When it is on the ground, the host controls it.
  R3P2PM_MULTI_OWNER_NOT_CURRENTLY_AUTHORITATIVE | The Replica3 instance is constructed and/or serialized by different systems Another system is in charge of construction and/or serialization, but this system may be in charge at a later time Example: A pickup held by another player. That player sends creation of that object to new connections, and serializes it until it is dropped.
  R3P2PM_STATIC_OBJECT_CURRENTLY_AUTHORITATIVE | The Replica3 instance is a static object (already exists on the remote system). This system is currently in charge of construction and/or serialization
  R3P2PM_STATIC_OBJECT_NOT_CURRENTLY_AUTHORITATIVE | The Replica3 instance is a static object (already exists on the remote system). Another system is in charge of construction and/or serialization, but this system may be in charge at a later time

Definition at line 822 of file ReplicaManager3.h.

enum SLNet::RM3ActionOnPopConnection

Enumerator:

  RM3AOPC_DO_NOTHING |
  RM3AOPC_DELETE_REPLICA |
  RM3AOPC_DELETE_REPLICA_AND_BROADCAST_DESTRUCTION |
  RM3AOPC_MAX |

Definition at line 812 of file ReplicaManager3.h.

enum SLNet::RM3ConstructionState

Return codes for Connection_RM3::GetConstructionState() and Replica3::QueryConstruction()

Indicates what state the object should be in for the remote system

Enumerator:

  RM3CS_SEND_CONSTRUCTION | This object should exist on the remote system. Send a construction message if necessary If the NetworkID is already in use, it will not do anything If it is not in use, it will create the object, and then call DeserializeConstruction
  RM3CS_ALREADY_EXISTS_REMOTELY | This object should exist on the remote system. The other system already has the object, and the object will never be deleted. This is true of objects that are loaded with the level, for example. Treat it as if it existed, without sending a construction message. Will call Serialize() and SerializeConstructionExisting() to the object on the remote system
  RM3CS_ALREADY_EXISTS_REMOTELY_DO_NOT_CONSTRUCT | Same as RM3CS_ALREADY_EXISTS_REMOTELY but does not call SerializeConstructionExisting()
  RM3CS_NEVER_CONSTRUCT | This object will never be sent to the target system This object will never be serialized from this system to the target system
  RM3CS_NO_ACTION | Don't do anything this tick. Will query again next tick.
  RM3CS_MAX | Max enum.

Definition at line 710 of file ReplicaManager3.h.

enum SLNet::RM3DestructionState

If this object already exists for this system, should it be removed?

Enumerator:

  RM3DS_SEND_DESTRUCTION | This object should not exist on the remote system. Send a destruction message if necessary.
  RM3DS_DO_NOT_QUERY_DESTRUCTION | This object will never be destroyed by a per-tick query. Don't call again.
  RM3DS_NO_ACTION | Don't do anything this tick. Will query again next tick.
  RM3DS_MAX | Max enum.

Definition at line 740 of file ReplicaManager3.h.

enum SLNet::RM3QuerySerializationResult

First pass at topology to see if an object should be serialized

Enumerator:

  RM3QSR_CALL_SERIALIZE | Call Serialize() to see if this object should be serializable for this connection.
  RM3QSR_DO_NOT_CALL_SERIALIZE | Do not call Serialize() this tick to see if this object should be serializable for this connection.
  RM3QSR_NEVER_CALL_SERIALIZE | Never call Serialize() for this object and connection. This system will not serialize this object for this topology.
  RM3QSR_MAX | Max enum.

Definition at line 799 of file ReplicaManager3.h.

enum SLNet::RM3SerializationResult

Return codes when constructing an object

Enumerator:

  RM3SR_BROADCAST_IDENTICALLY | This object serializes identically no matter who we send to We also send it to every connection (broadcast). Efficient for memory, speed, and bandwidth but only if the object is always broadcast identically.

  RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION

  Same as RM3SR_BROADCAST_IDENTICALLY, but assume the object needs to be serialized, do not check with a memcmp Assume the object changed, and serialize it Use this if you know exactly when your object needs to change. Can be faster than RM3SR_BROADCAST_IDENTICALLY. An example of this is if every member variable has an accessor, changing a member sets a flag, and you check that flag in Replica3::QuerySerialization() The opposite of this is RM3SR_DO_NOT_SERIALIZE, in case the object did not change

  RM3SR_SERIALIZED_UNIQUELY | Either this object serializes differently depending on who we send to or we send it to some systems and not others. Inefficient for memory and speed, but efficient for bandwidth However, if you don't know what to return, return this

  RM3SR_SERIALIZED_ALWAYS

  Do not compare against last sent value. Just send even if the data is the same as the last tick If the data is always changing anyway, or you want to send unreliably, this is a good method of serialization Can send unique data per connection if desired. If same data is sent to all connections, use RM3SR_SERIALIZED_ALWAYS_IDENTICALLY for even better performance Efficient for memory and speed, but not necessarily bandwidth

  RM3SR_SERIALIZED_ALWAYS_IDENTICALLY

  Deprecated:
    , use RM3SR_BROADCAST_IDENTICALLY_FORCE_SERIALIZATION

  RM3SR_DO_NOT_SERIALIZE | Do not serialize this object this tick, for this connection. Will query again next autoserialize timer.
  RM3SR_NEVER_SERIALIZE_FOR_THIS_CONNECTION | Never serialize this object for this connection Useful for objects that are downloaded, and never change again Efficient
  RM3SR_MAX | Max enum.

Definition at line 757 of file ReplicaManager3.h.

enum SLNet::SendSerializeIfChangedResult

Enumerator:

  SSICR_SENT_DATA |
  SSICR_DID_NOT_SEND_DATA |
  SSICR_NEVER_SERIALIZE |

Definition at line 432 of file ReplicaManager3.h.