struct IAISystem { enum EGroupFlags { GROUP_ALL = 0x01, GROUP_ENABLED = 0x02, GROUP_MAX = 0x04 }; enum ENavigationType { NAV_UNSET = 1<<0, NAV_TRIANGULAR = 1<<1, NAV_WAYPOINT_HUMAN = 1<<2, NAV_WAYPOINT_3DSURFACE = 1<<3, NAV_FLIGHT = 1<<4, NAV_VOLUME = 1<<5, NAV_ROAD = 1<<6, NAV_SMARTOBJECT = 1<<7, NAV_FREE_2D = 1<<8, NAV_CUSTOM_NAVIGATION = 1<<9, NAV_MAX_VALUE = NAV_CUSTOM_NAVIGATION }; enum { NAV_TYPE_COUNT = 10 }; enum { NAVMASK_SURFACE = NAV_TRIANGULAR|NAV_WAYPOINT_HUMAN|NAV_ROAD|NAV_SMARTOBJECT, NAVMASK_AIR = NAV_FLIGHT|NAV_VOLUME|NAV_SMARTOBJECT, NAVMASK_ALL = NAV_TRIANGULAR|NAV_WAYPOINT_HUMAN|NAV_WAYPOINT_3DSURFACE|NAV_ROAD|NAV_FLIGHT|NAV_VOLUME|NAV_SMARTOBJECT|NAV_FREE_2D|NAV_CUSTOM_NAVIGATION }; enum EResetReason { RESET_INTERNAL, RESET_ENTER_GAME, RESET_EXIT_GAME, RESET_INTERNAL_LOAD, RESET_LOAD_LEVEL, RESET_UNLOAD_LEVEL }; class NavCapMask; struct SBuildingInfo { EWaypointConnections waypointConnections; float fNodeAutoConnectDistance; }; };
IAISystem.h
Interface to AI system. Defines functions to control the ai system.
enum EGroupFlags { GROUP_ALL = 0x01, GROUP_ENABLED = 0x02, GROUP_MAX = 0x04 };
IAISystem.h
Members |
Description |
GROUP_ALL = 0x01 |
Returns all agents in the group (default). |
GROUP_ENABLED = 0x02 |
Returns only the count of enabled agents (exclusive with all). |
GROUP_MAX = 0x04 |
Returns the maximum number of agents during the game (can be combined with all or enabled). |
Flags used by the GetGroupCount.
enum ENavigationType { NAV_UNSET = 1<<0, NAV_TRIANGULAR = 1<<1, NAV_WAYPOINT_HUMAN = 1<<2, NAV_WAYPOINT_3DSURFACE = 1<<3, NAV_FLIGHT = 1<<4, NAV_VOLUME = 1<<5, NAV_ROAD = 1<<6, NAV_SMARTOBJECT = 1<<7, NAV_FREE_2D = 1<<8, NAV_CUSTOM_NAVIGATION = 1<<9, NAV_MAX_VALUE = NAV_CUSTOM_NAVIGATION };
IAISystem.h
Indication of (a) what a graph node represents and (b) what kind of graph node an AI entity can navigate. In the latter case it can be used as a bit mask.
enum EResetReason { RESET_INTERNAL, RESET_ENTER_GAME, RESET_EXIT_GAME, RESET_INTERNAL_LOAD, RESET_LOAD_LEVEL, RESET_UNLOAD_LEVEL };
IAISystem.h
Members |
Description |
RESET_INTERNAL |
Called by the AI system itself |
RESET_INTERNAL_LOAD |
Called by the AI system itself |
class NavCapMask;
IAISystem.h
Bit mask using ENavigationType NOTE Aug 14, 2009:
NavCapMask & operator &=(unsigned rhs);
NavCapMask & operator |=(unsigned rhs);
unsigned GetFullMask() const;
NOTE Oct 21, 2009:
unsigned GetLnmCaps() const;
NavCapMask();
NavCapMask(unsigned caps);
void Serialize(TSerialize ser);
void SetLnmCaps(unsigned lnmData);
operator unsigned() const;
NOTE Oct 21, 2009:
struct SBuildingInfo { EWaypointConnections waypointConnections; float fNodeAutoConnectDistance; };
IAISystem.h
virtual ~IAISystem();
virtual void AddDebugLine(const Vec3& start, const Vec3& end, uint8 r, uint8 g, uint8 b, float time) = 0;
virtual void AddDebugSphere(const Vec3& pos, float radius, uint8 r, uint8 g, uint8 b, float time) = 0;
virtual void AddFrameTicks(uint64 nTicks) = 0;
Light frame profiler for AI support Add nTicks to the number of Ticks spend this frame in particle functions
virtual void AdjustDirectionalCoverPosition(Vec3& pos, const Vec3& dir, float agentRadius, float testHeight) = 0;
Returns a point which is a valid distance away from a wall in front of the point.
virtual int AllocGoalPipeId() const = 0;
Goal Pipes
get rid of this; => it too many confusing uses to remove just yet
virtual void AssignPFPropertiesToPathType(const string& sPathType, const AgentPathfindingProperties& properties) = 0;
Pathfinding properties
virtual bool CompleteInit() = 0;
virtual bool CreateNavigationShape(const SNavigationShapeParams & params) = 0;
Navigation / Pathfinding
virtual IAISignalExtraData* CreateSignalExtraData() const = 0;
virtual void DebugDraw() = 0;
debug members ============= DO NOT USE
virtual void DebugDrawFakeTracer(const Vec3& pos, const Vec3& dir) = 0;
Draws a fake tracer around the player.
virtual void DebugReportDeath(IAIObject* pVictim) = 0;
virtual void DeleteNavigationShape(const char * szPathName) = 0;
virtual void DisableGlobalPerceptionScaling() = 0;
virtual bool DoesNavigationShapeExists(const char * szName, EnumAreaType areaType, bool road = false) = 0;
virtual void DummyFunctionNumberOne() = 0;
Navigation / Pathfinding
virtual void DynOmniLightEvent(const Vec3& pos, float radius, EAILightEventType type, EntityId shooterId, float time = 5.0f) = 0;
virtual void DynSpotLightEvent(const Vec3& pos, const Vec3& dir, float radius, float fov, EAILightEventType type, EntityId shooterId, float time = 5.0f) = 0;
virtual void Enable(bool enable = true) = 0;
If disabled most things early out
virtual void EnableGenericShape(const char* shapeName, bool state) = 0;
virtual void EnumerateFormationNames(unsigned int maxNames, const char** names, unsigned int* nameCount) const = 0;
Leader/Formations
virtual void Error(const char * id, const char * format, ...);
virtual void Event(int eventT, const char *) = 0;
virtual void FlushSystem(bool bDeleteAll = false) = 0;
this called before loading (level load/serialization)
virtual void FlushSystemNavigation(bool bDeleteAll = false) = 0;
virtual void FreeSignalExtraData(IAISignalExtraData* pData) const = 0;
virtual IAIActorProxyFactory* GetActorProxyFactory() const = 0;
virtual IAIActionManager* GetAIActionManager() = 0;
AI Actions
virtual IAIDebugRenderer* GetAIDebugRenderer() = 0;
AI DebugDraw
virtual IAIGroupProxy* GetAIGroupProxy(int groupID) = 0;
virtual IAIDebugRenderer* GetAINetworkDebugRenderer() = 0;
virtual IAIObjectManager* GetAIObjectManager() = 0;
Get Subsystems
virtual int GetAITickCount() = 0;
profiling
virtual int GetAlertness() const = 0;
current global AI alertness value (what's the most alerted puppet)
virtual int GetAlertness(const IAIAlertnessPredicate& alertnessPredicate) = 0;
virtual IAIObject* GetBeacon(unsigned short nGroupID) = 0;
WTF are these?
virtual ICentralInterestManager* GetCentralInterestManager() = 0;
virtual IClusterDetector* GetClusterDetector() const = 0;
virtual ICommunicationManager* GetCommunicationManager() const = 0;
virtual ICoverSystem* GetCoverSystem() const = 0;
virtual unsigned int GetDangerSpots(const IAIObject* requester, float range, Vec3* positions, unsigned int* types, unsigned int n, unsigned int flags) = 0;
Fills the array with possible dangers, returns number of dangers.
virtual IFactionMap& GetFactionMap() = 0;
virtual float GetFrameStartTimeSecondsVirtual() const = 0;
!!! added to resolve merge conflict: to be removed in dev/c2 !!!
virtual float GetGlobalAudioScale(const IAIObject* pAIObject) const = 0;
virtual float GetGlobalVisualScale(const IAIObject* pAIObject) const = 0;
virtual int GetGroupCount(int nGroupID, int flags = GROUP_ALL, int type = 0) = 0;
virtual IAIObject* GetGroupMember(int groupID, int index, int flags = GROUP_ALL, int type = 0) = 0;
virtual IAIGroupProxyFactory* GetGroupProxyFactory() const = 0;
virtual unsigned int GetHideSpotsInRange(IAIObject* requester, const Vec3& reqPos, const Vec3& hideFrom, float minRange, float maxRange, bool collidableOnly, bool validatedOnly, unsigned int maxPts, Vec3* coverPos, Vec3* coverObjPos, Vec3* coverObjDir, float* coverRad, bool* coverCollidable) = 0;
Returns specified number of nearest hidespots. It considers the hidespots in graph and anchors. Any of the pointers to return values can be null. Returns number of hidespots found.
virtual IAIPathFinder * GetIAIPathFinder() = 0;
virtual IAIRecorder * GetIAIRecorder() = 0;
virtual BehaviorTree::IBehaviorTreeManager* GetIBehaviorTreeManager() const = 0;
virtual INavigation * GetINavigation() = 0;
virtual void GetMemoryStatistics(ICrySizer * pSizer) = 0;
virtual IMNMPathfinder* GetMNMPathfinder() const = 0;
virtual struct IMovementSystem* GetMovementSystem() const = 0;
virtual INavigationSystem* GetNavigationSystem() const = 0;
virtual string GetPathTypeNames() = 0;
virtual const AgentPathfindingProperties* GetPFPropertiesOfPathType(const string& sPathType) = 0;
virtual void GetRecorderDebugContext(SAIRecorderDebugContext* & pContext) = 0;
virtual ISelectionTreeManager* GetSelectionTreeManager() const = 0;
virtual AIActionSequence::ISequenceManager* GetSequenceManager() const = 0;
virtual ISmartObjectManager* GetSmartObjectManager() = 0;
virtual ITacticalPointSystem* GetTacticalPointSystem() = 0;
virtual ITargetTrackManager* GetTargetTrackManager() const = 0;
virtual bool GetUpdateAllAlways() const = 0;
Over-ride auto-disable for distant AIs
virtual float GetUpdateInterval() const = 0;
returns the basic AI system update interval
virtual IVisionMap* GetVisionMap() = 0;
IAISystem();
Basic
virtual void IgnoreStimulusFrom(EntityId sourceId, EAIStimulusType type, float time) = 0;
virtual bool Init() = 0;
virtual bool IsAIInDevMode() = 0;
virtual bool IsEnabled() const = 0;
virtual bool IsRecording(const IAIObject* pTarget, IAIRecordable::e_AIDbgEvent event) const = 0;
debug recorder
virtual void LayerEnabled(const char* layerName, bool enabled, bool serialized) = 0;
virtual void LoadCover(const char * szLevel, const char * szMission) = 0;
virtual void LoadLevelData(const char * szLevel, const char * szMission, const bool bRequiredQuickLoading = false) = 0;
virtual void LoadNavigationData(const char * szLevel, const char * szMission, const bool bRequiredQuickLoading = false, bool bAfterExporting = false) = 0;
virtual void LogComment(const char * id, const char * format, ...);
virtual void LogEvent(const char * id, const char * format, ...);
virtual void LogProgress(const char * id, const char * format, ...);
virtual void NotifyTargetDead(IAIObject* pDeadObject) = 0;
virtual uint64 NumFrameTicks() const = 0;
Get number of Ticks accumulated over this frame
virtual void OnMissionLoaded() = 0;
virtual bool ParseTables(int firstTable, bool parseMovementAbility, IFunctionHandler* pH, AIObjectParams& aiParams, bool& updateAlways) = 0;
virtual void ReadAreasFromFile(const char * fileNameAreas) = 0;
reads areas from file. clears the existing areas
virtual void Record(const IAIObject* pTarget, IAIRecordable::e_AIDbgEvent event, const char* pString) const = 0;
virtual void RegisterAIEventListener(IAIEventListener* pListener, const Vec3& pos, float rad, int flags) = 0;
Registers AI event listener. Only events overlapping the sphere will be sent. Register can be called again to update the listener position, radius and flags. If pointer to the listener is specified it will be used instead of the pointer to entity.
virtual void RegisterDamageRegion(const void * pID, const Sphere & sphere) = 0;
Register a spherical region that causes damage (so should be avoided in pathfinding). pID is just a unique identifying - so if this is called multiple times with the same pID then the damage region will simply be moved. If radius <= 0 then the region is disabled.
virtual void RegisterGlobalPerceptionListener(IAIGlobalPerceptionListener* pListner) = 0;
virtual bool RegisterListener(IAISystemListener* pListener) = 0;
virtual void RegisterStimulus(const SAIStimulus& stim) = 0;
virtual void Release() = 0;
virtual void Reload();
virtual void Reset(EResetReason reason) = 0;
virtual void ResetFrameTicks() = 0;
Reset Ticks Counter
virtual void SendAnonymousSignal(int nSignalId, const char * szText, const Vec3 & pos, float fRadius, IAIObject * pSenderObject, IAISignalExtraData* pData = NULL) = 0;
virtual void SendSignal(unsigned char cFilter, int nSignalId, const char * szText, IAIObject * pSenderObject, IAISignalExtraData* pData = NULL, uint32 crcCode = 0) = 0;
virtual void Serialize(TSerialize ser) = 0;
virtual void SerializeObjectIDs(TSerialize ser) = 0;
save/load
virtual void SetActorProxyFactory(IAIActorProxyFactory* pFactory) = 0;
virtual void SetAIDebugRenderer(IAIDebugRenderer* pAIDebugRenderer) = 0;
virtual void SetAINetworkDebugRenderer(IAIDebugRenderer* pAINetworkDebugRenderer) = 0;
virtual void SetAssesmentMultiplier(unsigned short type, float fMultiplier) = 0;
virtual void SetFactionThreatMultiplier(uint8 factionID, float fMultiplier) = 0;
virtual void SetGroupProxyFactory(IAIGroupProxyFactory* pFactory) = 0;
virtual void SetLevelPath(const char * sPath) = 0;
! Set a path for the current level as working folder for level-specific metadata
virtual void SetPerceptionDistLookUp(float* pLookUpTable, int tableSize) = 0;
look up table to be used when calculating visual time-out increment Global perception functionalities
virtual void UnregisterAIEventListener(IAIEventListener* pListener) = 0;
virtual void UnregisterGlobalPerceptionlistener(IAIGlobalPerceptionListener* pListner) = 0;
virtual bool UnregisterListener(IAISystemListener* pListener) = 0;
virtual void Update(CTimeValue currentTime, float frameTime) = 0;
Every frame (multiple time steps per frame possible?) //TODO find out currentTime - AI time since game start in seconds (GetCurrentTime) frameTime - since last update (GetFrameTime)
virtual void UpdateBeacon(unsigned short nGroupID, const Vec3 & vPos, IAIObject * pOwner = 0) = 0;
virtual void UpdateGlobalPerceptionScale(const float visualScale, const float audioScale, EAIFilterType filterTypeName = eAIFT_All, const char* factionName = NULL) = 0;
virtual void Warning(const char * id, const char * format, ...) const;
functions to let external systems (e.g. lua) access the AI logging functions. the external system should pass in an identifier (e.g. "
typedef NavCapMask tNavCapMask;