News Forums RAIN General Discussion and Troubleshooting Pathfinding using a Waypoint Network

This topic contains 9 replies, has 2 voices, and was last updated by  GamesOfEdan 1 year, 1 month ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #27194

    GamesOfEdan
    Participant

    Is it possible with the latest version of RAIN to have an AI navigate to a destination using a Waypoint Network Only (ie. no NavMesh defined)?

    The “Basic Navigator” manual states that “For Navigation to work, you must generate a Navigation Mesh and provide a Target for the AI to move to. The BasicNavigator will initialize an instance of PathFindAction.”

    In my prototyping, using a previous version of RAIN{Indie}m I was able to simply define a Waypoint Network and the AI would navigate using that specified network. So far in my prelim tests I cannot replicate this behaviour and the AI simply ignore the Waypoint Network and moves directly towards the path target.

    So I just wanted to confirm that Waypoint Networks can still be used without a NavMesh. If that’s the case, then I can continue to debug my scene to determine why the AI is not respecting the Waypoint Network.

    Thanks again for your help.
    Carmine.

    #27197

    GamesOfEdan
    Participant

    After more testing, I can confirm that Waypoint Networks do work without NavMeshes, as I’d previously experienced.
    What I’m seeing is that after the AI calculates a path to the closest waypoint, it then moves off the network to navigate to the final destination (as expected), which in this case is the player. However, if the player moves while the AI is pathing, it won’t recalculate it’s Waypoint Path, continuing to navigate to it’s original final waypoint & then moving off the network. If the player has moved a significant distance, the AI will just traverse thru terrain etc in order to track to the player.
    I think I just need to update the behaviour tree to force the AI to recalculate the Waypoint Path as it’s navigating towards the player. Basically I need it to update its path as the player moves around the scene.

    I’ll continue testing and keep you posted.

    Thank you.

    #27491

    CodersExpo
    Participant

    Hmmmm…you could try setting the Path Target field in the Waypath network node to be the position of the player. Just make sure to check if the position is on the graph. (see script http://rivaltheory.com/forums/topic/waypoint-path-doesnt-work/)

    or…you could use ai.Navigator.RestartPathfindingSearch() if the player moves. Just guessing here 😉

    • This reply was modified 1 year, 1 month ago by  CodersExpo.
    #27501

    GamesOfEdan
    Participant

    Thanks for the suggestions.
    Sincerely appreciated.

    At the moment, I have the NPC traverse to the first detected player location.
    Then it detonates itself. So it no longer exists, and I’ve avoided the problem for now.

    However, a RestartPathfindingSearch() could be useful if I decide to have an NPC that keeps following the player. I’ll remember to try that out in the future.

    One related thing that I’ve also noticed using the Waypoint Network is that the CloseEnoughDistance is not being used as I would have expected. The NPC will move directly on top of the Path Target, rather than stop when it’s within the CloseEnoughDistance. So I’ve had to manually check this inside a parallel node. Maybe I’m doing something wrong here, but in my first workaround I noticed that the ai.Navigator.PathDistanceToTarget() wasn’t returning the distance to the PathTarget, but something else.

    Anyway, I’ll keep playing around & let you know how I get on.

    Thanks again.
    Carmine.

    #27582

    CodersExpo
    Participant

    Try changing the CloseEnoughDistance value in the AIRig on the Motion panel rather than the Move node. Not sure why, but I was not getting the Move node to work either. Maybe we can ask the head honcho 😉

    #27585

    GamesOfEdan
    Participant

    I think I tried that with the same result.

    In any case, I found a simple workaround using a Custom Action. But it was a little confusing at first. When things like that happen, and I cannot see into the code, it’s easy to get confused as to whether I’m making a mistake using the API, or there’s a bug in the library itself.

    Thanks again for all your help.
    It’s very much appreciated.

    #27594

    CodersExpo
    Participant

    I’m trying to confirm with RT if this is a bug or if we are missing something. I’ll let you know what I hear. I’m surprised setting it in the AIRig didn’t work as I had no problems there. The Node SHOULD override the rig IF the value is greater but….again, this is not working for me either. I’ll let you know if I learn anything.

    #27604

    GamesOfEdan
    Participant

    I’ll try setting the AIRig CloseEnoughDistance again to see if I can get the expected result. But for now, I’ve got the Custom Action doing what I need so I’m making progress. I endeavour to retest it when I get a chance.
    Thank you.

    #27977

    CodersExpo
    Participant

    I confirmed this is a bug and is going to be fixed. To work around this problem you can use a custom action to grab the variable assigned by the waypointpath/patrol (as a MoveTarget) and change the close enough distance there before the move node gets it. Sounds like that’s what you may already be doing.

    #28016

    GamesOfEdan
    Participant

    Thanks for getting back to me on this.
    I’ll carry on with my current workaround and look forward to future RAIN updates.

    Again, thank you for all your help.
    Sincerely,
    Carmine.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.