CEL

Public API Reference

iELCM Struct Reference

The Entity Life Cycle Manager. More...

#include <tools/elcm.h>

Inheritance diagram for iELCM:

List of all members.

Public Member Functions

virtual void ActivateEntity (iCelEntity *entity)=0
 Manually activate an entity.
virtual void AddELCMListener (iELCMListener *listener)=0
 Register a listener that wants to know when it is safe to remove entities.
virtual void DeactivateEntity (iCelEntity *entity)=0
 Manually deactivate an entity.
virtual void DeleteAll ()=0
 Delete everything (useful to start over).
virtual void Dump ()=0
 For debugging: dump information about the ELCM status.
virtual const csSet< uint > & GetDeletedEntities () const =0
 Return the set of entities that existed before the baseline and were deleted afterwards.
virtual csPtr< iCelEntityIteratorGetModifiedEntities () const =0
 Return an iterator for all active and inactive entities that have some modifications since the baseline.
virtual const csSet< csPtrKey
< iCelEntity > > & 
GetNewEntities () const =0
 Return the set of entities that didn't exist before the baseline and were created afterwards.
virtual void MarkBaseline ()=0
 Mark the baseline.
virtual void RegisterDeletedEntity (uint id)=0
 Register an ID as being from a deleted entity.
virtual void RegisterNewEntity (iCelEntity *ent)=0
 Register an entity as being new after the baseline.
virtual void RemoveELCMListener (iELCMListener *listener)=0
 Remove a listener.
virtual void SetActivityRadius (float radius)=0
 Set the activity radius.
virtual void SetCheckTime (csTicks t)=0
 Set the frequency with which the ELCM will recheck if it needs to recalculate the set of active entities.
virtual void SetDistanceThresshold (float distance)=0
 Set the distance thresshold before we recalculate the set of active entities.
virtual void SetPlayer (iCelEntity *entity)=0
 Register the player entity.
virtual void SetUnloadCheckFrequency (int c)=0
 Set the frequency at which the ELCM will check if there are entities that are ready for removal (from Inactive to Unloaded state).
virtual void SetUnloadedTime (csTicks t)=0
 Set the time (in ticks) after which the ELCM will consider an inactive entity to be ready for removal.
virtual void UnregisterDeletedEntity (uint id)=0
 Unregister an ID as being from a deleted entity.
virtual void UnregisterNewEntity (iCelEntity *ent)=0
 Unregister an entity as being new after the baseline.

Detailed Description

The Entity Life Cycle Manager.

This plugin is responsible for maintaining the life cycle of every entity.

Definitions:

ELCM maintains a specific state for every entity:

ELCM also maintains which entities have been changed since a specific snapshot time. This can be used to generate differential save games. It also keeps track of which entities (present at snapshot time) were deleted later.

Note: global entities (entities with no position) will never be set to inactive automatically but have to be activated and inactivated manually (if needed).

Definition at line 80 of file elcm.h.


Member Function Documentation

virtual void iELCM::ActivateEntity ( iCelEntity entity  )  [pure virtual]

Manually activate an entity.

This is mostly useful for a global entity which has recently been inactivated.

virtual void iELCM::AddELCMListener ( iELCMListener listener  )  [pure virtual]

Register a listener that wants to know when it is safe to remove entities.

virtual void iELCM::DeactivateEntity ( iCelEntity entity  )  [pure virtual]

Manually deactivate an entity.

This is mostly useful for deactivating global entities.

virtual void iELCM::DeleteAll (  )  [pure virtual]

Delete everything (useful to start over).

virtual void iELCM::Dump (  )  [pure virtual]

For debugging: dump information about the ELCM status.

virtual const csSet<uint>& iELCM::GetDeletedEntities (  )  const [pure virtual]

Return the set of entities that existed before the baseline and were deleted afterwards.

virtual csPtr<iCelEntityIterator> iELCM::GetModifiedEntities (  )  const [pure virtual]

Return an iterator for all active and inactive entities that have some modifications since the baseline.

virtual const csSet<csPtrKey<iCelEntity> >& iELCM::GetNewEntities (  )  const [pure virtual]

Return the set of entities that didn't exist before the baseline and were created afterwards.

virtual void iELCM::MarkBaseline (  )  [pure virtual]

Mark the baseline.

virtual void iELCM::RegisterDeletedEntity ( uint  id  )  [pure virtual]

Register an ID as being from a deleted entity.

virtual void iELCM::RegisterNewEntity ( iCelEntity ent  )  [pure virtual]

Register an entity as being new after the baseline.

virtual void iELCM::RemoveELCMListener ( iELCMListener listener  )  [pure virtual]

Remove a listener.

virtual void iELCM::SetActivityRadius ( float  radius  )  [pure virtual]

Set the activity radius.

This is the area around the player where entities are considered to be 'active'. The default activity radius is 500 units.

virtual void iELCM::SetCheckTime ( csTicks  t  )  [pure virtual]

Set the frequency with which the ELCM will recheck if it needs to recalculate the set of active entities.

Default is 100ms.

virtual void iELCM::SetDistanceThresshold ( float  distance  )  [pure virtual]

Set the distance thresshold before we recalculate the set of active entities.

Default is 20.

virtual void iELCM::SetPlayer ( iCelEntity entity  )  [pure virtual]

Register the player entity.

The ELCM will use this entity to find out where the player is (and thus to calculate the set of active entities).

virtual void iELCM::SetUnloadCheckFrequency ( int  c  )  [pure virtual]

Set the frequency at which the ELCM will check if there are entities that are ready for removal (from Inactive to Unloaded state).

This number is associated with the check time (see SetCheckTime()). The default is 10 which means that every 10 checks for activity there will be a check on unloaded entities.

virtual void iELCM::SetUnloadedTime ( csTicks  t  )  [pure virtual]

Set the time (in ticks) after which the ELCM will consider an inactive entity to be ready for removal.

Default is 10000 (10 seconds).

virtual void iELCM::UnregisterDeletedEntity ( uint  id  )  [pure virtual]

Unregister an ID as being from a deleted entity.

This is mainly needed if we know we're not deleting an entity for real but just clearing it for memory savings.

virtual void iELCM::UnregisterNewEntity ( iCelEntity ent  )  [pure virtual]

Unregister an entity as being new after the baseline.

This is needed in case the entity creator knows that this entity is actually part of the baseline but wasn't yet created at that point because of delayed entity-creation. Normally the ELCM will automatically put new entities in the set of new entities after the baseline so you will have to undo this here.


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

Generated for CEL: Crystal Entity Layer 2.1 by doxygen 1.6.1