mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
Compare commits
No commits in common. "91b217c962829295728091ec5c3e79c619fe56e5" and "83e9ad3a970a0c1ee2f46522aded519023dea0be" have entirely different histories.
91b217c962
...
83e9ad3a97
@ -3405,34 +3405,15 @@ bool MovementAction::ExecuteTravelPlan(TravelPlan& state)
|
||||
case PathNodeType::NODE_PATH:
|
||||
case PathNodeType::NODE_NODE:
|
||||
{
|
||||
// Batch consecutive walk points into one spline. Capped at
|
||||
// 20 points OR ~70y of accumulated distance — whichever
|
||||
// comes first. The distance cap gives the planner regular
|
||||
// re-evaluation points without committing the whole
|
||||
// remaining route up front; stepIdx advances exactly in
|
||||
// step with what's actually dispatched, so the next tick
|
||||
// picks up from the truncation point.
|
||||
// Batch consecutive walk points into one spline. Capped small 20 points per tick.
|
||||
static constexpr uint32 MAX_SPLINE_POINTS = 20;
|
||||
static constexpr float MAX_BATCH_LENGTH = 70.0f;
|
||||
state.walkPoints.clear();
|
||||
float accumulated = 0.f;
|
||||
while (state.stepIdx < state.steps.size() && state.walkPoints.size() < MAX_SPLINE_POINTS)
|
||||
{
|
||||
const PathNodePoint& wp = state.steps[state.stepIdx];
|
||||
if (wp.type != PathNodeType::NODE_PATH && wp.type != PathNodeType::NODE_NODE)
|
||||
break;
|
||||
G3D::Vector3 next(wp.point.GetPositionX(), wp.point.GetPositionY(), wp.point.GetPositionZ());
|
||||
if (!state.walkPoints.empty())
|
||||
{
|
||||
accumulated += (next - state.walkPoints.back()).length();
|
||||
if (accumulated >= MAX_BATCH_LENGTH)
|
||||
{
|
||||
state.walkPoints.push_back(next);
|
||||
state.stepIdx++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
state.walkPoints.push_back(next);
|
||||
state.walkPoints.push_back(G3D::Vector3(wp.point.GetPositionX(), wp.point.GetPositionY(), wp.point.GetPositionZ()));
|
||||
state.stepIdx++;
|
||||
}
|
||||
|
||||
|
||||
@ -236,29 +236,13 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
|
||||
|
||||
if (points.size() >= 2)
|
||||
{
|
||||
// Cap dispatched path length at ~70y. MoveFarTo's
|
||||
// early-exit (top of function) lets the active spline
|
||||
// run until bot is within 10y of its endpoint, then
|
||||
// replans from the new position. Capping per-dispatch
|
||||
// distance gives the planner regular re-evaluation
|
||||
// points without the per-tick replan cost of fully
|
||||
// unbounded chunks.
|
||||
{
|
||||
constexpr float maxDispatchLength = 70.0f;
|
||||
float accumulated = 0.f;
|
||||
size_t cutoff = points.size();
|
||||
for (size_t i = 1; i < points.size(); ++i)
|
||||
{
|
||||
accumulated += (points[i] - points[i - 1]).length();
|
||||
if (accumulated >= maxDispatchLength)
|
||||
{
|
||||
cutoff = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cutoff < points.size())
|
||||
points.resize(cutoff);
|
||||
}
|
||||
// Cap the chain at 20 waypoints. Beyond that, the
|
||||
// chained probe's accuracy degrades (more chained
|
||||
// PathGenerator calls = more stitching artifacts) and
|
||||
// the spline interpolation between distant waypoints
|
||||
// is more likely to drift through air.
|
||||
if (points.size() > 20)
|
||||
points.resize(20);
|
||||
|
||||
LOG_INFO("playerbots", "[MoveFar] {} mmap-path | dis={:.0f} | endDist={:.0f} | wp={} | mmapFails={} nodeFails={} | flags={}{}{}",
|
||||
bot->GetName(), dis, endDistToDest, (uint32)points.size(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user