Each remote system is represented by Connection_RM3. Used to allocate Replica3 and track which instances have been allocated. More...
#include <ReplicaManager3.h>
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 356 of file ReplicaManager3.h.
List of enumerations for how to get the list of valid objects for other systems.
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 407 of file ReplicaManager3.h.
Connection_RM3::Connection_RM3 | ( | SystemAddress | _systemAddress, | |
RakNetGUID | _guid | |||
) |
Definition at line 1172 of file ReplicaManager3.cpp.
Connection_RM3::~Connection_RM3 | ( | ) | [virtual] |
virtual Replica3* RakNet::Connection_RM3::AllocReplica | ( | RakNet::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.
[in] | allocationIdBitstream | user-defined bitstream uniquely identifying a game object type |
[in] | replicaManager3 | Instance of ReplicaManager3 that controls this connection |
void Connection_RM3::AutoConstructByQuery | ( | ReplicaManager3 * | replicaManager3 | ) |
void RakNet::Connection_RM3::CullUniqueNewAndDeletedObjects | ( | DataStructures::Multilist< ML_STACK, Replica3 * > & | newObjectsIn, | |
DataStructures::Multilist< ML_STACK, Replica3 * > & | deletedObjectsIn, | |||
DataStructures::Multilist< ML_STACK, Replica3 * > & | newObjectsOut, | |||
DataStructures::Multilist< ML_STACK, Replica3 * > & | deletedObjectsOut | |||
) |
virtual void RakNet::Connection_RM3::DeserializeOnDownloadComplete | ( | RakNet::BitStream * | bitStream | ) | [inline, virtual] |
Receives whatever was written in DeserializeOnDownloadComplete()
[in] | bitStream | Written in SerializeOnDownloadComplete() |
Definition at line 398 of file ReplicaManager3.h.
virtual void RakNet::Connection_RM3::DeserializeOnDownloadStarted | ( | RakNet::BitStream * | bitStream | ) | [inline, virtual] |
Receives whatever was written in SerializeOnDownloadStarted()
[in] | bitStream | Written in SerializeOnDownloadStarted() |
Definition at line 390 of file ReplicaManager3.h.
void Connection_RM3::GetConstructedReplicas | ( | DataStructures::Multilist< ML_STACK, Replica3 * > & | objectsTheyDoHave | ) | [virtual] |
Get list of all replicas that are constructed for this connection.
[out] | objectsTheyDoHave | Destination list. Returned in sorted ascending order, sorted on the value of the Replica3 pointer. |
Definition at line 1189 of file ReplicaManager3.cpp.
RakNetGUID RakNet::Connection_RM3::GetRakNetGUID | ( | void | ) | const [inline] |
Definition at line 404 of file ReplicaManager3.h.
SystemAddress RakNet::Connection_RM3::GetSystemAddress | ( | void | ) | const [inline] |
Definition at line 401 of file ReplicaManager3.h.
bool Connection_RM3::HasReplicaConstructed | ( | RakNet::Replica3 * | replica | ) |
Returns true if we think this remote connection has this replica constructed
[in] | replica3 | Which replica we are querying |
Definition at line 1201 of file ReplicaManager3.cpp.
void Connection_RM3::OnConstructToThisConnection | ( | DataStructures::DefaultIndexType | queryToConstructIdx, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1554 of file ReplicaManager3.cpp.
void Connection_RM3::OnConstructToThisConnection | ( | Replica3 * | replica, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
void Connection_RM3::OnDereference | ( | Replica3 * | replica3, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1453 of file ReplicaManager3.cpp.
void Connection_RM3::OnDoNotQueryDestruction | ( | DataStructures::DefaultIndexType | queryToDestructIdx, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1657 of file ReplicaManager3.cpp.
void Connection_RM3::OnDownloadExisting | ( | Replica3 * | replica3, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1616 of file ReplicaManager3.cpp.
void Connection_RM3::OnDownloadFromOtherSystem | ( | Replica3 * | replica3, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
void Connection_RM3::OnDownloadFromThisSystem | ( | Replica3 * | replica3, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1506 of file ReplicaManager3.cpp.
void Connection_RM3::OnLocalReference | ( | Replica3 * | replica3, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1440 of file ReplicaManager3.cpp.
void Connection_RM3::OnNeverConstruct | ( | DataStructures::DefaultIndexType | queryToConstructIdx, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1540 of file ReplicaManager3.cpp.
void Connection_RM3::OnNeverSerialize | ( | DataStructures::DefaultIndexType | queryToSerializeIndex, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1588 of file ReplicaManager3.cpp.
void Connection_RM3::OnReplicaAlreadyExists | ( | DataStructures::DefaultIndexType | queryToConstructIdx, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1597 of file ReplicaManager3.cpp.
void Connection_RM3::OnSendDestructionFromQuery | ( | DataStructures::DefaultIndexType | queryToDestructIdx, | |
ReplicaManager3 * | replicaManager | |||
) | [protected] |
Definition at line 1640 of file ReplicaManager3.cpp.
virtual ConstructionMode RakNet::Connection_RM3::QueryConstructionMode | ( | void | ) | const [inline, virtual] |
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.
Definition at line 431 of file ReplicaManager3.h.
virtual void RakNet::Connection_RM3::QueryReplicaList | ( | DataStructures::Multilist< ML_STACK, Replica3 *, Replica3 * > | newReplicasToCreate, | |
DataStructures::Multilist< ML_STACK, Replica3 *, Replica3 * > | existingReplicasToDestroy | |||
) | [inline, virtual] |
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> The following code uses a sorted merge sort to quickly find new and deleted objects, given a list of objects we know should exist.
BR> DataStructures::Multilist<ML_STACK, Replica3*, Replica3*> objectsTheyShouldHave; // You have to fill in this list
DataStructures::Multilist<ML_STACK, Replica3*, Replica3*> objectsTheyCurrentlyHave,objectsTheyStillHave,existingReplicasToDestro,newReplicasToCreatey;
GetConstructedReplicas(objectsTheyCurrentlyHave);
DataStructures::Multilist::FindIntersection(objectsTheyCurrentlyHave, objectsTheyShouldHave, objectsTheyStillHave, existingReplicasToDestroy, newReplicasToCreate);
BR> See GridSectorizer in the Source directory as a method to find all objects within a certain radius in a fast way.
BR>
[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 448 of file ReplicaManager3.h.
void Connection_RM3::SendConstruction | ( | DataStructures::Multilist< ML_STACK, Replica3 *, Replica3 * > & | newObjects, | |
DataStructures::Multilist< ML_STACK, Replica3 *, Replica3 * > & | deletedObjects, | |||
PRO | sendParameters, | |||
RakPeerInterface * | rakPeer, | |||
unsigned char | worldId | |||
) | [virtual] |
Definition at line 1788 of file ReplicaManager3.cpp.
SendSerializeIfChangedResult Connection_RM3::SendSerialize | ( | RakNet::Replica3 * | replica, | |
bool | indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], | |||
RakNet::BitStream | serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], | |||
RakNetTime | timestamp, | |||
PRO | sendParameters[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], | |||
RakPeerInterface * | rakPeer, | |||
unsigned char | worldId | |||
) | [virtual] |
Definition at line 1221 of file ReplicaManager3.cpp.
void Connection_RM3::SendSerializeHeader | ( | RakNet::Replica3 * | replica, | |
RakNetTime | timestamp, | |||
RakNet::BitStream * | bs, | |||
unsigned char | worldId | |||
) | [protected] |
Definition at line 1207 of file ReplicaManager3.cpp.
SendSerializeIfChangedResult Connection_RM3::SendSerializeIfChanged | ( | DataStructures::DefaultIndexType | queryToSerializeIndex, | |
SerializeParameters * | sp, | |||
RakPeerInterface * | rakPeer, | |||
unsigned char | worldId, | |||
ReplicaManager3 * | replicaManager | |||
) | [virtual] |
Definition at line 1284 of file ReplicaManager3.cpp.
void Connection_RM3::SendValidation | ( | RakPeerInterface * | rakPeer, | |
unsigned char | worldId | |||
) |
Definition at line 1916 of file ReplicaManager3.cpp.
virtual void RakNet::Connection_RM3::SerializeOnDownloadComplete | ( | RakNet::BitStream * | bitStream | ) | [inline, virtual] |
When a new connection connects, after constructing and serialization all objects, SerializeOnDownloadComplete() is called
[out] | bitStream | Passed to DeserializeOnDownloadComplete() |
Definition at line 394 of file ReplicaManager3.h.
virtual void RakNet::Connection_RM3::SerializeOnDownloadStarted | ( | RakNet::BitStream * | bitStream | ) | [inline, virtual] |
When a new connection connects, before sending any objects, SerializeOnDownloadStarted() is called
[out] | bitStream | Passed to DeserializeOnDownloadStarted() |
Definition at line 386 of file ReplicaManager3.h.
void Connection_RM3::ValidateLists | ( | ReplicaManager3 * | replicaManager | ) | const [protected] |
friend class ReplicaManager3 [friend] |
Definition at line 586 of file ReplicaManager3.h.
DataStructures::Multilist<ML_ORDERED_LIST, LastSerializationResult*, Replica3*> RakNet::Connection_RM3::constructedReplicaList [protected] |
Definition at line 569 of file ReplicaManager3.h.
DataStructures::Multilist<ML_STACK, Replica3*, Replica3*> RakNet::Connection_RM3::constructedReplicasCulled [protected] |
Definition at line 584 of file ReplicaManager3.h.
DataStructures::Multilist<ML_STACK, Replica3*, Replica3*> RakNet::Connection_RM3::destroyedReplicasCulled [protected] |
Definition at line 584 of file ReplicaManager3.h.
RakNetGUID RakNet::Connection_RM3::guid [protected] |
Definition at line 504 of file ReplicaManager3.h.
Definition at line 499 of file ReplicaManager3.h.
Definition at line 497 of file ReplicaManager3.h.
DataStructures::Multilist<ML_STACK, LastSerializationResult*, Replica3*> RakNet::Connection_RM3::queryToConstructReplicaList [protected] |
Definition at line 574 of file ReplicaManager3.h.
DataStructures::Multilist<ML_STACK, LastSerializationResult*, Replica3*> RakNet::Connection_RM3::queryToDestructReplicaList [protected] |
Definition at line 581 of file ReplicaManager3.h.
DataStructures::Multilist<ML_STACK, LastSerializationResult*, Replica3*> RakNet::Connection_RM3::queryToSerializeReplicaList [protected] |
Definition at line 578 of file ReplicaManager3.h.
SystemAddress RakNet::Connection_RM3::systemAddress [protected] |
Definition at line 503 of file ReplicaManager3.h.