Interface used to interact with a game object
struct IGameObject : public IActionListener { public: class CRMIBody : public IRMIMessageBody; public: template <class T> class CRMIBodyImpl : public CRMIBody; public: enum EChangeExtension { eCE_Activate, eCE_Deactivate, eCE_Acquire, eCE_Release }; public: EntityId m_entityId; public: IMovementController * m_pMovementController; public: IEntity * m_pEntity; };
IGameObject.h
class CRMIBody : public IRMIMessageBody;
IGameObject.h
CRMIBody(const SGameObjectExtensionRMI * method, EntityId id, IRMIListener * pListener, int userId, EntityId dependentId);
template <class T> class CRMIBodyImpl : public CRMIBody;
IGameObject.h
static CRMIBodyImpl * Create(const SGameObjectExtensionRMI * method, EntityId id, const T& params, IRMIListener * pListener, int userId, EntityId dependentId);
void DeleteThis();
size_t GetSize();
void SerializeWith(TSerialize ser);
enum EChangeExtension { eCE_Activate, eCE_Deactivate, eCE_Acquire, eCE_Release };
IGameObject.h
EntityId m_entityId;
IEntity * m_pEntity;
IMovementController * m_pMovementController;
IGameObjectExtension * AcquireExtension(const char * extension);
forcefully get a pointer to an extension (may instantiate if needed)
bool ActivateExtension(const char * extension);
turn an extension on
virtual void AttachDistanceChecker() = 0;
virtual bool BindToNetwork(EBindToNetworkMode mode = eBTNM_Normal) = 0;
bind this entity to the network system (it gets synchronized then...)
virtual bool BindToNetworkWithParent(EBindToNetworkMode mode, EntityId parentId) = 0;
bind this entity to the network system, with a dependency on it's parent
virtual bool CaptureActions(IActionListener * pAL) = 0;
virtual bool CaptureProfileManager(IGameObjectProfileManager * pPH) = 0;
virtual bool CaptureView(IGameObjectView * pGOV) = 0;
for extensions to register for special things
virtual void ChangedNetworkState(NetworkAspectType aspects) = 0;
flag that we have changed the state of the game object aspect
void DeactivateExtension(const char * extension);
turn an extension off
virtual void DisablePostUpdates(IGameObjectExtension * pExtension) = 0;
virtual void DisableUpdateSlot(IGameObjectExtension * pExtension, int slot) = 0;
virtual void DontSyncPhysics() = 0;
A one off call to never enable the physics aspect, this needs to be done *before* the BindToNetwork (typically in the GameObject's Init function)
virtual void EnableAspect(NetworkAspectType aspects, bool enable) = 0;
enable/disable network aspects on game object
virtual void EnableDelegatableAspect(NetworkAspectType aspects, bool enable) = 0;
enable/disable delegatable aspects
virtual void EnablePhysicsEvent(bool enable, int events) = 0;
enable/disable sending physics events to this game object
virtual void EnablePostUpdates(IGameObjectExtension * pExtension) = 0;
virtual void EnablePrePhysicsUpdate(EPrePhysicsUpdate updateRule) = 0;
virtual void EnableUpdateSlot(IGameObjectExtension * pExtension, int slot) = 0;
virtual void ForceUpdate(bool force) = 0;
force the object to update even if extensions' slots are "sleeping"...
virtual void ForceUpdateExtension(IGameObjectExtension * pGOE, int slot) = 0;
virtual void FullSerialize(TSerialize ser) = 0;
serialize some aspects of the game object
virtual uint8 GetAspectProfile(EEntityAspects aspect) = 0;
virtual uint16 GetChannelId() const = 0;
get/set network channel
IEntity * GetEntity() const;
retrieve the hosting entity
EntityId GetEntityId() const;
virtual bool GetExtensionParams(const char * extension, SmartScriptTable params) = 0;
get extension parameters
virtual IGameObjectExtension * GetExtensionWithRMIBase(const void * pBase) = 0;
virtual void GetMemoryUsage(ICrySizer * pSizer) const;
virtual IMovementController * GetMovementController();
virtual INetChannel * GetNetChannel() const = 0;
virtual int GetPredictionHandle() = 0;
virtual uint8 GetUpdateSlotEnables(IGameObjectExtension * pExtension, int slot) = 0;
virtual IWorldQuery* GetWorldQuery() = 0;
IGameObject();
template <class MI, class T> void InvokeRMI(const MI method, const T& params, unsigned where, int channel = -1);
template <class MI, class T> void InvokeRMI_Primitive(const MI method, const T& params, unsigned where, IRMIListener * pListener, int userId, int channel, EntityId dependentId);
template <class MI, class T> void InvokeRMIWithDependentObject(const MI method, const T& params, unsigned where, EntityId ent, int channel = -1);
WARNING: there *MUST* be at least one frame between spawning ent and using this function to send an RMI if that RMI is _FAST, otherwise the dependent entity is ignored
virtual bool IsJustExchanging() = 0;
virtual bool IsProbablyDistant() = 0;
virtual bool IsProbablyVisible() = 0;
is the game object probably visible?
virtual bool NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags) = 0;
virtual void PostSerialize() = 0;
in case things have to be set after serialization
virtual void PostUpdate(float frameTime) = 0;
virtual void Pulse(uint32 pulse) = 0;
virtual IGameObjectExtension * QueryExtension(const char * name) const = 0;
query extension. returns 0 if extension is not there.
virtual void RegisterAsPredicted() = 0;
virtual void RegisterAsValidated(IGameObject* pGO, int predictionHandle) = 0;
virtual void RegisterExtForEvents(IGameObjectExtension* piExtention, const int* pEvents, const int numEvents) = 0;
virtual void ReleaseActions(IActionListener * pAL) = 0;
void ReleaseExtension(const char * extension);
release a previously acquired extension
virtual void ReleaseProfileManager(IGameObjectProfileManager * pPH) = 0;
virtual void ReleaseView(IGameObjectView * pGOV) = 0;
virtual void RequestRemoteUpdate(NetworkAspectType aspectMask) = 0;
register a partial update in the netcode without actually serializing - useful only for working around other bugs
virtual void SendEvent(const SGameObjectEvent&) = 0;
send a game object event
virtual bool SetAIActivation(EGameObjectAIActivationMode mode) = 0;
enable/disable AI activation flag
virtual bool SetAspectProfile(EEntityAspects aspect, uint8 profile, bool fromNetwork = false) = 0;
change the profile of an aspect
virtual void SetAutoDisablePhysicsMode(EAutoDisablePhysicsMode mode) = 0;
enable/disable auto-disabling of physics
virtual void SetChannelId(uint16) = 0;
virtual bool SetExtensionParams(const char * extension, SmartScriptTable params) = 0;
set extension parameters
void SetMovementController(IMovementController * pMC);
virtual void SetNetworkParent(EntityId id) = 0;
virtual void SetUpdateSlotEnableCondition(IGameObjectExtension * pExtension, int slot, EUpdateEnableCondition condition) = 0;
virtual bool ShouldUpdate() = 0;
for debugging updates
virtual void UnRegisterExtForEvents(IGameObjectExtension* piExtention, const int* pEvents, const int numEvents) = 0;
virtual bool WantsPhysicsEvent(int events) = 0;