Forum rules - please read before posting.

Feature Request: NPC Path Route Failure

Hi again, I'm back with another request :)
I wondered if it'd be a good idea to implement a way to detect if an NPC is failing to get to their node? 

"I'm using the move along path" thing with the "random" option in 3D and several NPCs use the same path. I tried having several different paths but ultimately I always end up having the same problem-- in smaller paths. NPCs regularly collide with each other, and if they do they will just keep walking into each other until the end of time.

I was thinking perhaps the game can detect after a certain amount of seconds if 2 or more NPCs aren't moving forward/ hasn't reached the node etc, then those NPCs in question stop, and are both given another random node to go to instead?

Comments

  • What's the actual goal, here?  To get NPCs to all move randomly between the same set of nodes?

    Having any character consider a pathfind as "failing" opens up something of a can of worms, because often they'll get stuck on something temporarily and classify this as having failed when they shouldn't do.  It's also the case that characters will still move - albeit slightly - when they appear stuck, making it difficult to judge when a "fail" has truly occured.

    What's your pathfinding method?  If it's Unity Navigation, try adding on both the NavMesh Agent and NavMesh Agent Integration components to your NPCs.  That will cause them to use Unity's built-in navigation movement system, and you can then also make use of Unity's NavMesh Obstacle component.

    Then, giving a non-zero Pathfind update time (s) in the Settings Manager will cause NPCs to re-evaluate their pathfinding every X seconds, which - combined with the NavMesh Agent system - should give you better results.
  • edited November 2017
    Hi Chris, I had no idea that was an option, thank you. I've attached NavMesh agent and NavMesh integration on the NPCS, I have a problem, the characters are still trying to walk into a place where they shouldn't. There's a block in the middle of the 'road' and they are still trying to talk into it. I put the navmesh obstacle on it and did the 'not walkable' bake and they're still doing it?
    Thank you  ! :)
  • When moving along a path, they won't do any pathfinding calculations - they'll literally move toward their desination node in a straight line.

    For dynamic pathfinding, you'll have to use the Character: Move to point Action instead - you can implement a Variable: Check random number Action if you want to have them move randomly between different points .
  • edited November 2017
    Thanks Chris, I did this and it works perfectly except for when changing scenes and back. If I go to a different scene and come back again, then everyone stands on their starting markers and.....stays there.

    EDIT: Nevermind that was my fault, I had variables that only let them move if the go-to marker wasn't taken and I didn't reset them to false when the scene loaded.

    Thanks a lot Chris! :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.