Home Unreal Engine
The BRAWL² Tournament Challenge has been announced!

It starts May 12, and ends Sept 12. Let's see what you got!

https://polycount.com/discussion/237047/the-brawl²-tournament

NPCs and doorways

polycounter lvl 7
Offline / Send Message
BTDarmstad polycounter lvl 7

Hi! I've got a few issues when it comes to sending points of interest to NPCs that are located in doorways. There seems to be an issue where, as a result of blocking off the navmesh (Single door doorways are too narrow for the regular navmesh no matter what settings I use, so I'm using smart links for all doorways for consistency), whenever there is an actor or a point of interest the NPC should go to in a doorway (if the player itself is spotted in a doorway, or makes noise in a doorway), it will get stuck in a loop trying to walk to a place it can't access. Would it be too much to ask that it just tries to go to the closest point on the navmesh? 


Anyway, for the noise (the NPC goes to investigate noise), I've tried some of those nodes that get a random point in navigable distance, but it appears to fire in all directions instead, and make several noises for whatever reason. The way I've done it currently is to create two scene components that make noise on each side of the doorway, above reachable navmesh. This could work, but I don't necessarily get the best result this way. The best way would possibly be choosing one of the two noises at random when received, and either go through the doorway entirely to investigate, or stop just shy of it - NOT stopping and awkwardly bending in the middle of the doorway. However, the behaviour tree will treat these two points of interest the same, and I don't know which one it will pick since there are two. Maybe, if the noise is close to a doorway, I could somehow tell the NPC to ignore the point of interest and keep walking for a couple of seconds - but not back through the same doorway.


This issue is at its worst, however, when the NPC detects the player while the player is in a doorway. Until the player moves out of the doorway, which only uses a smart link and has no navmesh underneath it, the NPC will be stuck in a loop until the player moves. This doesn’t seem to happen when the NPC is already chasing the player, only upon state change for whatever reason.


Sometimes the NPC will also randomly stop in a doorway for a couple of seconds while chasing the player. It works almost every time, and I can never reliably recreate it. Whether it's caused by the smart links or the player's current location, is beyond me. I'm stumped.


https://www.youtube.com/watch?v=h-zHhoVeIMk

Replies

  • BTDarmstad
    Offline / Send Message
    BTDarmstad polycounter lvl 7
    Oh... Nevermind, I may have ranted a little too soon. It turns out that unchecking these two did the trick. I get what the top one means, but project goal location? It fixes almost every instance of the AI getting stuck in doorways. Now I'm only experiencing it it if the NPC sees the player, in a doorway, at a shallow angle. It still gets momentarily stuck in doorways seemingly at random, while chasing the player. I will update the thread if I find a way to reproduce it, or at least record it happening.


  • iam717
    Offline / Send Message
    iam717 polycounter
    Just a quick side note, if you wanted to go ask other devs (not on p.c.) say youtube videos or channels(as an example), about how their devs worked around these issues you might turn up some helpful, time saving feedback, that is IF they respond to it.  Alternatively some peeps that have already fixed this could also just chime in and address this as well, then can be added to wiki.  Glad you figured it out and posted 1 solution.
  • BTDarmstad
    Offline / Send Message
    BTDarmstad polycounter lvl 7
    @iam717
    Thanks, will keep that in mind. I have a tendency to want strange things people don't seem to bother with for small projects - or they have a setup that wouldn't work for the type of game I'm going for. If doorways cause problems, a developer may just not have doors that NPCs go through at all. So I end up having trouble finding appropriate solutions to certain things. I have this horrible habit of posting threads as a last resort, so I'm already somewhat agitated by a persisting problem. I try  :3
  • Eric Chadwick
    You may also want to consider widening the door opening a bit, and checking the size of the npc physics proxy.

    This was for a custom engine, but might be applicable here?

  • BTDarmstad
    Offline / Send Message
    BTDarmstad polycounter lvl 7
    @Eric Chadwick Fair point, currently the collision has not affected the monster moving through doors with the exception of the capsule collider being too tall. So I make it technically crouch by halving the capsule collider when a low ceiling is detected, along with an additive animation that makes the monster bend down (which I have to drastically optimize, but that's a different problem entirely).

    However, I still have those freak occurrences where the monster gets stuck in an AI loop if it detects the player while the monster in a doorway, even when I have ticked those boxes in the behavior tree. I'm currently in the middle of swapping the collision of the entire level with custom simple collision, AND swapping the spectator camera with an actual playable VR character, so the project is not in a good state to showcase the issue right now, but if it persists, I'll try to capture some video of those AI loops.
Sign In or Register to comment.