ReplicaNet and RNLobby
1
|
Public Member Functions | |
datablock (name) | |
datablockcustom (name) | |
addinclude (name) | |
extern (...) | |
ApproveMigration () | |
ApproveFault () | |
Reliable () | |
Certain () | |
Ordered () | |
Unreliable () | |
SetDiscardOlder (int windowBits) | |
SetLoadBalancing (bool enable) | |
SetLoadBalancingDefault (bool defaultValue) | |
SetLoadScore (float load) | |
SetLoadScoreDefault (float defaultLoad) | |
SetPropagateToSessionDistance (float distance) | |
SetPropagateToSessionDistanceDefault (float distance) | |
RealInclude (char *includeFile) | |
AddHeaderInclude (char *includeFile) | |
SetOpaqueType (char *baseClassType) | |
The object class defines the object class framework to use. For example if a C++ class looks like this:
If the class member variable is to be shared over the network then create a file called _RO_ATestClass.rol containing similar to code this:
object ATestClass { datablock NData; networking { NData mObjectHealth; } }
Then you can compile this file with the RNROLCompiler. The generated C++ files should then be included in your project. The C++ class definition should be changed to look like this:
This is so your C++ class inherits from the generated RO class (Replicated Object) which is now aware of the network.
An alternative would be to not use the _RO_DO_PUBLIC_RO() macro and use this format instead:
Note that the name used in the ROL file for the class has 'RO' added to the start of the name.
AddHeaderInclude | ( | char * | includeFile | ) |
includeFile | the filename of the include file for a header file. This command is most useful as a pre-ctor stage command. For example in an ROL file: object > AddHeaderInclude("ATypeInclude.h") TestAdds the header file "ATypeInclude.h" to the header file of the compiled ROL output. |
addinclude | ( | name | ) |
This keyword add an include file to the ReplicaObject.
name | the name of the include file with or without path to add to the object. This then adds the include "xxxx" to the ReplicaObject derived class cpp file where xxxx is the name and optional path of the datablock used. |
ApproveFault | ( | ) |
Makes this object fault tolerant
ApproveMigration | ( | ) |
Makes this object approve migration requests
Certain | ( | ) |
Makes the object update use the certain method
datablock | ( | name | ) |
This keyword defines a datablock that is used in the object.
name | the name of the datablock used in this object. This then adds the include "RNReplicaNet/Inc/DataBlock_xxxx.h" to the ReplicaObject derived class cpp file where xxxx is the name of the datablock used. |
datablockcustom | ( | name | ) |
This keyword defines a custom datablock that is used in the object.
name | the name of the datablock used in this object. This then adds the include "DataBlock_xxxx.h" to the ReplicaObject derived class cpp file where xxxx is the name of the datablock used. |
extern | ( | ... | ) |
This keyword defined a function prototype used in the C++ class that you want to be able to call across the network.
... | The parameter prototype for a function used in a C++ class. For example you would use: // Define the function. extern AMemberFunction(int,float); ... Code ... // Then use the definition with the function DataBlock inside the networking block. networking { ... Code ... Function AMemberFunction { Reliable; } ... Code ... }Which would correspond to a function is a C++ class such as: void AMemberFunction(int aParameter,float anotherParameter);
|
Ordered | ( | ) |
Makes the object update use the unreliable ordered method
RealInclude | ( | char * | includeFile | ) |
includeFile | the filename of the include file for the real class. This command is most useful as a pre-ctor stage command. For example in an ROL file: object > RealInclude("RealTestObjectInclude.h") TestCreates an object from an object called Test but uses the file name given as the include file for the real class include. Usually the object name is used as a hint for the real object include name. |
Reliable | ( | ) |
Makes the object update use the reliable method
SetDiscardOlder | ( | int | windowBits | ) |
Instead of using the unreliable ordered packet sending type this enables automatic DataBlock checking of older updates. See ReplicaObject::SetDiscardOlder()
SetLoadBalancing | ( | bool | enable | ) |
Enables or disables load balancing for this ReplicaObject.
enable | set this to true to enable load balancing. The default is false |
SetLoadBalancingDefault | ( | bool | defaultValue | ) |
This sets the default value that the load balancing uses. Setting the default value in the object constructor to the same value that is set for the load balancing will result in a smaller data packet being sent.
defaultValue | the value that is the default value. The default is false to match the parameter to SetLoadBalancing() |
SetLoadScore | ( | float | load | ) |
Sets the object load unit score.. The definition of "load" units is left to the user. The default return value is 0.0f
load | A "load" score for this object. |
SetLoadScoreDefault | ( | float | defaultLoad | ) |
This sets the default value that the load balancing score uses. Setting the default value in the object constructor to the same value that is set for the load balancing will result in a smaller data packet being sent.
defaultLoad | the value that is the default value. The default is 0.0f to match the parameter to SetLoadScore() |
SetOpaqueType | ( | char * | baseClassType | ) |
baseClassType | the base class of the class object. Instead of using ReplicaObject::SetOpaquePointer() or overriding ReplicaObject::GetOpaquePointer() to pass back an opaque pointer, you can use this method in the ROL file. For example if your game class called MonsterObject inherits from a base class called BaseGameObject you could use SetOpaqueType(BaseGameObject). As long as the opaque pointer has not been set elsewhere in your code and the GetOpaquePointer() function has not been overridden then when you call ReplicaObject::GetOpaquePointer() the pointer returned will be a valid pointer for this class as if it had been cast to (BaseGameObject *). In effect it is the same as overriding ReplicaObject::GetOpaquePointer() to do { return (BaseGameObject*) ((MonsterObject*) this); }; |
SetPropagateToSessionDistance | ( | float | distance | ) |
This functions sets the distance that an object has to be within for it to be propagated relative to a session observer. If a session has an observer and the CalculateDistanceToObject() result is greater than the value specified then the session will not receive object updates. If a session has no registered observer then the object will always be propagated to that session. The default value for a ReplicaObject is to have this distance set to kReplicaObject_InfiniteDistance, which means that the object will always be propagated to a session. This function can only be used if the ReplicaObject is a master.
distance | the distance to set, kReplicaObject_InfiniteDistance is the default value |
SetPropagateToSessionDistanceDefault | ( | float | distance | ) |
This sets the default value that the propagate distance uses. Setting the default value in the object constructor to the same value that is set for the distance will result in a smaller data packet being sent when an object is published.
distance | the value that is the default value. The default is kReplicaObject_InfiniteDistance to match the parameter to SetPropagateToSessionDistance() |
Unreliable | ( | ) |
Makes the object update use the unreliable method