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>
|
virtual void | GetBestOption (const std::vector< SelectionOption< EntityBlackboardPair >> &options, SelectionResult &result, std::function< bool(const std::size_t &)> validator)=0 |
| GetBestOption - Selects most suitable option. Provides different context for each evaluated objects. More...
|
|
virtual void | ClearCache () override |
| ClearCache - called when assigning this reasoner to an entity. Clears internally stored data, which may be invalidated when assigned to a different entity.
|
|
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.
◆ UtilityReasoner()
UtilityReasoner - Constructor.
- Parameters
-
blueprintOptions | - Blueprints mapped with evaluators. |
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. |
◆ CreateSnapshotGenerator()
std::unique_ptr< ISnapshotGenerator > grail::utility::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.
◆ GetBestOption()
virtual void grail::utility::UtilityReasoner::GetBestOption |
( |
const std::vector< SelectionOption< EntityBlackboardPair >> & |
options, |
|
|
SelectionResult & |
result, |
|
|
std::function< bool(const std::size_t &)> |
validator |
|
) |
| |
|
protectedpure virtual |
GetBestOption - Selects most suitable option. Provides different context for each evaluated objects.
- Parameters
-
options | - Contexts paired with evaluators |
result | - Reference to the selection result object. |
validator | - Function validating whether given object can be chosen |
- Template Parameters
-
ContextType | - Type of evaluated object. By default - ValueTuple(AIEntity, Blackboard). |
Implemented in grail::utility::RouletteUtilityReasoner, and grail::utility::MaxUtilityReasoner.
◆ GetUtilityReasonerSnapshot()
GetUtilityReasonerSnapshot - Returns copy of current snapshot and clear the original data.
- Returns
- Current state's snapshot
◆ SetSnapshotProduction()
void grail::utility::UtilityReasoner::SetSnapshotProduction |
( |
bool |
isEnabled | ) |
|
SetSnapshotProduction - Tells reasoner whether it should produce debug snapshots of its state.
- Parameters
-
◆ StageBehavior()
void grail::utility::UtilityReasoner::StageBehavior |
( |
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.
The documentation for this class was generated from the following files: