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