Grail (C#)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.Core.AIManager Class Reference

Manages registered entities and shared blackboards. More...

Inheritance diagram for Grail.Core.AIManager:
Collaboration diagram for Grail.Core.AIManager:

Public Member Functions

 AIManager (int threadNumber=0)
 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 Dispose ()
 
void RegisterAIEntity (AIEntity entity, int priority)
 Manager registers entity with 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 RegisterEntityGroup (EntityGroup entityGroup, int priority)
 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 a given entity. More...
 
void RemoveEntityGroup (EntityGroup entityGroup)
 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...
 
void RemoveAIEntity (AIEntity entity)
 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...
 
Blackboard CreateBlackboard (string blackboardName)
 Constructs blackboard owned by this manager. More...
 
void SubscribeToBlackboard (string blackboardName, AIEntity entity)
 Subscribed given entity to blackboard identified by blackboard name and owned by this manager More...
 
void UpdateEntities (float deltaTime)
 Updates entities and their assigned behaviors. More...
 
void UpdateReasoners ()
 Lets registered entities think by updating their reasoners. More...
 
void RegisterEntityChangeObserver (IEntityChangeObserver observer)
 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)
 Removes an entity change observer so it no longer be notified on adding or removing an entity from the manager. More...
 
bool ContainsEntity (AIEntity entity)
 Checks if a given entity is registered in the manager. More...
 

Public Attributes

List<(AIEntity entity, int priority)> Entities => entities
 
Dictionary< string, BlackboardSharedBlackboards => sharedBlackboards
 

Properties

List< EntityGroupEntityGroups [get]
 

Detailed Description

Manages registered entities and shared blackboards.

Constructor & Destructor Documentation

◆ AIManager()

Grail.Core.AIManager.AIManager ( int  threadNumber = 0)
inline

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

Parameters
threadNumber

Member Function Documentation

◆ ContainsEntity()

bool Grail.Core.AIManager.ContainsEntity ( AIEntity  entity)
inline

Checks if a given entity is registered in the manager.

Parameters
entity
Returns
true if entity is registered in manager, false otherwise.

◆ CreateBlackboard()

Blackboard Grail.Core.AIManager.CreateBlackboard ( string  blackboardName)
inline

Constructs blackboard owned by this manager.

Parameters
blackboardName
Returns
constructed blackboard

◆ RegisterAIEntity()

void Grail.Core.AIManager.RegisterAIEntity ( AIEntity  entity,
int  priority 
)
inline

Manager registers entity with 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.

Parameters
entity
priority

◆ RegisterEntityChangeObserver()

void Grail.Core.AIManager.RegisterEntityChangeObserver ( IEntityChangeObserver  observer)
inline

Registers an entity change observer that will be notified via OnEntityAdded and OnEntityRemoved functions when an entity is added or removed from the manager.

Parameters
observer

◆ RegisterEntityGroup()

void Grail.Core.AIManager.RegisterEntityGroup ( EntityGroup  entityGroup,
int  priority 
)
inline

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 a given entity.

Parameters
entityGroup
priority

◆ RemoveAIEntity()

void Grail.Core.AIManager.RemoveAIEntity ( AIEntity  entity)
inline

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.

Parameters
entity

◆ RemoveEntityChangeObserver()

void Grail.Core.AIManager.RemoveEntityChangeObserver ( IEntityChangeObserver  observer)
inline

Removes an entity change observer so it no longer be notified on adding or removing an entity from the manager.

Parameters
observer

◆ RemoveEntityGroup()

void Grail.Core.AIManager.RemoveEntityGroup ( EntityGroup  entityGroup)
inline

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.

Parameters
entityGroup
priority

◆ SubscribeToBlackboard()

void Grail.Core.AIManager.SubscribeToBlackboard ( string  blackboardName,
AIEntity  entity 
)
inline

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

Parameters
blackboardName
entity

◆ UpdateEntities()

void Grail.Core.AIManager.UpdateEntities ( float  deltaTime)
inline

Updates entities and their assigned behaviors.

Parameters
deltaTime

◆ UpdateReasoners()

void Grail.Core.AIManager.UpdateReasoners ( )
inline

Lets registered entities think by updating their reasoners.


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