![]()  | 
  
    Grail (C++)
    1.4.0
    
   A multi-platform, modular, universal engine for embedding advanced AI in games. 
   | 
 
#include <DomainTranslator.hh>

Public Member Functions | |
| DomainTranslator (bool isDomainReusable=true) | |
| DomainTranslator (const DomainTranslator &)=default | |
| DomainTranslator (DomainTranslator &&)=default | |
| DomainTranslator & | operator= (const DomainTranslator &)=default | 
| DomainTranslator & | operator= (DomainTranslator &&)=default | 
| std::unique_ptr< WorldState > | GetWorldState (AIEntity &entity, const class Goal &goal, MemoryPool *memory) | 
| const ObjectIndexBinding & | GetObjectIndexBinding () const | 
| virtual Plan | TranslatePlan (const AIEntity &entity, const Planner::AbstractPlan &plan, const Goal &goal) const =0 | 
| void | ResetMemoryPool (MemoryPool &memory) | 
| ResetMemoryPool - Resets memory pool's memory cell pointer. If domain is reusable, memory will be reset to a memory cell right after the domain data.  More... | |
Protected Member Functions | |
| virtual std::vector< IPlannerObject * > | GeneratePlannerObjects (AIEntity &entity, const Goal &goal, MemoryPool *memory)=0 | 
| virtual std::vector< WorldObjectType > | CreateObjectTypes (const AIEntity &entity, const Goal &goal, MemoryPool *memory)=0 | 
| virtual void | AddActionTemplates (const AIEntity &entity, const std::shared_ptr< Domain > &domain, const Goal &goal)=0 | 
| virtual void | SetWorldStateParameters (const AIEntity &entity, WorldState &state, const Goal &goal) const | 
Protected Attributes | |
| ObjectIndexBinding | binding {} | 
An abstract class to implement translating from in-game world state to plan-space world state and from abstract plan to behavior sequence. It serves as a translation layer between the planning AI and the rest of the game.
| grail::planner::DomainTranslator::DomainTranslator | ( | bool | isDomainReusable = true | ) | 
Constructs a DomainTranslator using the specified MemoryPool.
| isDomainReusable | - if set to true, the planner will assume that the planning domain remains constant and can be reused, meaning that addActionTemplates and createObjectTypes will be invoked only once on DomainTranslator construction | 
      
  | 
  protectedpure virtual | 
Inside this method, action templates for all possible actions should be added to the Domain. Use Domain::addActionTemplate
      
  | 
  protectedpure virtual | 
      
  | 
  protectedpure virtual | 
This method should return a vector of IPlannerObject instances that correspond to in-game objects. An ObjectIndexBinding instance will be created from the returned objects.
| const ObjectIndexBinding & grail::planner::DomainTranslator::GetObjectIndexBinding | ( | ) | const | 
| std::unique_ptr< WorldState > grail::planner::DomainTranslator::GetWorldState | ( | AIEntity & | entity, | 
| const class Goal & | goal, | ||
| MemoryPool * | memory | ||
| ) | 
Creates a new world state for the planner based on the domain and the given arguments.
| entity | - the AI entity that uses planning. | 
| goal | - the goal for the PlannerReasoner. | 
| memory | - memory pool object to be used. | 
| void grail::planner::DomainTranslator::ResetMemoryPool | ( | MemoryPool & | memory | ) | 
ResetMemoryPool - Resets memory pool's memory cell pointer. If domain is reusable, memory will be reset to a memory cell right after the domain data.
| memory | - memory pool being resetted | 
      
  | 
  protectedvirtual | 
Inside this method, initial abstract WorldState parameters should be set. Use state.setParameter
      
  | 
  pure virtual | 
/return A Behavior-based plan to apply in the game based on the plan constructed in the abstract planning space. Keep in mind that a single Action does not have to correspond to a single Behavior - your plan translation logic can be arbitrary.
| entity | - the "AIEntity" object that utilizes planning for behavior selection. | 
| plan | - the abstract plan (from the planning space) | 
| goal | - the goal for which the plan was constructed. |