![]() |
Grail (C#)
1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
A reasoner which uses planners to find optimal sequences of behaviors based on goals. More...
Classes | |
class | Config |
The PlannerReasoner run-time configuration parameters. More... | |
Public Member Functions | |
PlannerReasoner () | |
Constructs a new PlannerReasoner instance with default parameters. More... | |
PlannerReasoner (IGoalSelector goalSelector, DomainTranslator translator, Config config) | |
Constructs a new PlannerReasoner instance based on the provided arguments. More... | |
override void | StageBehavior (AIEntity entity) |
Runs reasoner's selection algorithm and assigns chosen behavior to provided entity. More... | |
void | SetNewGoal (Goal goal, AIEntity entity) |
Sets a new target for planning by this reasoner. If the entity is currently performing a behavior related to its previous goal, it will switch to the FallbackBehavior, if defined. More... | |
void | SetupNewPlanner (DomainTranslator domainTranslator, Config config) |
Resets the planner domain based on data provided by the new domain translator. This method can be used if you want the agent to start planning an entirely different set of actions and disregard the previously defined domain. More... | |
override ISnapshotGenerator | CreateSnapshotGenerator (int entityId) |
override void | ClearCache () |
Called when assigning this reasoner to an entity. Clears internally stored data, which may be invalidated when assigned to a different entity. THIS METHOD SHOULD NOT BE CALLED BY THE USER. IT IS PUBLIC SO THAT THIS METHOD CAN BE USED BY ENTITY AND OVERRIDEN IN DIFFERENT MODULE More... | |
Public Attributes | |
bool | IsComputing => planner.IsComputing |
Returns whether the Planner hasn't yet finished computing the plan. More... | |
Properties | |
PlannerDelegate | OnPlanningSucceeded [set] |
Callback executed whenever a non-partial plan has been found by the algorithm. More... | |
PlannerDelegate | OnPartialPlanFound [set] |
Callback executed if a partial plan has been found provided that partial plans are enabled. More... | |
System.Action< Goal > | OnPlanningFailed [set] |
Callback executed if no plans were found in the allotted iteration budget and satisfying the Config.MaxPlanLength and Config.MaxPlanCost limits. More... | |
Goal | CurrentGoal [get] |
Current goal set for planning. More... | |
Behavior | FallbackBehavior [set] |
The behavior that should be performed during plan computation or if no valid plan is found. More... | |
uint | DebugSnapshotFirstIteration [get, set] |
The number of the iteration starting from which debug snapshots will be generated if run in debug mode. More... | |
uint | DebugSnapshotLastIteration = 0 [get, set] |
The number of the iteration up to which debug snapshots will be generated if run in debug mode. More... | |
![]() | |
Goal | CurrentGoal [get] |
Events | |
System.Action | OnPlanExecuted |
Callback to tell that a plan has been executed in the game. More... | |
A reasoner which uses planners to find optimal sequences of behaviors based on goals.
|
inline |
Constructs a new PlannerReasoner instance with default parameters.
|
inline |
Constructs a new PlannerReasoner instance based on the provided arguments.
goalSelector | Implementation that allows to choose subsequent goals for planning (at start and whenever a new goal is required). |
translator | A translation layer between the abstract plan space and the game objects. See DomainTranslator |
config | The run-time configuration parameters for the planner. |
|
inlinevirtual |
Called when assigning this reasoner to an entity. Clears internally stored data, which may be invalidated when assigned to a different entity. THIS METHOD SHOULD NOT BE CALLED BY THE USER. IT IS PUBLIC SO THAT THIS METHOD CAN BE USED BY ENTITY AND OVERRIDEN IN DIFFERENT MODULE
Reimplemented from Grail.Core.Reasoner.
Sets a new target for planning by this reasoner.
If the entity is currently performing a behavior related to its previous goal, it will switch to the FallbackBehavior, if defined.
goal | The new goal to be set as the current goal. |
entity | The entity for which the planning is performed. |
Implements Grail.Planners.IGoalAcceptor.
|
inline |
Resets the planner domain based on data provided by the new domain translator. This method can be used if you want the agent to start planning an entirely different set of actions and disregard the previously defined domain.
|
inlinevirtual |
Runs reasoner's selection algorithm and assigns chosen behavior to provided entity.
entity |
Implements Grail.Core.Reasoner.
bool Grail.Planners.Reasoners.PlannerReasoner.IsComputing => planner.IsComputing |
Returns whether the Planner hasn't yet finished computing the plan.
|
get |
Current goal set for planning.
|
getset |
The number of the iteration starting from which debug snapshots will be generated if run in debug mode.
|
getset |
The number of the iteration up to which debug snapshots will be generated if run in debug mode.
|
set |
The behavior that should be performed during plan computation or if no valid plan is found.
|
set |
Callback executed if a partial plan has been found provided that partial plans are enabled.
|
set |
Callback executed if no plans were found in the allotted iteration budget and satisfying the Config.MaxPlanLength and Config.MaxPlanCost limits.
|
set |
Callback executed whenever a non-partial plan has been found by the algorithm.
System.Action Grail.Planners.Reasoners.PlannerReasoner.OnPlanExecuted |
Callback to tell that a plan has been executed in the game.