Overview

When a pathfinding query is aborted the query will return the best path found up to that point.
This path will not extend all the way to the desired goal position, and in some situations this path may even lead into a dead end.
Nevertheless this functionality can be useful for certain situations, for example where it is not absolutely essential for
an agent to take the shortest path, or to enable an agent to start moving whilst waiting for a longer query to complete.

In order to use the query callback methods, the client application needs to create a class deriving from the
iQueryCallBack interface.
An object of that class is then created and a pointer to the object passed in with the pathfinding query.

Choosing a approach for limiting query time

The actual code used to decide when a query should be aborted can depend on the specific constraints of the client application.
In general, however, the most common approach is to use either a time limit, or a limit on the number of steps in the pathfinding query.

Time based approaches have the advantage of giving more direct control over the actual query time.
Approaches based on the number of steps executed have the advantage of being repeatable between executions of the application,
across platforms, and so on.
For some situations a hybrid approach might be suitable, based on aborting after a fixed time limit but also counting the number of iterations
so that the result can be repeated exactly later if desired.

Polling frequency

In addition to specifying when a query should be aborted a callback also controls the frequency with which PathEngine
polls the callback during a search.
Higher frequencies enable finer control over eventual query time, whereas lower frequencies reduce the overhead for
calling back to the callback object.
The frequency is based on the number of corners successfully explored by the search.
A frequency of 1 indicates that PathEngine should call back for every corner successfully explored.

An example callback implementation

The following provides a simple example implementation of a callback object: