#include <NetworkIDObject.h>
Public Member Functions | |
virtual void | SetNetworkIDManager (NetworkIDManager *manager) |
virtual NetworkIDManager * | GetNetworkIDManager (void) |
Returns what was passed to SetNetworkIDManager. | |
virtual NetworkID | GetNetworkID (void) |
virtual void | SetNetworkID (NetworkID id) |
Protected Attributes | |
NetworkID | networkID |
The network ID of this object. |
A class you can derive from to make it easier to represent every networked object with an integer. This way you can refer to objects over the network. One system should return true for IsNetworkIDAuthority() and the rest should return false. When an object needs to be created, have the the one system create the object. Then have that system send a message to all other systems, and include the value returned from GetNetworkID() in that packet. All other systems should then create the same class of object, and call SetNetworkID() on that class with the NetworkID in the packet.
virtual NetworkID RakNet::NetworkIDObject::GetNetworkID | ( | void | ) | [virtual] |
Returns the NetworkID that you can use to refer to this object over the network.
UNASSIGNED_NETWORK_ID | UNASSIGNED_NETWORK_ID is returned IsNetworkIDAuthority() is false and SetNetworkID() was not previously called. This is also returned if you call this function in the constructor. | |
0-65534 | Any other value is a valid NetworkID. NetworkIDs start at 0 and go to 65534, wrapping at that point. |
virtual void RakNet::NetworkIDObject::SetNetworkID | ( | NetworkID | id | ) | [virtual] |
Sets the NetworkID for this instance. Usually this is called by the clients and determined from the servers. However, if you save multiplayer games you would likely use This on load as well.
virtual void RakNet::NetworkIDObject::SetNetworkIDManager | ( | NetworkIDManager * | manager | ) | [virtual] |
Sets the manager class from which to request unique network IDs Unlike previous versions, the NetworkIDObject relies on a manager class to provide IDs, rather than using statics, So you can have more than one set of IDs on the same system.