Complete AdventureBot navigation, instance travel and shutdown fixes

Finish capital waiting travel and adaptive flight entry up to 10,000 yards.
Preserve checked vertical climbs, recover blocked ground departures and find
validated dry landings. Retain group routes and Undercity arrival constraints.

Restore defense from native combat references, coordinate instance rendezvous
and browser reentry, finalize clientless sessions before map destruction and
transfer Halaa capture-point ownership safely.

Include the associated regression tests, investigation reports and reusable
diagnostic scripts. Keep generated runtime evidence and server binaries local
through scoped ignore rules. Validation/build/live evidence is recorded in the
session checkpoint and individual reports.
This commit is contained in:
Nico committed 2026-11-05 10:35:34 +01:00
1 parent 2403edcf18
commit 3aa780662e
95 files changed
+4125 -105

No files matched your search

@@ -656,6 +656,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
// call, including its two search tiers. Never cache live Player paths globally.
std::map<ClientlessGraphProbeCache::Key,ClientlessPathDiagnostics> startProbes;
std::map<std::pair<ClientlessGraphProbeCache::Key, bool>, float> flightEstimates;
std::uint64_t expandedStartFlightCalls=0;
auto analyzeStart=[&](Position const& target,ClientlessPathDiagnostics& result)
{
auto key=ClientlessGraphProbeCache::MakeKey(player->GetMapId(),player->GetInstanceId(),player->GetPositionX(),player->GetPositionY(),player->GetPositionZ(),target.GetPositionX(),target.GetPositionY(),target.GetPositionZ());
@@ -713,7 +714,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
// search. In particular, a flight to a portal source must still leave
// enough probes for the flight from its destination map to the goal.
constexpr std::uint64_t MaxFlightEstimatesPerOrigin = 6;
auto flightCost = [&](ClientlessTravelNode const& from, uint32 map, float x, float y, float z, bool access = false)
auto flightCost = [&](ClientlessTravelNode const& from, uint32 map, float x, float y, float z, bool access = false, bool expandedStart = false)
{
if (!flightEnabled || from.MapId != map ||
(blockedBridgeKeys && blockedBridgeKeys->count("flight_origin:"+from.Key)))
@@ -730,8 +731,12 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
// constructing an implicit complete air graph. Cached estimates remain
// usable after the cap; unexamined links simply stay unavailable in
// this plan and ordinary graph travel can still win.
if (trace.FlightCalls >= MaxFlightEstimatesPerPlan)
// Adaptive start rings have their own bounded budget, so an exhausted
// inner ring cannot suppress outer rings or the subsequent graph search.
if (expandedStart ? expandedStartFlightCalls>=80 :
trace.FlightCalls-expandedStartFlightCalls>=MaxFlightEstimatesPerPlan)
return std::numeric_limits<float>::infinity();
if(expandedStart)++expandedStartFlightCalls;
auto begin=std::chrono::steady_clock::now();++trace.FlightCalls;
float result=sClientlessFlightMgr->Estimate(player,map,a,b,access);
if(std::isfinite(result))
@@ -870,19 +875,25 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
// flight budget before graph search can consider flight-only connections.
std::uint64_t startFlightProbes = 0;
constexpr std::uint64_t MaxStartFlightProbes = 4;
for (auto const& pair : _nodes)
std::vector<std::pair<float,std::string>> startNodes;
for(auto const& pair:_nodes)
{
ClientlessTravelNode const& node = pair.second;
if (node.MapId != player->GetMapId())
continue;
if ((!RescueNodeAllowed(node) || !sAdventureAreaMgr->AllowsNode(player,node))) continue;
float const dx = node.X - player->GetPositionX();
float const dy = node.Y - player->GetPositionY();
float const dz = node.Z - player->GetPositionZ();
float const localDistance = std::sqrt(dx * dx + dy * dy + dz * dz);
if (localDistance > startRadius)
continue;
auto const& node=pair.second;
if(node.MapId!=player->GetMapId() || !RescueNodeAllowed(node) ||
!sAdventureAreaMgr->AllowsNode(player,node))continue;
float dx=node.X-player->GetPositionX(),dy=node.Y-player->GetPositionY(),dz=node.Z-player->GetPositionZ();
startNodes.emplace_back(std::sqrt(dx*dx+dy*dy+dz*dz),pair.first);
}
std::sort(startNodes.begin(),startNodes.end());
auto seedStartNodes=[&](float inner,float outer,bool expanded)
{
startFlightProbes=0;
for(auto const& ranked:startNodes)
{
float const localDistance=ranked.first;
if(localDistance>outer)break;
if(localDistance<=inner)continue;
auto const& node=_nodes.at(ranked.second);
float startCost = groundCost(localDistance);
// VCORE_VIRTUAL_EDGE_V11_PORTAL_APPROACH: never seed an unreachable node.
@@ -893,8 +904,9 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
Position entryTarget;
entryTarget.Relocate(node.X, node.Y, node.Z, node.O);
ClientlessPathDiagnostics entryNav;
analyzeStart(entryTarget,entryNav);
bool const reachable = entryNav.Calculated && entryNav.Complete &&
bool const groundCandidate=localDistance<=startRadius;
if(groundCandidate)analyzeStart(entryTarget,entryNav);
bool const reachable = groundCandidate && entryNav.Calculated && entryNav.Complete &&
entryNav.FinalDistance <= 1.5f && entryNav.MaxSegmentLength <= 8.0f &&
entryNav.MaxZDelta <= 5.0f && entryNav.PathLength <= 500.0f;
ClientlessTravelNode departure;
@@ -909,7 +921,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
blockedBridgeKeys->count("flight:flight_departure->"+node.Key)))
{
++startFlightProbes;
air=flightCost(departure,node.MapId,node.X,node.Y,node.Z,true);
air=flightCost(departure,node.MapId,node.X,node.Y,node.Z,true,expanded);
}
if(std::isfinite(air) && !reachable)
{flightRoots.insert(node.Key);startCost=air;}
@@ -917,7 +929,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
{
// 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 &&
bool const partial = groundCandidate && entryNav.Calculated &&
(entryNav.PathType & uint32(PATHFIND_INCOMPLETE)) != 0 &&
(entryNav.PathType & uint32(PATHFIND_NOPATH)) == 0 &&
entryNav.PointCount >= 2 && entryNav.PathLength >= 2.0f &&
@@ -954,6 +966,9 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
++startCount;
}
};
seedStartNodes(-1.0f,startRadius,false);
// Use the nearest ten nodes merely to shortlist real recorded ground edges.
// All distances below are on the player's current map; no database mutation.
std::vector<std::pair<float, std::string>> nearestNodes;
@@ -1075,6 +1090,20 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
"VIRTUAL_EDGE_CANDIDATES map=%u tested=%u accepted=%u",
player->GetMapId(), validated, accepted);
// Keep nearby recorded ground entries ahead of long flight-only entries.
// A ground-only bot never widens its local navigation limit.
if(!startCount && !accepted && flightEnabled)
{
for(float inner=startRadius;inner<10000.0f && !startCount;)
{
float outer=std::min(10000.0f,inner+500.0f);
seedStartNodes(inner,outer,true);
TC_LOG_INFO("server.adventurebot.navigation",
"START_RADIUS_EXPAND map=%u radius=%.0f accepted=%u flightCalls=%llu",
player->GetMapId(),outer,startCount,static_cast<unsigned long long>(expandedStartFlightCalls));
inner=outer;
}
}
if (!startCount && !accepted)
{
if(std::isfinite(directFlightCost))return directFlightRoute();
@@ -1615,7 +1644,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
// Dynamic flights connect real nodes; never the synthetic entry waypoints.
// Include them before the local-bridge guard: a flight is a separate
// macro travel mode with its own native departure and landing checks.
if (flightEnabled && !portalArrival && trace.FlightCalls < MaxFlightEstimatesPerPlan)
if (flightEnabled && !portalArrival && trace.FlightCalls-expandedStartFlightCalls < MaxFlightEstimatesPerPlan)
{
auto const& origin=_nodes.at(current.Value.Node);
std::vector<std::pair<float, std::string>> macroFlightCandidates;
@@ -1677,7 +1706,7 @@ bool ClientlessTravelGraphMgr::PlanAdaptiveRoute(
std::uint64_t const callsAtOrigin = trace.FlightCalls;
for (auto const& ranked : macroFlightCandidates)
{
if (trace.FlightCalls >= MaxFlightEstimatesPerPlan ||
if (trace.FlightCalls-expandedStartFlightCalls >= MaxFlightEstimatesPerPlan ||
trace.FlightCalls - callsAtOrigin >= MaxFlightEstimatesPerOrigin)
break;
auto const& target = _nodes.at(ranked.second);