Single Node Blocking with Runtime Node Penalties


Just getting started with the project, and I was working through the turn based utilities page in the documentation. Everything was very helpful up until I got to this code snippet that demonstrates how to implement your own traversal provider:

This code will not compile for me because path.GetTagPenalty is an internal method.

Also, the ultimate goal in following this portion of the documentation was to build my own system that supported both SingleNodeBlocker obstacles with dynamic position (the characters in a turn based game) as well as having the ability to assign node penalties at runtime. I have achieved both of these pieces of functionality separately, but cannot get them both.

In order to accomplish the single node blocking, I simply followed the Turn Based Utilities docs, and that worked swimmingly, but the traversal provider that is used is BlockManager.TraversalProvider. The only way I’ve gotten the node penalties to work is to have a Seeker script on my agent that has values for each of the node penalties assigned to it. The problem I’ve run into is that I can’t figure out how to assign a new traversal provider to a Seeker so that it will also avoid paths that include SingleNodeBlocker’s. Is there some way to make a seeker behave this way? Alternatively, a solution for checking node penalties from within a BlockManager.TraversalProvider that compiles would probably also suffice.

Thank you


Sorry for the late answer.

Oops. That’s a bug. It should be public. I will fix this in the next version (you can make it public locally in your version in the meantime).

What you could do is to create an ITraversalProvider that uses both the BlockManager.TraversalProvider and adds your penalty code. Something like:

public class MyTraversalProvider : ITraversalProvider {
    public ITraversalProvider blockManager;
    public bool CanTraverse (Path path, GraphNode node) {
        return blockManager.CanTraverse(path, node);
    public uint GetTraversalCost (Path path, GraphNode node) {
        return blockManager.GetTraversalCost(path, node) + add something here;

Thank you, I will give that a try

1 Like