|
TNL::NetObject class Reference
TNL::NetObject Class Reference#include <tnlNetObject.h>
Inheritance diagram for TNL::NetObject:
|
Public Member Functions |
| NetObject () |
| ~NetObject () |
virtual bool | onGhostAdd (GhostConnection *theConnection) |
| onGhostAdd is called on the client side of a connection after the constructor and after the first call to unpackUpdate (the initial call).
|
virtual void | onGhostRemove () |
| onGhostRemove is called on the client side before the destructor when ghost has gone out of scope and is about to be deleted from the client.
|
virtual void | onGhostAvailable (GhostConnection *theConnection) |
| onGhostAvailable is called on the server side after the server knows that the ghost is available and addressable via the getGhostIndex().
|
void | setMaskBits (U32 orMask) |
| Notify the network system that one or more of this object's states have been changed.
|
void | clearMaskBits (U32 orMask) |
| Notify the network system that one or more of its states does not need to be updated.
|
virtual F32 | getUpdatePriority (NetObject *scopeObject, U32 updateMask, S32 updateSkips) |
| Called to determine the relative update priority of an object.
|
virtual U32 | packUpdate (GhostConnection *connection, U32 updateMask, BitStream *stream) |
| Write the object's state to a packet.
|
virtual void | unpackUpdate (GhostConnection *connection, BitStream *stream) |
| Unpack data written by packUpdate().
|
virtual void | performScopeQuery (GhostConnection *connection) |
| For a scope object, determine what is in scope.
|
U32 | getNetIndex () |
| getNetIndex returns the index tag used to identify the server copy of a client object.
|
bool | isGhost () const |
| isGhost returns true if this object is a ghost of a server object.
|
bool | isScopeLocal () const |
| isScopeLocal returns true if this object is scoped always to the local client.
|
bool | isGhostable () const |
| isGhostable returns true if this object can be ghosted to any clients.
|
U32 | getHashId () const |
| Return a hash for this object.
|
void | postRPCEvent (NetObjectRPCEvent *theEvent) |
| Internal method called by NetObject RPC events when they are packed.
|
Static Public Member Functions |
void | collapseDirtyList () |
| collapseDirtyList pushes all the mDirtyMaskBits down into the GhostInfo's for each object, and clears out the dirty list.
|
GhostConnection * | getRPCSourceConnection () |
| Returns the connection from which the current RPC method originated, or NULL if not currently within the processing of an RPC method call.
|
void | setRPCDestConnection (GhostConnection *destConnection) |
| Sets the connection to which all NetObject RPCs will be destined.
|
GhostConnection * | getRPCDestConnection () |
| Returns the connection that serves as the destination of NetObject RPC method calls.
|
Protected Types |
enum | NetFlag {
IsGhost = BIT(1),
ScopeLocal = BIT(2),
Ghostable = BIT(3),
MaxNetFlagBit = 15
} |
Protected Member Functions |
bool | isInitialUpdate () |
| Returns true if this pack/unpackUpdate is the initial one for the object.
|
Protected Attributes |
BitSet32 | mNetFlags |
| Flags field describing this object, from NetFlag.
|
Static Protected Attributes |
GhostConnection * | mRPCSourceConnection |
| RPC method source connection.
|
GhostConnection * | mRPCDestConnection |
| NetObject RPC method destination connection.
|
Private Types |
typedef Object | Parent |
Private Attributes |
NetObject * | mPrevDirtyList |
NetObject * | mNextDirtyList |
U32 | mDirtyMaskBits |
U32 | mNetIndex |
| The index of this ghost on the other side of the connection.
|
GhostInfo * | mFirstObjectRef |
| Head of the linked list of GhostInfos for this object.
|
SafePtr< NetObject > | mServerObject |
| Direct pointer to the parent object on the server if it is a local connection.
|
GhostConnection * | mOwningConnection |
| The connection that owns this ghost, if it's a ghost.
|
Static Private Attributes |
NetObject * | mDirtyList |
bool | mIsInitialUpdate |
| Managed by GhostConnection - set to true when this is an initial update.
|
Friends |
class | GhostConnection |
class | GhostAlwaysObjectEvent |
class | NetObjectRPCEvent |
Member Typedef Documentation
|
Reimplemented in TNLTest::Player, TNLTest::Building, Zap::CTFGameType, Zap::EngineeredObject, Zap::ForceFieldProjector, Zap::Turret, Zap::FlagItem, Zap::GameObject, Zap::GoalZone, Zap::HuntersGameType, Zap::HuntersFlagItem, Zap::HuntersNexusObject, Zap::PickupItem, Zap::GrenadeProjectile, Zap::Mine, Zap::RabbitGameType, Zap::Ship, Zap::SoccerGameType, and Zap::SoccerBallItem. |
Member Enumeration Documentation
|
- Enumeration values:
-
IsGhost |
Set if this is a ghost. |
ScopeLocal |
If set, this object ghosts only to the local client. |
Ghostable |
Set if this object can ghost at all. |
MaxNetFlagBit |
|
|
Constructor & Destructor Documentation
TNL::NetObject::NetObject |
( |
|
) |
|
|
Member Function Documentation
bool TNL::NetObject::isInitialUpdate |
( |
|
) |
[inline, protected] |
|
|
Returns true if this pack/unpackUpdate is the initial one for the object.
|
void TNL::NetObject::collapseDirtyList |
( |
|
) |
[static] |
|
|
collapseDirtyList pushes all the mDirtyMaskBits down into the GhostInfo's for each object, and clears out the dirty list.
|
GhostConnection* TNL::NetObject::getRPCSourceConnection |
( |
|
) |
[inline, static] |
|
|
Returns the connection from which the current RPC method originated, or NULL if not currently within the processing of an RPC method call.
|
void TNL::NetObject::setRPCDestConnection |
( |
GhostConnection * |
destConnection |
) |
[inline, static] |
|
|
Sets the connection to which all NetObject RPCs will be destined.
Calling this function with a NULL value will target NetObject RPCs to every connection for which that object is currently ghosted. |
|
Returns the connection that serves as the destination of NetObject RPC method calls.
|
virtual bool TNL::NetObject::onGhostAdd |
( |
GhostConnection * |
theConnection |
) |
[virtual] |
|
|
onGhostAdd is called on the client side of a connection after the constructor and after the first call to unpackUpdate (the initial call).
Returning true signifies no error - returning false causes the connection to abort.
Reimplemented in TNLTest::Player, TNLTest::Building, and Zap::GameObject. |
virtual void TNL::NetObject::onGhostRemove |
( |
|
) |
[virtual] |
|
|
onGhostRemove is called on the client side before the destructor when ghost has gone out of scope and is about to be deleted from the client.
Reimplemented in Zap::Ship. |
virtual void TNL::NetObject::onGhostAvailable |
( |
GhostConnection * |
theConnection |
) |
[virtual] |
|
void TNL::NetObject::setMaskBits |
( |
U32 |
orMask |
) |
|
|
|
Notify the network system that one or more of this object's states have been changed.
- Note:
- This is a server side call. It has no meaning for ghosts.
|
void TNL::NetObject::clearMaskBits |
( |
U32 |
orMask |
) |
|
|
|
Notify the network system that one or more of its states does not need to be updated.
- Note:
- This is a server side call. It has no meaning for ghosts.
|
virtual F32 TNL::NetObject::getUpdatePriority |
( |
NetObject * |
scopeObject, |
|
|
U32 |
updateMask, |
|
|
S32 |
updateSkips |
|
) |
[virtual] |
|
|
Called to determine the relative update priority of an object.
All objects that are in scope and that have out of date states are queried and sorted by priority before being updated. If there is not enough room in a single packet for all out of date objects, the skipped objects will have an incremented updateSkips the next time that connection prepares to send a packet. Typically the update priority is scaled by updateSkips so that as data becomes stale, it becomes more of a priority to update.
Reimplemented in Zap::GameObject. |
|
Write the object's state to a packet.
packUpdate is called on an object when it is to be written into a packet stream for transmission to the client. The updateMask parameter contains the out-of-date state mask for the object. The initial update mask for any object to a client will always be 0xFFFFFFFF, signifying that all states are out of date. It is often useful to check for this mask, to write one-time initialization information for that object.
Reimplemented in TNLTest::Player, TNLTest::Building, Zap::EngineeredObject, Zap::ForceField, Zap::Turret, Zap::FlagItem, Zap::GoalZone, Zap::HuntersFlagItem, Zap::HuntersNexusObject, Zap::Item, Zap::PickupItem, Zap::Projectile, Zap::GrenadeProjectile, Zap::Mine, Zap::Ship, and Zap::Teleporter. |
|
Unpack data written by packUpdate().
unpackUpdate is called on the client to read an update out of a packet's bit stream. Because the update mask is not encoded by the network system directly, each unpack update function will have to determine from the bit stream which states are being updated.
Reimplemented in TNLTest::Player, TNLTest::Building, Zap::EngineeredObject, Zap::ForceField, Zap::Turret, Zap::FlagItem, Zap::GoalZone, Zap::HuntersFlagItem, Zap::HuntersNexusObject, Zap::Item, Zap::PickupItem, Zap::Projectile, Zap::GrenadeProjectile, Zap::Mine, Zap::Ship, and Zap::Teleporter. |
virtual void TNL::NetObject::performScopeQuery |
( |
GhostConnection * |
connection |
) |
[virtual] |
|
|
For a scope object, determine what is in scope.
performScopeQuery is called on a NetConnection's scope object to determine which objects in the world are in scope for that connection.
Reimplemented in TNLTest::Player, and Zap::GameType. |
U32 TNL::NetObject::getNetIndex |
( |
|
) |
[inline] |
|
|
getNetIndex returns the index tag used to identify the server copy of a client object.
|
bool TNL::NetObject::isGhost |
( |
|
) |
const [inline] |
|
|
isGhost returns true if this object is a ghost of a server object.
|
bool TNL::NetObject::isScopeLocal |
( |
|
) |
const [inline] |
|
|
isScopeLocal returns true if this object is scoped always to the local client.
|
bool TNL::NetObject::isGhostable |
( |
|
) |
const [inline] |
|
|
isGhostable returns true if this object can be ghosted to any clients.
|
U32 TNL::NetObject::getHashId |
( |
|
) |
const [inline] |
|
|
Return a hash for this object.
- Note:
- This is based on its location in memory.
|
|
Internal method called by NetObject RPC events when they are packed.
|
Friends And Related Function Documentation
friend class GhostAlwaysObjectEvent [friend]
|
|
Field Documentation
|
The index of this ghost on the other side of the connection.
|
|
Head of the linked list of GhostInfos for this object.
Reimplemented from TNL::Object. |
|
Direct pointer to the parent object on the server if it is a local connection.
|
|
The connection that owns this ghost, if it's a ghost.
|
|
Flags field describing this object, from NetFlag.
|
|
RPC method source connection.
|
|