Easy Pathfinding with NavGO

I am sure I will work with you more in future!

1 Like

Question:

Can the paths be created dynamically or do the nodes have to be laid down manually?

Im now designing how I will create levels- manually or dynamically.

I very much designed the NavGo to be manual, that being said it can be used dynamically depending upon your use case. If you wanted to say, spawn a bunch of nodes using a factory or remove nodes, you can always redraw the maps and pathing using this command:

msg.post("/NavGO_HandlerGO#NavGO_HandlerScript", hash("redraw_path"))

This command may cause some lag if you have a big enough map or call it every frame. Also, all assets on a path will not have that path automatically recalculated. It works for something with random map generation where the map is different each time.

If you wanted to spawn a bunch of directional nodes, programmatically assign ID’s and then redraw the path, that should theoretically work, I may have to make some slight modifications to make that work smoother.

thanks. I will probably stay manual for now. I just wanted to make sure I understood how the library worked before I made an assumption.

As usual I appreciate the quick response.

1 Like

New Update 5/28/2022

Over the past year I’ve used NavGo in 8 different public projects and number of personal ones. I have noticed a few problems with how paths are generating. The following image shows an example of some them:

This image above shows paths generating in-between collision groups and and across tight corners. Although all of these paths are technically valid (navGo checks from node center-to-center), these paths cannot be traversed by the 64x64 demo character.

Typically when I encountered this issue in a project I would just move the nodes around to ensure these paths don’t generate. However, an optimization in the code means a path will auto-generate straight to a node if it is available. So even with carefully placed nodes, a character could still get stuck on corners or could try to move through gabs.

To address this issue I have added some multi-raycasting options to the NavGo.

Instead of just going center-to-center, the navGo can now be configured to go from both sides of a node or from both sides & center. With both of these options, the distance from the center of the node can be changed to ensure the path will be wide enough for whatever use case you may have.

Sides: This is the two 2 option. This can be used to ensure rays do not go through the gaps of objects. However small enough objects can have rays go around them which will cause issues. If you are using NavGo in proximity to small objects, I recommend the 3 rays option. See bellow for a demonstration of the 2-rays option with debug lines enabled.

Sides & Center: This is the 3 rays option. Rays will be sent from the side of an object and the center to ensure no small objects are missed in the middle. See bellow for an example with debug lines enabled.

These options are entirely optional and this update is a non-breaking change.

Link to the full release notes: Release NavGO Improved Path Generation with Multi-Raycasting · DrCampbell2017/NavGO · GitHub

Link to the new release: https://github.com/DrCampbell2017/NavGO/archive/refs/tags/Alpha.18.zip

If you have any other features you would like me to include in this project or have any questions on how to use it, feel free to let me know. Thank you!

7 Likes