INetContext

#include

Public Member Functions

virtual void DeleteContext ()=0
Releases this context.
virtual void ActivateDemoRecorder (const char *filename)=0
Records this context as a demo file.
virtual INetChannel * GetDemoRecorderChannel () const =0
Returs demo recorder channel.
virtual void ActivateDemoPlayback (const char *filename, INetChannel *pClient, INetChannel *pServer)=0
Records this context as a demo file.
virtual bool IsDemoPlayback () const =0
Are we playing back a demo session?
virtual bool IsDemoRecording () const =0
Are we recording a demo session?
virtual void LogRMI (const char *function, ISerializable *pParams)=0
If we're recording, log an RMI call to a file.
virtual void LogCppRMI (EntityId id, IRMICppLogger *pLogger)=0
Logs a custom (C++ based) RMI call to the demo file.
virtual void EnableBackgroundPassthrough (bool enable)=0
Enables on a server to lower pass-through message latency.
virtual void DeclareAspect (const char *name, NetworkAspectType aspectBit, uint8 aspectFlags)=0
virtual void SetAspectChannelMask (NetworkAspectType aspectBit, ChannelMaskType mask)=0
virtual ChannelMaskType GetAspectChannelMask (NetworkAspectID aspectID)=0
virtual void SetAspectProfile (EntityId id, NetworkAspectType aspectBit, uint8 profile)=0
virtual uint8 GetAspectProfile (EntityId id, NetworkAspectType aspectBit)=0
Fetches the profile on an aspect; this is a very heavyweight method as it must completely flush the state of network queues before operating.
virtual void BindObject (EntityId id, EntityId parentId, NetworkAspectType aspectBits, bool bStatic)=0
virtual void SetDelegatableMask (EntityId id, NetworkAspectType delegateMask)=0
The below can be used per object to prevent delegatable aspects from being delegated.
virtual void SafelyUnbind (EntityId id)=0
virtual bool IsBound (EntityId id)=0
Removes the binding of an object to the network.
virtual void SpawnedObject (EntityId id)=0
Must be called ONCE in response to a message sent from a SendSpawnObject call on the server (from the client).
virtual bool UnbindObject (EntityId id)=0
Determines if an object is bound or not.
virtual EntityId RemoveReservedUnboundEntityMapEntry (uint16 partialNetID)=0
virtual void EnableAspects (EntityId id, NetworkAspectType aspectBits, bool enabled)=0
virtual void ChangedAspects (EntityId id, NetworkAspectType aspectBits)=0
virtual void DelegateAuthority (EntityId id, INetChannel *pControlling)=0
virtual bool ChangeContext ()=0
virtual void EstablishedContext (int establishToken)=0
virtual void RemoveRMIListener (IRMIListener *pListener)=0
Removing an RMI listener – make sure there's no pointers left to it.
virtual bool RemoteContextHasAuthority (INetChannel *pChannel, EntityId id)=0
Determines if the context on the remote end of a channel has authority over an object.
virtual void SetParentObject (EntityId objId, EntityId parentId)=0
virtual void RequestRemoteUpdate (EntityId id, NetworkAspectType aspects)=0
virtual void LogBreak (const SNetBreakDescription &des)=0
Add a break event to the log of breaks for this context.
virtual bool SetSchedulingParams (EntityId objId, uint32 normal, uint32 owned)=0
virtual void PulseObject (EntityId objId, uint32 pulseType)=0
Add a priority pulse to an object (the shape of the pulse is described in the scheduling group in game/scripts/network/scheduler.
virtual int RegisterPredictedSpawn (INetChannel *pChannel, EntityId id)=0
virtual void RegisterValidatedPredictedSpawn (INetChannel *pChannel, int predictionHandle, EntityId id)=0
virtual void GetMemoryStatistics (ICrySizer *pSizer)=0
virtual void RegisterServerControlledFile (const char *filename)=0
register a file that should be server controlled
virtual ICryPak * GetServerControlledICryPak ()=0
get an ICryPak interface for server controlled files
virtual XmlNodeRef GetServerControlledXml (const char *filename)=0
Read XML out of a synced file.
virtual SNetObjectID GetNetID (EntityId userID, bool ensureNotUnbinding=true)=0
convert EntityId to netId and vice versa
virtual EntityId GetEntityID (SNetObjectID netID)=0
virtual void Resaltify (SNetObjectID &id)=0
virtual NetworkAspectType ServerControllerOnlyAspects () const =0
Get a mask of all aspects declared with the eAF_ServerControllerOnly flag.
virtual NetworkAspectType DelegatableAspects () const =0
Get a mask of all aspects declared with the eAF_Delegatable flag.
virtual IVoiceContext * GetVoiceContext ()=0

Detailed Description

An INetContext manages the list of objects synchronized over the network.

Note
Only to be implemented in CryNetwork.

Member Function Documentation

◆ BindObject()

virtual void INetContext::BindObject ( EntityId id,
EntityId parentId,
NetworkAspectType aspectBits,
bool bStatic
)
pure virtual

Binds an object to the network so it starts synchronizing its state.

Parameters
idA user supplied id for this object (probably the entity id :)).
parentIdA user supplied id for this object's parent (0 = no parent).
aspectBitsA bit mask specifying which aspects are enabled now.

