|
Grail (C++)
1.4.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 "../Selectors/SelectionOption.hh"
7 #include "../Selectors/SelectionResult.hh"
8 #include "../../GrailCore/Reasoner.hh"
9 #include "../../GrailCore/EntityBlackboardPair.hh"
10 #include "../../GrailData/DebugInfo/UtilityReasonerSnapshot.h"
11 #include "../Selectors/BlueprintOption.hh"
32 float persistence = 0.1f);
66 std::function<
bool(
const std::size_t&)> validator) = 0;
71 void AssignBehaviorInstance(
AIEntity& entity,
72 std::unique_ptr<Behavior> instance,
74 std::vector<std::unique_ptr<Behavior>> GenerateContextsAndInstances(
const AIEntity& entity);
75 void ValidateOperationStack(
const AIEntity& entity);
76 void SelectBehaviorFromStack(
AIEntity& entity);
78 std::vector<BlueprintOption<Behavior, EntityBlackboardPair, grail::AIEntity>> blueprintOptions = {};
81 std::vector<utility::SelectionOption<EntityBlackboardPair>> generatedOptions{};
85 float persistence = 0.0f;
87 bool produceSnapshot =
false;
89 mutable std::mutex snapshotMutex;
94 #endif //GRAIL_UTILITY_REASONER_H
The AIEntity class - Defines a basic object which can execute behaviors.
Definition: AIEntity.hh:50
The Reasoner class - Entity's "brain", assigns them behaviors chosen by user-defined algorithms.
Definition: Reasoner.hh:21
Definition: BlueprintOption.hh:14
virtual void ClearCache() override
ClearCache - called when assigning this reasoner to an entity. Clears internally stored data,...
Definition: UtilityReasoner.cpp:184
Definition: UtilityReasonerSnapshot.h:15
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.
The SelectionResult struct - Structure containing results of operations done by Selector.
Definition: SelectionResult.hh:19
The UtilityReasoner class - Class responsible for assigning behaviors using Utility System algorithm....
Definition: UtilityReasoner.hh:24
data::UtilityReasonerSnapshot GetUtilityReasonerSnapshot() const
GetUtilityReasonerSnapshot - Returns copy of current snapshot and clear the original data.
Definition: UtilityReasoner.cpp:172
virtual void StageBehavior(AIEntity &entity) override
SelectBehavior - Selects behavior, if able, and assigns it to entity.
Definition: UtilityReasoner.cpp:23
UtilityReasoner(std::vector< BlueprintOption< Behavior, EntityBlackboardPair, grail::AIEntity >> blueprintOptions, float persistence=0.1f)
UtilityReasoner - Constructor.
Definition: UtilityReasoner.cpp:14
void SetSnapshotProduction(bool isEnabled)
SetSnapshotProduction - Tells reasoner whether it should produce debug snapshots of its state.
Definition: UtilityReasoner.cpp:179
virtual std::unique_ptr< ISnapshotGenerator > CreateSnapshotGenerator(size_t entityId) override
CreateSnapshotGenerator - Creates object responsible for producing snapshots for this reasoner assign...
Definition: UtilityReasoner.cpp:167