Prioritize roads when pathfinding?

Procedural/dynamic game that allows the player to put down roads.
Basically what we would like to know is how we could prioritize certain nodes above other nodes, so if an AI entity would want to take a path, and he had a choice between several nodes, he would prioritize certain ones that we would select.

Any ideas?

Since the roads are made during runtime and not in the editor, I’m not sure if a point graph would be the right solution?


If you are using a grid graph, the easiest way is to apply a tag to all ‘road’ nodes. Here is the documentation for how to apply tags during runtime:

Due to how pathfinding works, it is not possible to prioritize some nodes, however it is possible to discourage the AI from traversing nodes. This amounts to essentially the same effect as prioritization.
So what you would do is to have 2 tags. The ‘Basic Ground’ tag and a ‘Road’ tag. On the Seeker component it is possible to set the penalty per tag and in this case you would set the penalty for the ‘Basic Ground’ tag to something like say 10000 to start with (a penalty of 1000 corresponds approximately to the cost of moving a distance of 1 world unit). You would leave the ‘Road’ tag with a penalty of zero.

Another option is to paint the penalty on a texture and use that. The drawback is that this requires updating the whole graph each time you need to update the penalty. See
This option can be set under ‘Grid Graph Settings’ -> ‘Penalty Modifications’ -> ‘Use Texture’.