Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::planner::ActionTemplate Class Reference

#include <ActionTemplate.hh>

Public Member Functions

 ActionTemplate (const std::string &name, const std::vector< unsigned int > &actionParameterTypes, PreconditionFunction preconditionFunction, EffectFunction effectFunction, CostFunction costFunction)
 
 ActionTemplate (ActionTemplate &&other)=default
 
int GetTypeId () const
 
const std::string & GetName () const
 
std::vector< class ActionGenerateActions (const class WorldState &worldState) const
 

Friends

class Action
 

Detailed Description

A class representing a model (family) of an action that can be simulated by a planner. "Action" objects are produced based on the "ActionTemplate".

Constructor & Destructor Documentation

◆ ActionTemplate()

grail::planner::ActionTemplate::ActionTemplate ( const std::string &  name,
const std::vector< unsigned int > &  actionParameterTypes,
PreconditionFunction  preconditionFunction,
EffectFunction  effectFunction,
CostFunction  costFunction 
)

Constructor

Parameters
name- the name of this family of actions.
actionParameterTypes- IDs of types of objects that are parameters of the actions instantiated using this template. E.g. name=attack; actionParameterTypes={enemyTypeIDs}
preconditionFunction- a boolean function accepting a vector of action arguments (WorldObjects) and the current WorldState reference
effectFunction- a function returning void and accepting a vector of action arguments (WorldObjects) and the current WorldState reference
costFunction- a function returning a number representing the action's cost, accepting a vector of action arguments (WorldObjects) and the current WorldState reference

Member Function Documentation

◆ GenerateActions()

std::vector< Action > grail::planner::ActionTemplate::GenerateActions ( const class WorldState worldState) const

Generates all action instances based on the action template and the given state.

Parameters
worldState- the current state of the planner.
Returns
A list of actions with parameters that could be generated in the current state of the planner.

◆ GetName()

const std::string & grail::planner::ActionTemplate::GetName ( ) const

Gets a log-friendly name of the actions produced by the template.

Returns
Name of the actions produced by the template.

◆ GetTypeId()

int grail::planner::ActionTemplate::GetTypeId ( ) const

A unique ID of the action template.

Returns
A unique ID of the action template.

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