(C++)  1.1.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Consideration.hh
1 #ifndef GRAIL_CONSIDERATION_H
2 #define GRAIL_CONSIDERATION_H
3 
4 #include "../GrailCore/AIEntity.hh"
5 #include "../GrailCore/Blackboard.hh"
6 #include "Evaluator.hh"
7 
8 
9 namespace grail
10 {
11  namespace utility
12  {
13  template <typename ContextType>
18  class Consideration : public Evaluator<ContextType>
19  {
20  public:
21  Consideration() = default;
22 
23  Consideration(const Consideration<ContextType>&) = default;
25 
26  virtual ~Consideration() = default;
27 
28  Consideration& operator = (const Consideration<ContextType>&) = default;
29  Consideration& operator = (Consideration<ContextType>&&) = default;
30 
31  virtual EvaluatorType GetEvaluatorType() const override final { return EvaluatorType::CONSIDERATION; }
32 
33  virtual std::string GetDisplayName() const { return "unnamed_consideration"; }
34 
35  protected:
41  virtual float Evaluate(const ContextType& context) const = 0;
42 
43  virtual void DebugDump(const std::map<const void*, std::size_t>&, EvaluationDebugData& debugData) const override final
44  {
45  debugData.SetMetadata(GetDisplayName());
46  }
47 
54  virtual float Evaluate(const ContextType& context, UtilityEvaluatorSnapshot* const snapshot) const override final
55  {
56  return Evaluate(context);
57  }
58  };
59 
60  using DefaultConsideration = Consideration<const AIEntity*>;
61  using EntityBlackboardPair = std::pair<const AIEntity*, Blackboard>;
62  using UtilityConsideration = Consideration<EntityBlackboardPair>;
63  }
64 }
65 #endif //GRAIL_CONSIDERATION_H
The EvaluationDebugData class - debug data describing singular evaluator.
Definition: EvaluationDebugData.h:20
The UtilityEvaluatorSnapshot class - debug snapshot of whole evaluator tree assigned to evaluated obj...
Definition: UtilityEvaluatorSnapshot.h:22
The Consideration class - Abstract type of Evaluator representing a subset of game state.
Definition: Consideration.hh:19
virtual float Evaluate(const ContextType &context, UtilityEvaluatorSnapshot *const snapshot) const override final
Evaluate - Called from EvaluateContext which also evaluates context, but without automatically fillin...
Definition: Consideration.hh:54
virtual float Evaluate(const ContextType &context) const =0
Evaluate - Abstract method, which should be overriden by the user to return proper value representing...
virtual void DebugDump(const std::map< const void *, std::size_t > &, EvaluationDebugData &debugData) const override final
DebugDump - Called from EvaluateContext, which generates additional debug data for each evaluator....
Definition: Consideration.hh:43
The Evaluator class - base class being able to evaluate given context and output the result.
Definition: Evaluator.hh:21