This class represents a connection between two instances of ReplicaManager2. More...
#include <ReplicaManager2.h>
Public Member Functions | |
Connection_RM2 () | |
virtual | ~Connection_RM2 () |
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. | |
Protected Member Functions | |
void | Deref (Replica2 *replica) |
void | CalculateListExclusivity (const DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > &listOne, const DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > &listTwo, DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > &exclusiveToListOne, DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > &exclusiveToListTwo) const |
virtual Replica2 * | ReceiveConstruct (RakNet::BitStream *replicaData, NetworkID networkId, SystemAddress sender, unsigned char localClientId, SerializationType type, ReplicaManager2 *replicaManager, RakNetTime timestamp, DataStructures::OrderedList< SystemAddress, SystemAddress > &exclusionList) |
Protected Attributes | |
SystemAddress | systemAddress |
RakNetGUID | rakNetGuid |
DataStructures::OrderedList < Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > | lastConstructionList |
DataStructures::OrderedList < Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > | lastSerializationList |
Friends | |
class | ReplicaManager2 |
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.
Definition at line 727 of file ReplicaManager2.h.
Connection_RM2::Connection_RM2 | ( | ) |
Definition at line 1753 of file ReplicaManager2.cpp.
Connection_RM2::~Connection_RM2 | ( | ) | [virtual] |
Definition at line 1758 of file ReplicaManager2.cpp.
void Connection_RM2::CalculateListExclusivity | ( | const DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > & | listOne, | |
const DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > & | listTwo, | |||
DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > & | exclusiveToListOne, | |||
DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > & | exclusiveToListTwo | |||
) | const [protected] |
Definition at line 1819 of file ReplicaManager2.cpp.
virtual Replica2* RakNet::Connection_RM2::Construct | ( | RakNet::BitStream * | replicaData, | |
SystemAddress | sender, | |||
SerializationType | type, | |||
ReplicaManager2 * | replicaManager, | |||
RakNetTime | timestamp, | |||
NetworkID | networkId, | |||
bool | networkIDCollision | |||
) | [pure virtual] |
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
[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. |
void Connection_RM2::Deref | ( | Replica2 * | replica | ) | [protected] |
Definition at line 2065 of file ReplicaManager2.cpp.
void Connection_RM2::DeserializeDownloadComplete | ( | RakNet::BitStream * | objectData, | |
SystemAddress | sender, | |||
ReplicaManager2 * | replicaManager, | |||
RakNetTime | timestamp, | |||
SerializationType | serializationType | |||
) | [virtual] |
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
[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 |
Definition at line 1918 of file ReplicaManager2.cpp.
void Connection_RM2::DeserializeDownloadStarted | ( | RakNet::BitStream * | objectData, | |
SystemAddress | sender, | |||
ReplicaManager2 * | replicaManager, | |||
RakNetTime | timestamp, | |||
SerializationType | serializationType | |||
) | [virtual] |
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()
[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 |
Definition at line 1910 of file ReplicaManager2.cpp.
RakNetGUID Connection_RM2::GetGuid | ( | void | ) | const |
Get the guid associated with this class instance.
Definition at line 2061 of file ReplicaManager2.cpp.
SystemAddress Connection_RM2::GetSystemAddress | ( | void | ) | const |
Get the system address associated with this class instance.
Definition at line 2053 of file ReplicaManager2.cpp.
Replica2 * Connection_RM2::ReceiveConstruct | ( | RakNet::BitStream * | replicaData, | |
NetworkID | networkId, | |||
SystemAddress | sender, | |||
unsigned char | localClientId, | |||
SerializationType | type, | |||
ReplicaManager2 * | replicaManager, | |||
RakNetTime | timestamp, | |||
DataStructures::OrderedList< SystemAddress, SystemAddress > & | exclusionList | |||
) | [protected, virtual] |
Definition at line 1925 of file ReplicaManager2.cpp.
void Connection_RM2::SerializeDownloadComplete | ( | RakNet::BitStream * | objectData, | |
ReplicaManager2 * | replicaManager, | |||
SerializationContext * | serializationContext | |||
) | [virtual] |
CALLBACK: Called after a download is sent to a new connection
[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 |
Definition at line 1905 of file ReplicaManager2.cpp.
void Connection_RM2::SerializeDownloadStarted | ( | RakNet::BitStream * | objectData, | |
ReplicaManager2 * | replicaManager, | |||
SerializationContext * | serializationContext | |||
) | [virtual] |
CALLBACK: Called before a download is sent to a new connection
[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 |
Definition at line 1900 of file ReplicaManager2.cpp.
void Connection_RM2::SetConstructionByList | ( | DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > & | currentVisibility, | |
ReplicaManager2 * | replicaManager | |||
) | [virtual] |
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
[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 |
Definition at line 1761 of file ReplicaManager2.cpp.
void Connection_RM2::SetConstructionByReplicaQuery | ( | ReplicaManager2 * | replicaManager | ) | [virtual] |
Go through all registered Replica2 objects that do not return BQR_ALWAYS from Replica2::QueryConstruction() For each of these objects that return BQR_YES, pass them to currentVisibility in SetConstructionByList() Automatically called every tick if ReplicaManager2::SetAutoUpdateScope with construction=true is called (which is the default)
[in] | replicaManager | Which replica manager to use to perform the send |
Definition at line 1861 of file ReplicaManager2.cpp.
void Connection_RM2::SetGuid | ( | RakNetGUID | guid | ) |
Set the guid to use with this class instance. This is set internally when the object is created.
Definition at line 2057 of file ReplicaManager2.cpp.
void Connection_RM2::SetSystemAddress | ( | SystemAddress | sa | ) |
Set the system address to use with this class instance. This is set internally when the object is created.
Definition at line 2049 of file ReplicaManager2.cpp.
void Connection_RM2::SetVisibilityByList | ( | DataStructures::OrderedList< Replica2 *, Replica2 *, ReplicaManager2::Replica2ObjectComp > & | currentVisibility, | |
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
[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 |
Definition at line 1790 of file ReplicaManager2.cpp.
void Connection_RM2::SetVisibilityByReplicaQuery | ( | ReplicaManager2 * | replicaManager | ) | [virtual] |
Go through all registered Replica2 objects that do not return BQR_ALWAYS from Replica2::QueryVisibility() For each of these objects that return BQR_YES, pass them to currentVisibility in SetVisibilityByList() Automatically called every tick if ReplicaManager2::SetAutoUpdateScope with construction=true is called (which is the default)
[in] | replicaManager | Which replica manager to use to perform the send |
Definition at line 1879 of file ReplicaManager2.cpp.
void Connection_RM2::SortInitialDownload | ( | const DataStructures::List< Replica2 * > & | orderedDownloadList, | |
DataStructures::List< Replica2 * > & | initialDownloadList | |||
) | [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
[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. |
Definition at line 1897 of file ReplicaManager2.cpp.
friend class ReplicaManager2 [friend] |
Definition at line 847 of file ReplicaManager2.h.
DataStructures::OrderedList<Replica2*, Replica2*, ReplicaManager2::Replica2ObjectComp> RakNet::Connection_RM2::lastConstructionList [protected] |
Definition at line 853 of file ReplicaManager2.h.
DataStructures::OrderedList<Replica2*, Replica2*, ReplicaManager2::Replica2ObjectComp> RakNet::Connection_RM2::lastSerializationList [protected] |
Definition at line 854 of file ReplicaManager2.h.
RakNetGUID RakNet::Connection_RM2::rakNetGuid [protected] |
Definition at line 851 of file ReplicaManager2.h.
SystemAddress RakNet::Connection_RM2::systemAddress [protected] |
Definition at line 850 of file ReplicaManager2.h.