Consideration
Consideration represents a subset of the given Context’s state, which will be passed through a curve. Contexts can take form of basically any data type.
Custom considerations
User should override Consideration<Context>
class.
By doing so, they should provide
-
rank - a measure of importance of this consideration (
0
by default) -
the consideration’s evaluation method - a method returning floating point value representing this consideration
Example implementation
-
C++
-
C#
class HealthConsideration : public grail::Consideration<const grail::AIControlledEntity*>
{
public:
HealthConsideration()
: grail::Consideration<const grail::AIControlledEntity*>{1} // default rank of 1
{
}
HealthConsideration(int rank)
: grail::Consideration<const grail::AIControlledEntity*>{rank} // user-provided rank
{
}
virtual float Evaluate(const grail::AIControlledEntity* entity) const override
{
return entity->GetBlackboard().GetValue<float>("health"); // return current health points
}
};
public class HealthConsideration : Grail.Consideration<Grail.AIControlledEntity>
{
public HealthConsideration()
: base(1) // default rank of 1
{
}
public HealthConsideration(int rank)
: base(rank) // user-provided rank
{
}
public override float Evaluate(Grail.AIControlledEntity entity)
{
return entity.Blackboard.GetValue<float>("health"); // return current health points
}
}