AI Manager

AI manager is Grail’s command center. Manager takes care of registered entities and shared blackboards. Also, it’s resposible for threading.

Public Interface


Constructs AI manager. During construction, AI manager spawns worker threads, whose number is determined by a constructor argument. Those threads work on updating reasoners of registered entities. If the user passes 0 as the constructor argument, all updates will execute on the main thread.

Create Blackboard

Creates a shared blackboard identified by the given name.

Register AI Entity

Registers an entity with a given priority. After registration, AI Manager is be able to update the entity’s state. Entities will lower priority values are be updated first.

Remove AI Entity

Queues an entity to be unregistered from the manager. All queued entities are removed by the end of the next update.

Subscribe To Blackboard

Subscribes the given entity to a shared blackboard owned by this manager and identified by a name.

Update Entities

Updates all registerd entities. More specifically, this methods causes updates of behaviors assigned to those entities.

Update Reasoners

Allows worker threads (or main thread, depending on configuration) to update reasoners connected to registered entities. Basically, calling this method allows entities to think.

API Reference