Using Check Points

Check points are events along a path that the path following system will not consider to be reached until they have been validated. You can mark any PathEvent as a check point. Once a Bot adopts a check point as its target point, the PathFollower will not advance the target point any farther along the path until that check point has been validated.

The typical use case for the check point system is to force the character to approach within a given distance of certain kinds of events before it can continue along its path. However, you can use and extend the system to mark any event you like as a check point, and to customize the criteria used to validate that the check points have been reached.

For background information on PathEvents and how to retrieve them, see Monitoring PathEvents.

Default check point behavior

Identifying check points

By default, if you do not supply your own custom class of IPathEventListObserver (see Monitoring PathEvents), your Bot is automatically be set up to use an instance of the DefaultPathEventListObserver class. This observer sets as a check point:

Validating check points

Each Bot determines when its check points have been reached using an instance of a class that implements the IPositionOnPathValidator interface. By default, if you do not supply your own custom implementation, your Bot will automatically be set up to use an instance of PositionOnPathCheckPointValidator. This default implementation only considers a check point to be reached when the Bot is closer to the check point event than the value of the PathFollowerConfig::m_checkPointRadius parameter set for the Bot.

Identifying your own check points

You can set any PathEvent as a check point by calling its PathEvent::SetCheckPointStatus() method.

// make the event into a check point
m_pathEvent->SetCheckPointStatus(Kaim::CheckPointStatus_EventIsACheckPoint);

// make the event not a check point
m_pathEvent->SetCheckPointStatus(Kaim::CheckPointStatus_EventIsNotACheckPoint);

You can do this at any time, for any event that you retrieve from your character's PathEventList.

Depending on how you want to use check points, you may also be able to create your own class of IPathEventListObserver to do your check point marking automatically each time a new path is created. For details on implementing and setting up this interface, see Monitoring PathEvents. Remember that replacing the default observer will change the default behavior of marking certain types of events as check points automatically (see above) unless you include that same code in your implementation, or derive your class from DefaultPathEventListObserver and call the method implementations in the parent class.

Customizing check point validation

You have two possible ways to customize the way check points are validated for your characters.

Distance threshold

If all you want to do is configure the threshold at which the check point is deemed to be successfully reached, set a new value for the PathProgressConfig::m_checkPointRadius configuration parameter. See also Customizing Bot configuration parameters and class methods under Customizing Path Following.

Custom criteria

If you want to use your own custom criteria for validating that a check point has been reached, rather than using a simple distance threshold:

  1. Write your own class that implements the IPositionOnPathValidator interface. This is where you set the logic for testing whether or not a given Bot has reached a given check point.
  2. Write your own class that derives from either the BaseNavigationProfile or NavigationProfile class, and make your implementation of BaseNavigationProfile::GetSharedPositionOnPathValidator() return a pointer to an instance of your IPositionOnPathValidator class.
  3. Set up your World and Bots to use your new NavigationProfile. For details, see Customizing Path Following.