ReplicaNet and RNLobby  1
Public Member Functions | List of all members
object Class Reference
Inheritance diagram for object:
Inheritance graph
[legend]
Collaboration diagram for object:
Collaboration graph
[legend]

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)
 

Detailed Description

The object class defines the object class framework to use. For example if a C++ class looks like this:

class ATestClass
{
ATestClass() {};
virtual ~ATestClass() {};
public:
int mObjectHealth; // This is going to be shared to all networked objects
};

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:

class ATestClass : _RO_DO_PUBLIC_RO(ATestClass)
{
...

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:

class ATestClass : public _RO_ATestClass
{
...

Note that the name used in the ROL file for the class has 'RO' added to the start of the name.

Member Function Documentation

AddHeaderInclude ( char *  includeFile)
Parameters
includeFilethe 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") Test
Adds 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.

Parameters
namethe 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.

Parameters
namethe 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.

Parameters
namethe 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.

Parameters
...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)
Parameters
includeFilethe 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") Test
Creates 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.

Parameters
enableset 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.

Parameters
defaultValuethe 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

Parameters
loadA "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.

Parameters
defaultLoadthe value that is the default value. The default is 0.0f to match the parameter to SetLoadScore()
SetOpaqueType ( char *  baseClassType)
Parameters
baseClassTypethe 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.

Parameters
distancethe 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.

Parameters
distancethe 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