Grail (C#)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.Utility.Reasoners.UtilityReasoner Class Referenceabstract

Class responsible for assigning behaviors using Utility System algorithm. All considered behaviors are given a score designating their utility in current situation. Most suitable behavior is chosen based on those scores. More...

Inheritance diagram for Grail.Utility.Reasoners.UtilityReasoner:
Collaboration diagram for Grail.Utility.Reasoners.UtilityReasoner:

Public Member Functions

delegate bool Validator (in int index)
 Validator. More...
 
override void StageBehavior (AIEntity entity)
 Selects behavior, if able, and assigns it to entity. More...
 
void SetSnapshotProduction (bool isEnabled)
 Tells reasoner whether it should produce debug snapshots of its state. More...
 
UtilityReasonerSnapshot GetUtilityReasonerSnapshot ()
 Returns copy of current snapshot and clear the original data. More...
 
override ISnapshotGenerator CreateSnapshotGenerator (int entityId)
 Creates object responsible for producing snapshots for this reasoner assigned to particular entity. More...
 
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...
 

Protected Member Functions

 UtilityReasoner (List< BlueprintOption< Behavior, EntityBlackboardPair, AIEntity >> blueprintOptions, float persistence=0.1f)
 Constructor. More...
 
abstract void GetBestOption< ContextType > (in List< SelectionOption< ContextType >> options, ref SelectionResult result, Validator validator)
 

Detailed Description

Class responsible for assigning behaviors using Utility System algorithm. All considered behaviors are given a score designating their utility in current situation. Most suitable behavior is chosen based on those scores.

Constructor & Destructor Documentation

◆ UtilityReasoner()

Grail.Utility.Reasoners.UtilityReasoner.UtilityReasoner ( List< BlueprintOption< Behavior, EntityBlackboardPair, AIEntity >>  blueprintOptions,
float  persistence = 0.1f 
)
inlineprotected

Constructor.

Parameters
blueprintOptionsBlueprints mapped with evaluators.
persistenceBonus score that currently executed behavior(or behavior from the top of the stack) gains during behavior selection. Persistence of 0 give no bonus at all, negative persistence causes unstable entity behaviors.

Member Function Documentation

◆ ClearCache()

override void Grail.Utility.Reasoners.UtilityReasoner.ClearCache ( )
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.

◆ CreateSnapshotGenerator()

override ISnapshotGenerator Grail.Utility.Reasoners.UtilityReasoner.CreateSnapshotGenerator ( int  entityId)
inlinevirtual

Creates object responsible for producing snapshots for this reasoner assigned to particular entity.

Parameters
entityIdID of Entity to which this reasoner is assigned.
Returns
Created snapshot generator.

Reimplemented from Grail.Core.Reasoner.

◆ GetUtilityReasonerSnapshot()

UtilityReasonerSnapshot Grail.Utility.Reasoners.UtilityReasoner.GetUtilityReasonerSnapshot ( )
inline

Returns copy of current snapshot and clear the original data.

Returns
Current state's snapshot.

◆ SetSnapshotProduction()

void Grail.Utility.Reasoners.UtilityReasoner.SetSnapshotProduction ( bool  isEnabled)
inline

Tells reasoner whether it should produce debug snapshots of its state.

Parameters
isEnabled

◆ StageBehavior()

override void Grail.Utility.Reasoners.UtilityReasoner.StageBehavior ( AIEntity  entity)
inlinevirtual

Selects behavior, if able, and assigns it to entity.

Parameters
entityOwner entity to which selected behavior will be assigned.

Implements Grail.Core.Reasoner.

◆ Validator()

delegate bool Grail.Utility.Reasoners.UtilityReasoner.Validator ( in int  index)

Validator.


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