Enfusion Script API
Loading...
Searching...
No Matches
Replication Interface Reference

Main replication API. More...

Static Public Member Functions

static RplId FindId (Managed item)
 
static proto RplId FindItemId (Managed item)
 Looks for item ID assigned by the Replication to given item.
 
static proto Managed FindItem (RplId itemId)
 Looks for item using provided item ID.
 
static proto RplNode FindNode (RplId itemId)
 Looks for node among whose items is one identified by provided item ID.
 
static proto RplIdentity FindOwner (RplId itemId)
 Tries to look for the owner of provided item ID.
 
static proto bool IsRunning ()
 Tells whenever the replication is active.
 
static proto bool Runtime ()
 The replication is currently in runtime mode.
 
static proto bool Loadtime ()
 The replication is currently in state of world loading.
 
static proto void BumpMe ()
 Notifies replication systems about changes in your object and queues him for replication in near future.
 
static proto void SetNumVirtualConnections (int num)
 Sets the number of virtual connections which are just generating load for the master.
 
static proto bool IsServer ()
 
static proto bool IsClient ()
 
static proto ref RplConnectionStats GetConnectionStats (RplIdentity identity)
 Retrieve snapshot of connection statistics for given identity at current moment in time.
 

Static Public Attributes

const RplId INVALID_ID = 0xFFFFFFFF
 
const RplIdentity INVALID_IDENTITY = 0xFFFFFFFF
 

Detailed Description

Main replication API.

Member Function Documentation

◆ BumpMe()

static proto void Replication.BumpMe ( )
static

Notifies replication systems about changes in your object and queues him for replication in near future.

◆ FindId()

static RplId Replication.FindId ( Managed item)
static

◆ FindItem()

static proto Managed Replication.FindItem ( RplId itemId)
static

Looks for item using provided item ID.

Returns
Item or null when item with provided item ID does not exist or cannot be used in script.

◆ FindItemId()

static proto RplId Replication.FindItemId ( Managed item)
static

Looks for item ID assigned by the Replication to given item.

Warning
This function performs lookup! Don't use in tight loops!
Returns
Item ID or RplId.Invalid() if given item is not inserted in Replication.

◆ FindNode()

static proto RplNode Replication.FindNode ( RplId itemId)
static

Looks for node among whose items is one identified by provided item ID.

Returns
Node or null when item with provided item ID does not exist.

◆ FindOwner()

static proto RplIdentity Replication.FindOwner ( RplId itemId)
static

Tries to look for the owner of provided item ID.

Returns
Identity of owner, or RplIdentity.Invalid() when current owner cannot be identified through RplIdentity (eg. because this instance does not have connection to them).

◆ GetConnectionStats()

static proto ref RplConnectionStats Replication.GetConnectionStats ( RplIdentity identity)
static

Retrieve snapshot of connection statistics for given identity at current moment in time.

This snapshot is not updated over time. To always get up-to-date statistics, call this function repeatedly. Rate of updates of internal statistics is not well defined, but it can be expected to happen about once every two seconds (usually more often). Note that only server is able to access connection information of all clients connected to it.

When identity is identifier of a real connection (such as from client to server), these will be statistics for that connection.

When identity is RplIdentity.Local(), returned statistics are for local player. Local player on server does not suffer from any connection quality issues and statistics will report perfect values (such as zero round-trip time). Local player on client reports statistics from its real connection to the server (as if identity was identifier of that connection).

When identity is RplIdentity.Invalid() or it refers to non-existent connection, null is returned.

Parameters
[in]identityIdentifier of queried connection.
Returns
Statistics of a given connection, or null when identity is wrong.

◆ IsClient()

static proto bool Replication.IsClient ( )
static
Warning
Using the hardcoded IsClient will result in code thats not modular and won't adapt when running in different environment consider using the replication roles and ownership instead.

◆ IsRunning()

static proto bool Replication.IsRunning ( )
static

Tells whenever the replication is active.

◆ IsServer()

static proto bool Replication.IsServer ( )
static
Warning
Using the hardcoded IsServer will result in code thats not modular and won't adapt when running in different environment consider using the replication roles and ownership instead.

◆ Loadtime()

static proto bool Replication.Loadtime ( )
static

The replication is currently in state of world loading.

The inserted nodes will receive a loadtime IDs and have to be spawned/present on both (Server and Client).

◆ Runtime()

static proto bool Replication.Runtime ( )
static

The replication is currently in runtime mode.

The inserted nodes will receive a runtime IDs they will be automatically replicated to relevant clients.

◆ SetNumVirtualConnections()

static proto void Replication.SetNumVirtualConnections ( int num)
static

Sets the number of virtual connections which are just generating load for the master.

Warning
INTERNAL PROFILING FEATURE ONLY!

Member Data Documentation

◆ INVALID_ID

const RplId Replication.INVALID_ID = 0xFFFFFFFF
static

◆ INVALID_IDENTITY

const RplIdentity Replication.INVALID_IDENTITY = 0xFFFFFFFF
static
Deprecated
Use RplIdentity.Invalid() instead.

The documentation for this interface was generated from the following file: