Hi.
I have a particular problem where I’m making a game similar to Rimworld. The agents need to check very often X nodes ahead of their path. Since I’m using path modifiers, the only way I can get the accurate representation of the remaining path is to use GetRemainingPath from AIPath.cs.
However, this returns the ENTIRE path, which is often very huge and not something I need. So I modified the GetRemainingPath method like so:
public void GetRemainingPathLimited(List<Vector3> buffer, int limit)
{
buffer.Clear();
buffer.Add(position);
if (!interpolator.valid)
{
return;
}
interpolator.GetRemainingPathLimited(buffer, limit);
}
public void GetRemainingPathLimited(List<Vector3> buffer, int limit)
{
AssertValid();
buffer.Add(position);
for (int i = segmentIndex + 1; i < interpolator.path.Count; i++)
{
if (buffer.Count >= limit)
{
break;
}
buffer.Add(interpolator.path[i]);
}
}
This way, I can quickly get only a specific portion of the remaining path and don’t have to waste a lot of CPU time for nothing.
Would you please consider adding this to A*PP? Perhaps you can make the API a bit nicer or more optimized. It’s a really simple change to implement and it would immensely help my game, and possibly people down the line in the future with a similar problem.