|
| Connection (Context *context, bool isClient, const SLNet::AddressOrGUID &address, SLNet::RakPeerInterface *peer) |
| Construct with context, RakNet connection address and Raknet peer pointer.
|
|
| ~Connection () override |
| Destruct.
|
|
void | SendMessage (int msgID, bool reliable, bool inOrder, const VectorBuffer &msg, unsigned contentID=0) |
| Send a message.
|
|
void | SendMessage (int msgID, bool reliable, bool inOrder, const unsigned char *data, unsigned numBytes, unsigned contentID=0) |
| Send a message.
|
|
void | SendRemoteEvent (StringHash eventType, bool inOrder, const VariantMap &eventData=Variant::emptyVariantMap) |
| Send a remote event.
|
|
void | SendRemoteEvent (Node *node, StringHash eventType, bool inOrder, const VariantMap &eventData=Variant::emptyVariantMap) |
| Send a remote event with the specified node as sender.
|
|
void | SetScene (Scene *newScene) |
| Assign scene. On the server, this will cause the client to load it.
|
|
void | SetIdentity (const VariantMap &identity) |
| Assign identity. Called by Network.
|
|
void | SetControls (const Controls &newControls) |
| Set new controls.
|
|
void | SetPosition (const Vector3 &position) |
| Set the observer position for interest management, to be sent to the server.
|
|
void | SetRotation (const Quaternion &rotation) |
| Set the observer rotation for interest management, to be sent to the server. Note: not used by the NetworkPriority component.
|
|
void | SetConnectPending (bool connectPending) |
| Set the connection pending status. Called by Network.
|
|
void | SetLogStatistics (bool enable) |
| Set whether to log data in/out statistics.
|
|
void | Disconnect (int waitMSec=0) |
| Disconnect. If wait time is non-zero, will block while waiting for disconnect to finish.
|
|
void | SendServerUpdate () |
| Send scene update messages. Called by Network.
|
|
void | SendClientUpdate () |
| Send latest controls from the client. Called by Network.
|
|
void | SendRemoteEvents () |
| Send queued remote events. Called by Network.
|
|
void | SendPackages () |
| Send package files to client. Called by network.
|
|
void | ProcessPendingLatestData () |
| Process pending latest data for nodes and components.
|
|
bool | ProcessMessage (int msgID, MemoryBuffer &msg) |
| Process a message from the server or client. Called by Network.
|
|
void | Ban () |
| Ban this connections IP address.
|
|
const SLNet::AddressOrGUID & | GetAddressOrGUID () const |
| Return the RakNet address/guid.
|
|
void | SetAddressOrGUID (const SLNet::AddressOrGUID &addr) |
| Set the the RakNet address/guid.
|
|
VariantMap & | GetIdentity () |
| Return client identity.
|
|
Scene * | GetScene () const |
| Return the scene used by this connection.
|
|
const Controls & | GetControls () const |
| Return the client controls of this connection.
|
|
unsigned char | GetTimeStamp () const |
| Return the controls timestamp, sent from client to server along each control update.
|
|
const Vector3 & | GetPosition () const |
| Return the observer position sent by the client for interest management.
|
|
const Quaternion & | GetRotation () const |
| Return the observer rotation sent by the client for interest management.
|
|
bool | IsClient () const |
| Return whether is a client connection.
|
|
bool | IsConnected () const |
| Return whether is fully connected.
|
|
bool | IsConnectPending () const |
| Return whether connection is pending.
|
|
bool | IsSceneLoaded () const |
| Return whether the scene is loaded and ready to receive server updates.
|
|
bool | GetLogStatistics () const |
| Return whether to log data in/out statistics.
|
|
String | GetAddress () const |
| Return remote address.
|
|
unsigned short | GetPort () const |
| Return remote port.
|
|
float | GetRoundTripTime () const |
| Return the connection's round trip time in milliseconds.
|
|
unsigned | GetLastHeardTime () const |
| Return the time since last received data from the remote host in milliseconds.
|
|
float | GetBytesInPerSec () const |
| Return bytes received per second.
|
|
float | GetBytesOutPerSec () const |
| Return bytes sent per second.
|
|
int | GetPacketsInPerSec () const |
| Return packets received per second.
|
|
int | GetPacketsOutPerSec () const |
| Return packets sent per second.
|
|
String | ToString () const |
| Return an address:port string.
|
|
unsigned | GetNumDownloads () const |
| Return number of package downloads remaining.
|
|
const String & | GetDownloadName () const |
| Return name of current package download, or empty if no downloads.
|
|
float | GetDownloadProgress () const |
| Return progress of current package download, or 1.0 if no downloads.
|
|
void | SendPackageToClient (PackageFile *package) |
| Trigger client connection to download a package file from the server. Can be used to download additional resource packages when client is already joined in a scene. The package must have been added as a requirement to the scene the client is joined in, or else the eventual download will fail.
|
|
void | ConfigureNetworkSimulator (int latencyMs, float packetLoss) |
| Set network simulation parameters. Called by Network.
|
|
| Object (Context *context) |
| Construct.
|
|
| ~Object () override |
| Destruct. Clean up self from event sender & receiver structures.
|
|
virtual StringHash | GetType () const =0 |
| Return type hash.
|
|
virtual const String & | GetTypeName () const =0 |
| Return type name.
|
|
virtual const TypeInfo * | GetTypeInfo () const =0 |
| Return type info.
|
|
virtual void | OnEvent (Object *sender, StringHash eventType, VariantMap &eventData) |
| Handle event.
|
|
bool | IsInstanceOf (StringHash type) const |
| Check current instance is type of specified type.
|
|
bool | IsInstanceOf (const TypeInfo *typeInfo) const |
| Check current instance is type of specified type.
|
|
template<typename T > |
bool | IsInstanceOf () const |
| Check current instance is type of specified class.
|
|
template<typename T > |
T * | Cast () |
| Cast the object to specified most derived class.
|
|
template<typename T > |
const T * | Cast () const |
| Cast the object to specified most derived class.
|
|
void | SubscribeToEvent (StringHash eventType, EventHandler *handler) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEvent (Object *sender, StringHash eventType, EventHandler *handler) |
| Subscribe to a specific sender's event.
|
|
void | SubscribeToEvent (StringHash eventType, const std::function< void(StringHash, VariantMap &)> &function, void *userData=nullptr) |
| Subscribe to an event that can be sent by any sender.
|
|
void | SubscribeToEvent (Object *sender, StringHash eventType, const std::function< void(StringHash, VariantMap &)> &function, void *userData=nullptr) |
| Subscribe to a specific sender's event.
|
|
void | UnsubscribeFromEvent (StringHash eventType) |
| Unsubscribe from an event.
|
|
void | UnsubscribeFromEvent (Object *sender, StringHash eventType) |
| Unsubscribe from a specific sender's event.
|
|
void | UnsubscribeFromEvents (Object *sender) |
| Unsubscribe from a specific sender's events.
|
|
void | UnsubscribeFromAllEvents () |
| Unsubscribe from all events.
|
|
void | UnsubscribeFromAllEventsExcept (const PODVector< StringHash > &exceptions, bool onlyUserData) |
| Unsubscribe from all events except those listed, and optionally only those with userdata (script registered events.)
|
|
void | SendEvent (StringHash eventType) |
| Send event to all subscribers.
|
|
void | SendEvent (StringHash eventType, VariantMap &eventData) |
| Send event with parameters to all subscribers.
|
|
VariantMap & | GetEventDataMap () const |
| Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
|
|
template<typename... Args> |
void | SendEvent (StringHash eventType, Args... args) |
| Send event with variadic parameter pairs to all subscribers. The parameter pairs is a list of paramID and paramValue separated by comma, one pair after another.
|
|
Context * | GetContext () const |
| Return execution context.
|
|
const Variant & | GetGlobalVar (StringHash key) const |
| Return global variable based on key.
|
|
const VariantMap & | GetGlobalVars () const |
| Return all global variables.
|
|
void | SetGlobalVar (StringHash key, const Variant &value) |
| Set global variable with the respective key and value.
|
|
Object * | GetSubsystem (StringHash type) const |
| Return subsystem by type.
|
|
Object * | GetEventSender () const |
| Return active event sender. Null outside event handling.
|
|
EventHandler * | GetEventHandler () const |
| Return active event handler. Null outside event handling.
|
|
bool | HasSubscribedToEvent (StringHash eventType) const |
| Return whether has subscribed to an event without specific sender.
|
|
bool | HasSubscribedToEvent (Object *sender, StringHash eventType) const |
| Return whether has subscribed to a specific sender's event.
|
|
bool | HasEventHandlers () const |
| Return whether has subscribed to any event.
|
|
template<class T > |
T * | GetSubsystem () const |
| Template version of returning a subsystem.
|
|
const String & | GetCategory () const |
| Return object category. Categories are (optionally) registered along with the object factory. Return an empty string if the object category is not registered.
|
|
void | SetBlockEvents (bool block) |
| Block object from sending and receiving events.
|
|
bool | GetBlockEvents () const |
| Return sending and receiving events blocking status.
|
|
| RefCounted () |
| Construct. Allocate the reference count structure and set an initial self weak reference.
|
|
virtual | ~RefCounted () |
| Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
|
|
| RefCounted (const RefCounted &rhs)=delete |
| Prevent copy construction.
|
|
RefCounted & | operator= (const RefCounted &rhs)=delete |
| Prevent assignment.
|
|
void | AddRef () |
| Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
|
|
void | ReleaseRef () |
| Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
|
|
int | Refs () const |
| Return reference count.
|
|
int | WeakRefs () const |
| Return weak reference count.
|
|
RefCount * | RefCountPtr () |
| Return pointer to the reference count structure.
|
|
|
| DRY_OBJECT (Connection, Object) |
|
void | HandleAsyncLoadFinished (StringHash eventType, VariantMap &eventData) |
| Handle scene loaded event.
|
|
void | ProcessLoadScene (int msgID, MemoryBuffer &msg) |
| Process a LoadScene message from the server. Called by Network.
|
|
void | ProcessSceneChecksumError (int msgID, MemoryBuffer &msg) |
| Process a SceneChecksumError message from the server. Called by Network.
|
|
void | ProcessSceneUpdate (int msgID, MemoryBuffer &msg) |
| Process a scene update message from the server. Called by Network. More...
|
|
void | ProcessPackageDownload (int msgID, MemoryBuffer &msg) |
| Process package download related messages. Called by Network.
|
|
void | ProcessIdentity (int msgID, MemoryBuffer &msg) |
| Process an Identity message from the client. Called by Network.
|
|
void | ProcessControls (int msgID, MemoryBuffer &msg) |
| Process a Controls message from the client. Called by Network.
|
|
void | ProcessSceneLoaded (int msgID, MemoryBuffer &msg) |
| Process a SceneLoaded message from the client. Called by Network.
|
|
void | ProcessRemoteEvent (int msgID, MemoryBuffer &msg) |
| Process a remote event message from the client or server. Called by Network.
|
|
void | ProcessNode (unsigned nodeID) |
| Process a node for sending a network update. Recurses to process depended on node(s) first.
|
|
void | ProcessNewNode (Node *node) |
| Process a node that the client has not yet received.
|
|
void | ProcessExistingNode (Node *node, NodeReplicationState &nodeState) |
| Process a node that the client has already received. More...
|
|
void | ProcessPackageInfo (int msgID, MemoryBuffer &msg) |
| Process a SyncPackagesInfo message from server.
|
|
bool | RequestNeededPackages (unsigned numPackages, MemoryBuffer &msg) |
| Check a package list received from server and initiate package downloads as necessary. Return true on success, or false if failed to initialze downloads (cache dir not set)
|
|
void | RequestPackage (const String &name, unsigned fileSize, unsigned checksum) |
| Initiate a package download.
|
|
void | SendPackageError (const String &name) |
| Send an error reply for a package download.
|
|
void | OnSceneLoadFailed () |
| Handle scene load failure on the server or client.
|
|
void | OnPackageDownloadFailed (const String &name) |
| Handle a package download failure on the client.
|
|
void | OnPackagesReady () |
| Handle all packages loaded successfully. Also called directly on MSG_LOADSCENE if there are none.
|
|
Connection to a remote network host.