(C++)  1.0.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::AIManager Class Referencefinal

The AIManager class - Manages registered entities and shared blackboards. More...

#include <AIManager.hh>

Public Member Functions

 AIManager (std::size_t threadsNumber=0)
 AIManager - Constructs manager and spawns worker threads defined by parameter. If threadsNumber equals 0, all calculations will be done on main thread. More...
 
void UpdateReasoners ()
 UpdateReasoners - Lets registered entities think by updating their reasoner.
 
void UpdateEntities (float deltaTime)
 UpdateEntities - Updates entities and their assigned behaviors. More...
 
void RegisterAIEntity (const std::shared_ptr< AIEntity > &entity, int priority)
 RegisterAIEntity - Manager registers entity with given priority. More...
 
void RegisterAIEntity (const std::shared_ptr< AIEntity > &entity, const std::shared_ptr< AIEntity > &parent, int priorityOffset=1)
 RegisterAIEntity - Managers registers entity with priority worse by priorityOffset than in case of parent entity. More...
 
void RemoveAIEntity (const AIEntity *entity)
 RemoveAIEntity - Manager caches given entity. Later on all cached entities will be unregistered from this manager. More...
 
void RegisterEntityGroup (const std::shared_ptr< EntityGroup > &entityGroup, int priority)
 
void RemoveEntityGroup (const std::shared_ptr< EntityGroup > &entityGroup)
 
bool ContainsEntity (const AIEntity &entity) const
 
BlackboardCreateBlackboard (const std::string &name)
 CreateBlackboard - Constructs blackboard owned by this manager. More...
 
void SubscribeToBlackboard (const std::string &blackboardName, AIEntity &entity)
 SubscribeToBlackboard - Subscribed given entity to blackboard identified by blackboard name and owned by this manager. More...
 
void RegisterEntityChangeObserver (IEntityChangeObserver *observer)
 
void RemoveEntityChangeObserver (IEntityChangeObserver *observer)
 
const std::vector< std::pair< std::shared_ptr< AIEntity >, int > > & GetEntities () const
 
const std::vector< std::shared_ptr< EntityGroup > > & GetEntityGroups () const
 
const std::map< std::string, std::shared_ptr< Blackboard > > & GetSharedBlackboards () const
 

Detailed Description

The AIManager class - Manages registered entities and shared blackboards.

Constructor & Destructor Documentation

◆ AIManager()

grail::AIManager::AIManager ( std::size_t  threadsNumber = 0)

AIManager - Constructs manager and spawns worker threads defined by parameter. If threadsNumber equals 0, all calculations will be done on main thread.

Parameters
threadsNumber

Member Function Documentation

◆ CreateBlackboard()

Blackboard & grail::AIManager::CreateBlackboard ( const std::string &  name)

CreateBlackboard - Constructs blackboard owned by this manager.

Parameters
name
Returns
constructed blackboard

◆ RegisterAIEntity() [1/2]

void grail::AIManager::RegisterAIEntity ( const std::shared_ptr< AIEntity > &  entity,
const std::shared_ptr< AIEntity > &  parent,
int  priorityOffset = 1 
)

RegisterAIEntity - Managers registers entity with priority worse by priorityOffset than in case of parent entity.

Parameters
entity
parent
priorityOffset

◆ RegisterAIEntity() [2/2]

void grail::AIManager::RegisterAIEntity ( const std::shared_ptr< AIEntity > &  entity,
int  priority 
)

RegisterAIEntity - Manager registers entity with given priority.

Parameters
entity
priority

◆ RemoveAIEntity()

void grail::AIManager::RemoveAIEntity ( const AIEntity entity)

RemoveAIEntity - Manager caches given entity. Later on all cached entities will be unregistered from this manager.

Parameters
entity

◆ SubscribeToBlackboard()

void grail::AIManager::SubscribeToBlackboard ( const std::string &  blackboardName,
AIEntity entity 
)

SubscribeToBlackboard - Subscribed given entity to blackboard identified by blackboard name and owned by this manager.

Parameters
blackboardName
entity

◆ UpdateEntities()

void grail::AIManager::UpdateEntities ( float  deltaTime)

UpdateEntities - Updates entities and their assigned behaviors.

Parameters
deltaTime

The documentation for this class was generated from the following files: