Something went wrong. Try again.
An implementation of a "utility AI" system, using weights to tell AI which tasks to do instead of a traditional behavior tree.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930
#include "AllyConsideration.h"#include "UtilityIntelligence.h"
UAllyConsideration::UAllyConsideration(){ Description = "A consideration based on how many allies we have nearby."; MaxAllies = 4;}
float UAllyConsideration::Score_Implementation(const FDecisionContext & Context) const{ if (ResponseCurve == NULL) { return 0.0f; } else { UUtilityIntelligence* intelligence = Context.OurIntelligence; if (intelligence == NULL) { return 0.0f; } float allyCount = (float)intelligence->GetAllies().Num(); return ResponseCurve->GetFloatValue(allyCount / (float)MaxAllies); }}