 |
Grail (C++)
1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
1 #ifndef GRAIL_UTILITY_REASONER_H
2 #define GRAIL_UTILITY_REASONER_H
4 #include "../Selector.hh"
5 #include "../../GrailCore/Reasoner.hh"
6 #include "../../GrailData/DebugInfo/UtilityReasonerSnapshot.h"
7 #include "../../GrailData/UtilityModel/UtilitySelectorModel.h"
8 #include "../../GrailEvaluators/Evaluator.hh"
18 template <
typename InstanceType,
typename ContextType,
typename DataType>
24 std::shared_ptr<utility::Evaluator<ContextType>>
evaluator;
66 SelectionMethod selectionMethod = SelectionMethod::MAX,
67 float persistence = 0.1f);
100 void AssignBehaviorInstance(
AIEntity& entity,
101 std::unique_ptr<Behavior> instance,
103 std::vector<std::unique_ptr<Behavior>> GenerateContextsAndInstances(
const AIEntity& entity);
104 void ValidateOperationStack(
const AIEntity& entity);
105 void SelectBehaviorFromStack(
AIEntity& entity);
107 std::vector<BlueprintOption<Behavior, EntityBlackboardPair, grail::AIEntity>> blueprintOptions = {};
110 std::vector<utility::Option<EntityBlackboardPair>> generatedOptions{};
114 SelectionMethod selectionMethod = SelectionMethod::MAX;
116 float persistence = 0.0f;
118 bool produceSnapshot =
false;
120 mutable std::mutex snapshotMutex;
123 #endif //GRAIL_UTILITY_REASONER_H
The AIEntity class - Defines a basic object which can execute behaviors.
Definition: AIEntity.hh:39
The Reasoner class - Entity's "brain", assigns them behaviors chosen by user-defined algorithms.
Definition: Reasoner.hh:19
void SetSnapshotProduction(bool isEnabled)
SetSnapshotProduction - Tells reasoner whether it should produce debug snapshots of its state.
Definition: UtilityReasoner.cpp:173
Definition: UtilityReasoner.hh:19
utility::Blueprint< InstanceType, ContextType, DataType > behaviorBlueprint
Blueprint for this option.
Definition: UtilityReasoner.hh:28
UtilityReasoner(std::vector< BlueprintOption< Behavior, EntityBlackboardPair, grail::AIEntity >> &&blueprintOptions, SelectionMethod selectionMethod=SelectionMethod::MAX, float persistence=0.1f)
UtilityReasoner - Constructor.
Definition: UtilityReasoner.cpp:9
The UtilityReasoner class - Class responsible for assigning behaviors using Utility System algorithm....
Definition: UtilityReasoner.hh:54
virtual std::unique_ptr< ISnapshotGenerator > CreateSnapshotGenerator(size_t entityId) override
CreateSnapshotGenerator - Creates object responsible for producing snapshots for this reasoner assign...
Definition: UtilityReasoner.cpp:161
virtual void SelectBehavior(AIEntity &entity) override
SelectBehavior - Selects behavior, if able, and assigns it to entity.
Definition: UtilityReasoner.cpp:20
std::shared_ptr< utility::Evaluator< ContextType > > evaluator
Evaluator for this option.
Definition: UtilityReasoner.hh:24
int rank
Rank - measure of importance of evaluated object. Only objects with highest available rank may be sel...
Definition: UtilityReasoner.hh:32
The Evaluator class - base class being able to evaluate given context and output the result.
Definition: Evaluator.hh:20
Definition: UtilityReasonerSnapshot.h:10
UtilityReasonerSnapshot GetUtilityReasonerSnapshot() const
GetUtilityReasonerSnapshot - Returns copy of current snapshot and clear the original data.
Definition: UtilityReasoner.cpp:166