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

The UtilityReasoner class - 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...

#include <UtilityReasoner.hh>

Inheritance diagram for grail::UtilityReasoner:
Collaboration diagram for grail::UtilityReasoner:

Public Member Functions

 UtilityReasoner (std::vector< BlueprintOption< Behavior, EntityBlackboardPair, grail::AIEntity >> &&blueprintOptions, SelectionMethod selectionMethod=SelectionMethod::MAX, float persistence=0.1f)
 UtilityReasoner - Constructor. More...
 
 UtilityReasoner (const UtilityReasoner &other)=delete
 
 UtilityReasoner (UtilityReasoner &&other)=delete
 
UtilityReasoneroperator= (const UtilityReasoner &other)=delete
 
UtilityReasoneroperator= (UtilityReasoner &&other)=delete
 
virtual void SelectBehavior (AIEntity &entity) override
 SelectBehavior - Selects behavior, if able, and assigns it to entity. More...
 
virtual std::unique_ptr< ISnapshotGeneratorCreateSnapshotGenerator (size_t entityId) override
 CreateSnapshotGenerator - Creates object responsible for producing snapshots for this reasoner assigned to particular entity. More...
 
UtilityReasonerSnapshot GetUtilityReasonerSnapshot () const
 GetUtilityReasonerSnapshot - Returns copy of current snapshot and clear the original data. More...
 
void SetSnapshotProduction (bool isEnabled)
 SetSnapshotProduction - Tells reasoner whether it should produce debug snapshots of its state. More...
 
- Public Member Functions inherited from grail::Reasoner
 Reasoner (const Reasoner &)=default
 
 Reasoner (Reasoner &&)=default
 
Reasoneroperator= (const Reasoner &)=default
 
Reasoneroperator= (Reasoner &&)=default
 

Detailed Description

The UtilityReasoner class - 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::UtilityReasoner::UtilityReasoner ( std::vector< BlueprintOption< Behavior, EntityBlackboardPair, grail::AIEntity >> &&  blueprintOptions,
SelectionMethod  selectionMethod = SelectionMethod::MAX,
float  persistence = 0.1f 
)

UtilityReasoner - Constructor.

Parameters
blueprintOptions- Blueprints mapped with evaluators.
selectionMethod- Utility selection method (MAX or ROULETTE) - ROULLETTE unavailable for now.
persistence- Bonus 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

◆ CreateSnapshotGenerator()

std::unique_ptr< ISnapshotGenerator > grail::UtilityReasoner::CreateSnapshotGenerator ( size_t  entityId)
overridevirtual

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

Parameters
entityId- ID of Entity to which this reasoner is assigned.
Returns
Created snapshot generator.

Reimplemented from grail::Reasoner.

◆ GetUtilityReasonerSnapshot()

UtilityReasonerSnapshot grail::UtilityReasoner::GetUtilityReasonerSnapshot ( ) const

GetUtilityReasonerSnapshot - Returns copy of current snapshot and clear the original data.

Returns
Current state's snapshot

◆ SelectBehavior()

void grail::UtilityReasoner::SelectBehavior ( grail::AIEntity entity)
overridevirtual

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

Parameters
entity- Owner entity to which selected behavior will be assigned.

Implements grail::Reasoner.

◆ SetSnapshotProduction()

void grail::UtilityReasoner::SetSnapshotProduction ( bool  isEnabled)

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

Parameters
isEnabled

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