Patch for the portalnode approach and selection
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s

This commit is contained in:
Nico committed 2026-10-19 23:15:11 +02:00
1 parent b37a0ddcc4
commit 56da0d60cf
4 files changed
+222 -8

No files matched your search

@@ -389,6 +389,10 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
std::unordered_set<uint32> const* blockedEdgeIds,
std::unordered_set<std::string> const* blockedBridgeKeys)
{
// VCORE_C819_DEFERRED_START_NODES: run the unchanged C8.18 search in two tiers.
// A partial ordinary route must not suppress a complete route via a deferred root.
auto runSearch = [&](bool allowDeferred) -> bool
{
route.clear();
reachedNode.clear();
error.clear();
@@ -491,16 +495,33 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
entryTarget.Relocate(node.X, node.Y, node.Z, node.O);
ClientlessPathDiagnostics entryNav;
sClientlessTravelMgr->AnalyzePath(const_cast<Player*>(player), entryTarget, entryNav);
if (!entryNav.Calculated || !entryNav.Complete || entryNav.FinalDistance > 1.5f ||
entryNav.MaxSegmentLength > 8.0f || entryNav.MaxZDelta > 5.0f ||
entryNav.PathLength > 500.0f)
bool const reachable = entryNav.Calculated && entryNav.Complete &&
entryNav.FinalDistance <= 1.5f && entryNav.MaxSegmentLength <= 8.0f &&
entryNav.MaxZDelta <= 5.0f && entryNav.PathLength <= 500.0f;
// VCORE_C819_DEFERRED_START_NODES: incomplete is not the same as unsafe.
// The endpoint is handled by the executor, not counted as arrival at node.
bool const partial = entryNav.Calculated &&
(entryNav.PathType & uint32(PATHFIND_INCOMPLETE)) != 0 &&
(entryNav.PathType & uint32(PATHFIND_NOPATH)) == 0 &&
entryNav.PointCount >= 2 && entryNav.PathLength >= 2.0f &&
entryNav.PathLength <= 500.0f && entryNav.MaxSegmentLength <= 8.0f &&
entryNav.MaxZDelta <= 5.0f &&
entryNav.FinalDistance + 1.0f < entryNav.DirectDistance;
if (!reachable && !(allowDeferred && partial))
{
TC_LOG_INFO("server.adventurebot.navigation",
"START_NODE_REJECT node='%s' distance=%.2f reason='%s'",
node.Key.c_str(), localDistance, entryNav.Reason.c_str());
if (partial && !allowDeferred)
TC_LOG_INFO("server.adventurebot.navigation",
"C819_START_NODE_DEFER node='%s' path=%.2f final=%.2f",
node.Key.c_str(), entryNav.PathLength, entryNav.FinalDistance);
else if (!partial)
TC_LOG_INFO("server.adventurebot.navigation",
"START_NODE_REJECT node='%s' distance=%.2f reason='%s'",
node.Key.c_str(), localDistance, entryNav.Reason.c_str());
continue;
}
startCost = entryNav.PathLength;
if (!reachable)
startCost += 100000.0f; // Tier 2 only: deferred roots rank after reachable roots
}
State state{ node.Key, false };
std::string const key = stateKey(state);
@@ -511,7 +532,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
distance[key] = startCost;
states[key] = state;
persistentHops[key] = 0;
open.push({ localDistance, state });
open.push({ startCost, state });
++startCount;
}
@@ -1158,6 +1179,48 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
error = "destination not fully reachable; returning best-effort partial route";
return !route.empty();
};
bool const firstOk = runSearch(false);
if (firstOk && complete)
{
TC_LOG_INFO("server.adventurebot.navigation", "C819_ROUTE_TIER tier=reachable complete=1");
return true;
}
std::vector<ClientlessTravelRouteStep> firstRoute = route;
bool const firstComplete = complete;
std::string firstReached = reachedNode;
std::string firstError = error;
bool const secondOk = runSearch(true);
if (secondOk && complete)
{
TC_LOG_INFO("server.adventurebot.navigation", "C819_ROUTE_TIER tier=deferred complete=1");
return true;
}
// If no complete route exists, a selected deferred root is still a useful
// approach to real graph infrastructure, provided that its execution is safe.
if (secondOk && !complete && !route.empty() &&
route.front().EdgeType == "start" &&
route.front().NodeKey != "virtual_ground_entry" &&
firstOk && !firstRoute.empty() &&
route.front().NodeKey != firstRoute.front().NodeKey)
{
TC_LOG_INFO("server.adventurebot.navigation",
"C819_ROUTE_TIER tier=deferred-approach complete=0");
return true;
}
if (firstOk)
{
route = std::move(firstRoute);
complete = firstComplete;
reachedNode = std::move(firstReached);
error = std::move(firstError);
TC_LOG_INFO("server.adventurebot.navigation", "C819_ROUTE_TIER tier=reachable-partial complete=0");
return true;
}
TC_LOG_INFO("server.adventurebot.navigation", "C819_ROUTE_TIER tier=deferred-partial complete=%u", complete ? 1u : 0u);
return secondOk;
}
bool ClientlessTravelGraphMgr::PlanRouteToPosition(