Grail (C++)
1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
The AIManager class - Manages registered entities and shared blackboards. More...
#include <AIManager.hh>
Public Member Functions | |
AIManager (std::size_t threadsNumber=0) | |
AIManager - Constructs a manager and spawns worker threads defined by the parameter. If threadsNumber equals 0, all calculations will be done on the 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 an entity with a given priority. As a result entities and their behaviors will be updated when UpdateEntities is called. Also entities will think when UpdateReasoners is called. Entities with lower priority will be updated first. More... | |
void | RemoveAIEntity (AIEntity *entity) |
RemoveAIEntity - Manager caches given entity. Later on all cached entities will be unregistered from this manager. Unregistered entities will no longer be updated, neither will be their behaviors and reasoners. More... | |
void | RegisterEntityGroup (const std::shared_ptr< EntityGroup > &entityGroup, int priority) |
RegisterEntityGroup - Manager registers an entity group (and its entities) with the given priority. As a result entities and their behaviors will be updated when UpdateEntities is called. Also entities will think when UpdateReasoners is called. Entities with lower priority will be updated first. Resulting priority of each entity in group is calculated by adding group priority and relative priority of given entity. More... | |
void | RemoveEntityGroup (const std::shared_ptr< EntityGroup > &entityGroup) |
RemoveEntityGroup - Manager removes entity group and caches its entities for removal. Later on all cached entities will be unregistered from this manager. Unregistered entities will no longer be updated, neither will be their behaviors and reasoners. More... | |
bool | ContainsEntity (const AIEntity &entity) const |
ContainsEntity - Checks if a given entity is registered in the manager. More... | |
Blackboard & | CreateBlackboard (const std::string &name) |
CreateBlackboard - Constructs blackboard owned by this manager. More... | |
void | SubscribeToBlackboard (const std::string &blackboardName, AIEntity &entity) |
SubscribeToBlackboard - Subscribes a given entity to a blackboard identified by the provided blackboard name and owned by this manager. More... | |
void | RegisterEntityChangeObserver (IEntityChangeObserver *observer) |
RegisterEntityChangeObserver - Registers an entity change observer that will be notified via OnEntityAdded and OnEntityRemoved functions when an entity is added or removed from the manager. More... | |
void | RemoveEntityChangeObserver (IEntityChangeObserver *observer) |
RemoveEntityChangeObserver - Removes an entity change observer so it no longer will be notified on adding or removing an entity from the manager. More... | |
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 |
The AIManager class - Manages registered entities and shared blackboards.
grail::AIManager::AIManager | ( | std::size_t | threadsNumber = 0 | ) |
AIManager - Constructs a manager and spawns worker threads defined by the parameter. If threadsNumber equals 0, all calculations will be done on the main thread.
threadsNumber |
bool grail::AIManager::ContainsEntity | ( | const AIEntity & | entity | ) | const |
ContainsEntity - Checks if a given entity is registered in the manager.
entity |
Blackboard & grail::AIManager::CreateBlackboard | ( | const std::string & | name | ) |
CreateBlackboard - Constructs blackboard owned by this manager.
name |
void grail::AIManager::RegisterAIEntity | ( | const std::shared_ptr< AIEntity > & | entity, |
int | priority | ||
) |
RegisterAIEntity - Manager registers an entity with a given priority. As a result entities and their behaviors will be updated when UpdateEntities is called. Also entities will think when UpdateReasoners is called. Entities with lower priority will be updated first.
entity | |
priority |
void grail::AIManager::RegisterEntityChangeObserver | ( | IEntityChangeObserver * | observer | ) |
RegisterEntityChangeObserver - Registers an entity change observer that will be notified via OnEntityAdded and OnEntityRemoved functions when an entity is added or removed from the manager.
observer |
void grail::AIManager::RegisterEntityGroup | ( | const std::shared_ptr< EntityGroup > & | entityGroup, |
int | priority | ||
) |
RegisterEntityGroup - Manager registers an entity group (and its entities) with the given priority. As a result entities and their behaviors will be updated when UpdateEntities is called. Also entities will think when UpdateReasoners is called. Entities with lower priority will be updated first. Resulting priority of each entity in group is calculated by adding group priority and relative priority of given entity.
entityGroup | |
priority |
void grail::AIManager::RemoveAIEntity | ( | AIEntity * | entity | ) |
RemoveAIEntity - Manager caches given entity. Later on all cached entities will be unregistered from this manager. Unregistered entities will no longer be updated, neither will be their behaviors and reasoners.
entity |
void grail::AIManager::RemoveEntityChangeObserver | ( | IEntityChangeObserver * | observer | ) |
RemoveEntityChangeObserver - Removes an entity change observer so it no longer will be notified on adding or removing an entity from the manager.
observer |
void grail::AIManager::RemoveEntityGroup | ( | const std::shared_ptr< EntityGroup > & | entityGroup | ) |
RemoveEntityGroup - Manager removes entity group and caches its entities for removal. Later on all cached entities will be unregistered from this manager. Unregistered entities will no longer be updated, neither will be their behaviors and reasoners.
entityGroup |
void grail::AIManager::SubscribeToBlackboard | ( | const std::string & | blackboardName, |
AIEntity & | entity | ||
) |
SubscribeToBlackboard - Subscribes a given entity to a blackboard identified by the provided blackboard name and owned by this manager.
blackboardName | |
entity |
void grail::AIManager::UpdateEntities | ( | float | deltaTime | ) |
UpdateEntities - Updates entities and their assigned behaviors.
deltaTime |