Fix excessive path penalties

This commit is contained in:
markmental 2025-12-27 16:28:31 -05:00
commit 3ed7a71dd5

View file

@ -38,9 +38,13 @@ float PlannerHeuristic::gfunctionKillsDistCTWithHostage (int team, int currentIn
if (current.flags & NodeFlag::NoHostage) {
return kInfiniteHeuristic;
}
else if (current.flags & (NodeFlag::Crouch | NodeFlag::Ladder)) {
return gfunctionKillsDist (team, currentIndex, parentIndex) * 500.0f;
else if (current.flags & NodeFlag::Ladder) {
return gfunctionKillsDist (team, currentIndex, parentIndex) * 6.0f;
}
else if (current.flags & NodeFlag::Crouch) {
return gfunctionKillsDist (team, currentIndex, parentIndex) * 3.0f;
}
return gfunctionKillsDist (team, currentIndex, parentIndex);
}
@ -69,9 +73,13 @@ auto PlannerHeuristic::gfunctionKillsCTWithHostage (int team, int currentIndex,
if (current.flags & NodeFlag::NoHostage) {
return kInfiniteHeuristic;
}
else if (current.flags & (NodeFlag::Crouch | NodeFlag::Ladder)) {
return gfunctionKills (team, currentIndex, parentIndex) * 500.0f;
else if (current.flags & NodeFlag::Ladder) {
return gfunctionKills (team, currentIndex, parentIndex) * 6.0f;
}
else if (current.flags & NodeFlag::Crouch) {
return gfunctionKills (team, currentIndex, parentIndex) * 3.0f;
}
return gfunctionKills (team, currentIndex, parentIndex);
}
@ -103,9 +111,13 @@ float PlannerHeuristic::gfunctionPathDistWithHostage (int, int currentIndex, int
if (current.flags & NodeFlag::NoHostage) {
return kInfiniteHeuristic;
}
else if (current.flags & (NodeFlag::Crouch | NodeFlag::Ladder)) {
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex) * 500.0f;
else if (current.flags & NodeFlag::Ladder) {
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex) * 6.0f;
}
else if (current.flags & NodeFlag::Crouch) {
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex) * 3.0f;
}
return gfunctionPathDist (Team::Unassigned, currentIndex, parentIndex);
}
@ -203,7 +215,7 @@ bool AStarAlgo::cantSkipNode (const int a, const int b, bool skipVisCheck) {
const float distanceSq = ag.origin.distanceSq (bg.origin);
const bool tooFar = distanceSq > cr::sqrf (400.0f);
const bool tooClose = distanceSq < cr::sqrtf (40.0f);
const bool tooClose = distanceSq < cr::sqrf (40.0f);
if (tooFar || tooClose) {
return true;