◆ ChangeContext()

virtual bool INetContext::ChangeContext ( )
pure virtual

Changes the game context.

Note
Destroy all objects, and cause all channels to load a new level, and reinitialize state.

◆ ChangedAspects()

virtual void INetContext::ChangedAspects ( EntityId id,
NetworkAspectType aspectBits
)
pure virtual

Some aspects of an object have been changed - and those aspects should be updated shortly.

Parameters
idID of the object changed.
aspectBitsBit field describing which aspects have been changed.
Note
This is the only way to get eAF_UpdateOccasionally aspects updated.

◆ DeclareAspect()

virtual void INetContext::DeclareAspect ( const char * name,
NetworkAspectType aspectBit,
uint8 aspectFlags
)
pure virtual

Calls just after construction to declare which aspect bits have which characteristics.

Parameters
aspectBitBit we are changing (1,2,4,8,16,32,64 or 128).
aspectFlagsSome combination of eAF_* that describes how this parameter will change.
basePriorityase priority for this aspect.

◆ DelegateAuthority()

virtual void INetContext::DelegateAuthority ( EntityId id,
INetChannel * pControlling
)
pure virtual

Passes authority for updating an object to some remote channel. This channel must have had SetServer() called on it at construction time.

Parameters
idThe id of a bound object to change authority for.
pControllingChannel who will now control the object (or NULL if we wish to take control).
Note
Only those aspects marked as eAF_Delegatable are passed on.
#include 
#include 

// Example for how authority / control of an entity can be delegated to a specific client channel
// Note that INetEntity::EnableDelegatableAspect has to have been called during entity spawning for aspects we want to handle on the client
void DelegateAuthorityToClient(const EntityId controlledEntityId, const uint16 clientChannelId)
{
    INetChannel* pNetChannel = gEnv->pGameFramework->GetNetChannel(clientChannelId);
    gEnv->pGameFramework->GetNetContext()->DelegateAuthority(controlledEntityId, pNetChannel);
}

// Example for how authority / control of an entity can be delegated back to the server
void DelegateAuthorityToServer(const EntityId controlledEntityId)
{
    gEnv->pGameFramework->GetNetContext()->DelegateAuthority(controlledEntityId, nullptr);
}

◆ EnableAspects()

virtual void INetContext::EnableAspects ( EntityId id,
NetworkAspectType aspectBits,
bool enabled
)
pure virtual

Enables/disables the synchronization of some aspects over the network.

Parameters
idID of a bound object.
aspectBitsThe aspects to enable/disable.
enabledAre we enabling new aspects, or disabling old ones.

◆ EstablishedContext()

virtual void INetContext::EstablishedContext ( int establishToken)
pure virtual

The level has finished loading Example: The slow part of context establishment is complete.

Note
Call this after a call to IGameContext::EstablishContext.
See also
IGameContext::EstablishContext

◆ GetAspectChannelMask()

virtual ChannelMaskType INetContext::GetAspectChannelMask ( NetworkAspectID aspectID)
pure virtual

Returns the channel mask for this aspect

Parameters
aspectBitBit for which we are setting the mask.

◆ RemoveReservedUnboundEntityMapEntry()

virtual EntityId INetContext::RemoveReservedUnboundEntityMapEntry ( uint16 partialNetID)
pure virtual

Retrieve a reserved EntityId for previous known netID that had no entity bound to it.

Parameters
partialNetIDID portion of a known SNetObjectID, without the salt.

◆ SetAspectChannelMask()

virtual void INetContext::SetAspectChannelMask ( NetworkAspectType aspectBit,
ChannelMaskType mask
)
pure virtual

Sets the channel mask for this aspect (aspectchannelmask & channelmask must be non 0 for send to occur)

Parameters
aspectBitBit for which we are setting the mask.
maskChannel mask.

◆ SetAspectProfile()

virtual void INetContext::SetAspectProfile ( EntityId id,
NetworkAspectType aspectBit,
uint8 profile
)
pure virtual

Modifies the profile of an aspect.

Parameters
aspectBitThe aspect we are changing.
profileThe new profile of the aspect.

◆ SetParentObject()

virtual void INetContext::SetParentObject ( EntityId objId,
EntityId parentId
)
pure virtual

Specifies an objects 'network parent'. Child objects are unspawned after the parent object is. Child objects are spawned after the parent object is.

◆ SetSchedulingParams()

virtual bool INetContext::SetSchedulingParams ( EntityId objId,
uint32 normal,
uint32 owned
)
pure virtual

Set scheduling parameters for an object.

Parameters
normal4cc game/scripts/network/scheduler.xml.
owned4cc from game/scripts/network/scheduler.xml.