RakNet::Connection_RM2 Class Reference
[ReplicaManager2]
This class represents a connection between two instances of
ReplicaManager2.
More...
#include <ReplicaManager2.h>
List of all members.
|
Public Member Functions |
virtual Replica2 * | Construct (RakNet::BitStream *replicaData, SystemAddress sender, SerializationType type, ReplicaManager2 *replicaManager, RakNetTime timestamp, NetworkID networkId, bool networkIDCollision)=0 |
virtual void | SortInitialDownload (const DataStructures::List< Replica2 * > &orderedDownloadList, DataStructures::List< Replica2 * > &initialDownloadList) |
virtual void | SerializeDownloadStarted (RakNet::BitStream *objectData, ReplicaManager2 *replicaManager, SerializationContext *serializationContext) |
virtual void | SerializeDownloadComplete (RakNet::BitStream *objectData, ReplicaManager2 *replicaManager, SerializationContext *serializationContext) |
virtual void | DeserializeDownloadStarted (RakNet::BitStream *objectData, SystemAddress sender, ReplicaManager2 *replicaManager, RakNetTime timestamp, SerializationType serializationType) |
virtual void | DeserializeDownloadComplete (RakNet::BitStream *objectData, SystemAddress sender, ReplicaManager2 *replicaManager, RakNetTime timestamp, SerializationType serializationType) |
virtual void | SetConstructionByList (DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > ¤tVisibility, ReplicaManager2 *replicaManager) |
virtual void | SetVisibilityByList (DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > ¤tVisibility, ReplicaManager2 *replicaManager) |
virtual void | SetConstructionByReplicaQuery (ReplicaManager2 *replicaManager) |
virtual void | SetVisibilityByReplicaQuery (ReplicaManager2 *replicaManager) |
void | SetSystemAddress (SystemAddress sa) |
| Set the system address to use with this class instance. This is set internally when the object is created.
|
SystemAddress | GetSystemAddress (void) const |
| Get the system address associated with this class instance.
|
void | SetGuid (RakNetGUID guid) |
| Set the guid to use with this class instance. This is set internally when the object is created.
|
RakNetGUID | GetGuid (void) const |
| Get the guid associated with this class instance.
|
Detailed Description
This class represents a connection between two instances of
ReplicaManager2.
Represents a connection. Allocated by user supplied factory interface Connection_RM2Factory.
Implicitly created as needed.
Generally you will want to implement at a minimum the Construct() function, used as a factory function to create your game objects.
Member Function Documentation
Factory function, used to create instances of your game objects Encoding is entirely up to you. replicaData will hold whatever was written bitStream in Replica2::SerializeConstruction() One efficient way to do it is to use StringTable.h. This allows you to send predetermined strings over the network at a cost of 9 bits, up to 65536 strings
- Note:
- The object is not yet referenced by ReplicaManager2 in this callback. Use Replica2::OnConstructionComplete() to perform functionality such as AutoSerialize()
- Parameters:
-
[in] | replicaData | Whatever was written bitStream in Replica2::SerializeConstruction() |
[in] | type | Whatever was written serializationType in Replica2::SerializeConstruction() |
[in] | replicaManager | ReplicaManager2 instance that created this class. |
[in] | timestamp | timestamp sent with Replica2::SerializeConstruction(), 0 for none. |
[in] | networkId | NetworkID that will be assigned automatically to the new object after this function returns |
[in] | networkIDCollision | True if the network ID that should be assigned to this object is already in use. Usuallly this is because the object already exists, and you should just read your data and return 0. |
- Returns:
- Return 0 to signal that construction failed or was refused for this object. Otherwise return the object that was created. A reference will be held to this object, and SetNetworkID() and SetReplicaManager() will be called automatically.
CALLBACK: A new connection was added. All objects that are constructed and visible for this system have now arrived. Write data to objectData by deriving from SerializeDownloadComplete
- Note:
- Only called if SetAutoUpdateScope is called with serializationVisiblity or construction true. (This is the default)
- Parameters:
-
[in] | objectData | objectData Data written through SerializeDownloadComplete() |
[in] | replicaManager | Which replica manager to use to perform the send |
[in] | timestamp | timestamp sent, 0 for none |
[in] | serializationType | Type of command |
CALLBACK: A new connection was added. All objects that are constructed and visible for this system will arrive immediately after this message. Write data to objectData by deriving from SerializeDownloadStarted()
- Note:
- Only called if SetAutoUpdateScope is called with serializationVisiblity or construction true. (This is the default)
- Parameters:
-
[in] | objectData | objectData Data written through SerializeDownloadStarted() |
[in] | replicaManager | Which replica manager to use to perform the send |
[in] | timestamp | timestamp sent, 0 for none |
[in] | serializationType | Type of command |
CALLBACK: Called after a download is sent to a new connection
- Parameters:
-
[out] | objectData | What data you want to send to DeSerializeDownloadComplete() |
[in] | replicaManager | Which replica manager to use to perform the send |
| in/out] | serializationContext Target recipient, optional timestamp, type of command |
CALLBACK: Called before a download is sent to a new connection
- Parameters:
-
[out] | objectData | What data you want to send to DeSerializeDownloadStarted() |
[in] | replicaManager | Which replica manager to use to perform the send |
| in/out] | serializationContext Target recipient, optional timestamp, type of command |
Given a list of objects, compare it against lastConstructionList. BroadcastConstruct() is called for objects that only exist in the new list. BroadcastDestruct() is called for objects that only exist in the old list. This is used by SetConstructionByReplicaQuery() for all Replica2 that do not return BQR_ALWAYS from Replica2::QueryConstruction() If you want to pass your own, more efficient list to check against, call ReplicaManager2::SetAutoUpdateScope with construction=false and call this function yourself when desired
- Parameters:
-
[in] | List | of all objects that do not return BQR_ALWAYS from Replica2::QueryConstruction() that should currently be created on this system |
[in] | replicaManager | Which replica manager to use to perform the send |
virtual void RakNet::Connection_RM2::SetConstructionByReplicaQuery |
( |
ReplicaManager2 * |
replicaManager |
) |
[virtual] |
Given a list of objects, compare it against lastSerializationList. Replica2::BroadcastVisibility(true) is called for objects that only exist in the new list. Replica2::BroadcastVisibility(false) is called for objects that only exist in the old list. This is used by SetVisibilityByReplicaQuery() for all Replica2 that do not return BQR_ALWAYS from Replica2::QueryVisibility() If you want to pass your own, more efficient list to check against, call ReplicaManager2::SetAutoUpdateScope with construction=false and call this function yourself when desired
- Parameters:
-
[in] | List | of all objects that do not return BQR_ALWAYS from Replica2::QueryConstruction() that should currently be created on this system |
[in] | replicaManager | Which replica manager to use to perform the send |
virtual void RakNet::Connection_RM2::SetVisibilityByReplicaQuery |
( |
ReplicaManager2 * |
replicaManager |
) |
[virtual] |
CALLBACK: Called before a download is sent to a new connection, called after ID_REPLICA_MANAGER_DOWNLOAD_STARTED is sent. Gives you control over the list of objects to be downloaded. For greater control, you can override ReplicaManager2::DownloadToNewConnection Defaults to send everything in the default order
- Parameters:
-
[in] | fullReplicaUnorderedList | The list of all known objects in the order they were originally known about by the system (the first time used by any function) |
[out] | orderedDownloadList | An empty list. Copy fullReplicaUnorderedList to this list to send everything. Leave elements out to not send them. Add them to the list in a different order to send them in that order. |
The documentation for this class was generated from the following file: