RakNet::Connection_RM3 Class Reference
[ReplicaManager3]

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

#include <ReplicaManager3.h>

List of all members.

Public Member Functions

virtual Replica3AllocReplica (RakNet::BitStream *allocationIdBitstream, ReplicaManager3 *replicaManager3)=0
 Class factory to create a Replica3 instance, given a user-defined identifier.
virtual void GetConstructedReplicas (DataStructures::Multilist< ML_STACK, Replica3 * > &objectsTheyDoHave)
 Get list of all replicas that are constructed for this connection.
bool HasReplicaConstructed (RakNet::Replica3 *replica)
virtual void SerializeOnDownloadStarted (RakNet::BitStream *bitStream)
virtual void DeserializeOnDownloadStarted (RakNet::BitStream *bitStream)
virtual void SerializeOnDownloadComplete (RakNet::BitStream *bitStream)
virtual void DeserializeOnDownloadComplete (RakNet::BitStream *bitStream)
virtual
SendSerializeIfChangedResult 
SendSerialize (RakNet::Replica3 *replica, bool indicesToSend[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], RakNet::BitStream serializationData[RM3_NUM_OUTPUT_BITSTREAM_CHANNELS], RakNetTime timestamp, PRO sendParameters, RakPeerInterface *rakPeer, unsigned char worldId)
 Sends over a serialization update for replica.
NetworkID::GetNetworkID() is written automatically, serializationData is the object data.
This is used internally - however, you can also call it manually to send a data update for a remote replica.
.
SystemAddress GetSystemAddress (void) const
RakNetGUID GetRakNetGUID (void) const
virtual void SendConstruction (DataStructures::Multilist< ML_STACK, LastSerializationResult *, Replica3 * > &newObjects, DataStructures::Multilist< ML_STACK, LastSerializationResult *, Replica3 * > &deletedObjects, PRO sendParameters, RakPeerInterface *rakPeer, unsigned char worldId)
 Destroy objects that no longer exist. Create objects that now exist. objectsThatExist is the entire list of objects that should exist. Given a list of objects, compare it against constructedReplicas. Objects in objectsThatExist, that are not in constructedReplicas, and that pass Replica3::QueryConstruction() be constructed. Objects not in objectsThatExist, that are in constructedReplicas, and that pass Replica3::SerializeDestruction() be destroyed. This can be more efficient than ReplicaManager3::SetAutoConstructByQuery.


Detailed Description

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


Member Function Documentation

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.
See Replica3::Dealloc for the corresponding destruction message.
Return 0 if unable to create the intended object.

See also:
Replica3::WriteAllocationID(). Sample implementation:
{RakNet::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

virtual void RakNet::Connection_RM3::DeserializeOnDownloadComplete ( RakNet::BitStream bitStream  )  [inline, virtual]

Receives whatever was written in DeserializeOnDownloadComplete()

Parameters:
[in] bitStream Written in SerializeOnDownloadComplete()

virtual void RakNet::Connection_RM3::DeserializeOnDownloadStarted ( RakNet::BitStream bitStream  )  [inline, virtual]

Receives whatever was written in SerializeOnDownloadStarted()

Parameters:
[in] bitStream Written in SerializeOnDownloadStarted()

virtual void RakNet::Connection_RM3::GetConstructedReplicas ( DataStructures::Multilist< ML_STACK, 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.

RakNetGUID RakNet::Connection_RM3::GetRakNetGUID ( void   )  const [inline]

Returns:
Returns the RakNetGUID passed to the constructor of this object

SystemAddress RakNet::Connection_RM3::GetSystemAddress ( void   )  const [inline]

Returns:
The system address passed to the constructor of this object

bool RakNet::Connection_RM3::HasReplicaConstructed ( RakNet::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

virtual void RakNet::Connection_RM3::SendConstruction ( DataStructures::Multilist< ML_STACK, LastSerializationResult *, Replica3 * > &  newObjects,
DataStructures::Multilist< ML_STACK, LastSerializationResult *, Replica3 * > &  deletedObjects,
PRO  sendParameters,
RakPeerInterface rakPeer,
unsigned char  worldId 
) [virtual]

Destroy objects that no longer exist. Create objects that now exist. objectsThatExist is the entire list of objects that should exist. Given a list of objects, compare it against constructedReplicas. Objects in objectsThatExist, that are not in constructedReplicas, and that pass Replica3::QueryConstruction() be constructed. Objects not in objectsThatExist, that are in constructedReplicas, and that pass Replica3::SerializeDestruction() be destroyed. This can be more efficient than ReplicaManager3::SetAutoConstructByQuery.

Note:
Connection_RM3::SetConstructionByList and ReplicaManager3::SetAutoConstructByQuery are mutually exclusive. Do not use both at the same time.

Does NOT check QueryConstruction(). It is assumed that the objectsThatExist list itself determines construction or destruction.

Parameters:
[in] objectsThatExist Objects to check against
[in] replicaManager ReplicaManager3 instance this connection is using

virtual SendSerializeIfChangedResult RakNet::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,
RakPeerInterface rakPeer,
unsigned char  worldId 
) [virtual]

Sends over a serialization update for replica.
NetworkID::GetNetworkID() is written automatically, serializationData is the object data.
This is used internally - however, you can also call it manually to send a data update for a remote replica.
.

Parameters:
[in] replica Which replica to serialize
[in] serializationData Serialized object data
[in] timestamp 0 means no timestamp. Otherwise message is prepended with ID_TIMESTAMP
[in] sendParameters Parameters on how to send
[in] rakPeer Instance of RakPeerInterface to send on
[in] worldId Which world, see ReplicaManager3::SetWorldID()

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

Parameters:
[out] bitStream Passed to DeserializeOnDownloadComplete()

virtual void RakNet::Connection_RM3::SerializeOnDownloadStarted ( RakNet::BitStream bitStream  )  [inline, virtual]

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

Parameters:
[out] bitStream Passed to DeserializeOnDownloadStarted()


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

Generated on Fri Nov 20 11:34:14 2009 for RakNet by  doxygen 1.5.7.1