Jump to content
The Dark Mod Forums

Recommended Posts

Posted

I'm working on a map right now, and I'm having a problem with fleeing NPCs going through doors.

NPCs following path_corners have no difficulty navigating the walkmesh and opening/closing doors. However, once they spot the player (and aren't armed)  they can't open a door to save their life. They flee, but they ignore doors, just running in place, face-first into the door.

I'm not certain how to address this behavior, since they obviously can handle doors under normal circumstances. Is there a type of path to help guide fleeing NPCs? Or is there something else I could do to troubleshoot this?

Posted
1 hour ago, Jnon said:

I'm working on a map right now, and I'm having a problem with fleeing NPCs going through doors.

NPCs following path_corners have no difficulty navigating the walkmesh and opening/closing doors. However, once they spot the player (and aren't armed)  they can't open a door to save their life. They flee, but they ignore doors, just running in place, face-first into the door.

I'm not certain how to address this behavior, since they obviously can handle doors under normal circumstances. Is there a type of path to help guide fleeing NPCs? Or is there something else I could do to troubleshoot this?

Try the entity "Path Flee Point".  If my recollection is correct, flee points must not be targeted from the AIs; just place it in the location you want AI to flee to.

Posted

I actually do have a Path Flee Point set outside the basement he's in, which he seems to want to flee to. The door is just standing in his way, and he refuses to open it while fleeing.

Interestingly, if I open the door for him while he's fleeing, he then passes through it and runs to the flee point as expected. The door, and the act of opening it, seems to be the major issue. I seem to recall reading that there was a Door Open Point path somewhere in the editor? Or am I misremembering that.

Posted
7 minutes ago, Jnon said:

I actually do have a Path Flee Point set outside the basement he's in, which he seems to want to flee to. The door is just standing in his way, and he refuses to open it while fleeing.

Interestingly, if I open the door for him while he's fleeing, he then passes through it and runs to the flee point as expected. The door, and the act of opening it, seems to be the major issue. I seem to recall reading that there was a Door Open Point path somewhere in the editor? Or am I misremembering that.

Have your tried the following cvars for further debugging?

  • tdm_ai_showdest
  • tdm_ai_showtasks
Posted (edited)
1 hour ago, JackFarmer said:

Have your tried the following cvars for further debugging?

  • tdm_ai_showdest
  • tdm_ai_showtasks

Using this yields interesting results.  If I place a path_corner outside, the NPC navigates with no difficult. Movement to Path Corner, followed by HandleDoor to open and close behind him, then the same again if he goes back in.

However, if I panic him while he's inside, he goes to Flee mode, with his target set as the expected Flee Point... however, he never enters a HandleDoor state, so keeps bumping into the door. For pathfinding, he's acting like the door isn't there, but for collision purposes it is, so he can't move.

Even more interesting, under certain conditions (not sure yet which) if I try opening the door for him mid-Flee, the door remains stuck in the open position. It remains frobbable, and the door handle rotates when I click on it, but it no longer closes. I still need to narrow down what circumstances trigger this, though.

EDIT: if I leave him stuck long enough, he eventually enters "Resolve Movement Block" state, but never resolves it, and rotates back to "Flee Task"

EDIT 2: Even weirder, if I leave his stuck like this, then open the door, the door opens but the visportal (sometimes) ignores the door open state, and blocks rendering of the area outside.

Edited by Jnon
Posted (edited)
18 minutes ago, Jnon said:

Using this yields interesting results.  If I place a path_corner outside, the NPC navigates with no difficult. Movement to Path Corner, followed by HandleDoor to open and close behind him, then the same again if he goes back in.

However, if I panic him while he's inside, he goes to Flee mode, with his target set as the expected Flee Point... however, he never enters a HandleDoor state, so keeps bumping into the door. For pathfinding, he's acting like the door isn't there, but for collision purposes it is, so he can't move.

Even more interesting, under certain conditions (not sure yet which) if I try opening the door for him mid-Flee, the door remains stuck in the open position. It remains frobbable, and the door handle rotates when I click on it, but it no longer closes. I still need to narrow down what circumstances trigger this, though.

EDIT: if I leave him stuck long enough, he eventually enters "Resolve Movement Block" state, but never resolves it, and rotates back to "Flee Task"

EDIT 2: Even weirder, if I leave his stuck like this, then open the door, the door opens but the visportal (sometimes) ignores the door open state, and blocks rendering of the area outside.

Hm...when in flee mode, there is something blocked?

You can try

tdm_ai_debug_blocked

This "enables a visualization of the blocking object and the AI direction arrow" (info provided by nbohr; I have never tried this cvar till now).

Other things you could try:

  • check if portal is snapped to grid on the relevant two axises
  • shift the position of the portal on the non-relevant axis just a little bit
  • rotate the door entity so that the door knob is now on the other side (maybe you have to invert rotation on the door then if the hallway is too narrow).

I know, this sounds trivial, but doing so sometimes works wonders.

 

 

Edited by JackFarmer
Posted

I tried snapping visportals to grid, and I changed rotation on the door in spawnargs (changing physical position of the door would be very difficult as it would block off the passage based on the layout right now). This seems to have partially solved the problem... if the door opens outwards instead of inwards, the NPC can now sometimes handle the door and escape as expected.

If he's panicked while in close proximity to the door, he escapes just fine, though he does have the odd behavior of walking calmly to the door, opening it, stepping outside, and then running to escape. However, if I panic him while he's far away from the door, he starts running, then gets stuck on the door as before. Something about the Flee state seems to make him stop recognizing doors.

tdm_ai_debug_blocked was a little helpful. He seems to count as NotBlocked while he's running into the door, but it briefly switches to "PossiblyBlocked" before going back to NotBlocked. Occasionally the door gets framed in red, but also it frames a couple of spots outside that seem unrelated. Red outlines appear very briefly, though, and vanish after only a moment. The main state seems to be 90% "NotBlocked", with 10% flickering briefly into "PossiblyBlocked".

I'm starting to think I should just remove the NPC completely.. I must have done something weird with the brushes in the area that makes the AI freak out when trying to navigate it in Flee mode.

Posted
11 minutes ago, Jnon said:

I tried snapping visportals to grid, and I changed rotation on the door in spawnargs (changing physical position of the door would be very difficult as it would block off the passage based on the layout right now). This seems to have partially solved the problem... if the door opens outwards instead of inwards, the NPC can now sometimes handle the door and escape as expected.

If he's panicked while in close proximity to the door, he escapes just fine, though he does have the odd behavior of walking calmly to the door, opening it, stepping outside, and then running to escape. However, if I panic him while he's far away from the door, he starts running, then gets stuck on the door as before. Something about the Flee state seems to make him stop recognizing doors.

tdm_ai_debug_blocked was a little helpful. He seems to count as NotBlocked while he's running into the door, but it briefly switches to "PossiblyBlocked" before going back to NotBlocked. Occasionally the door gets framed in red, but also it frames a couple of spots outside that seem unrelated. Red outlines appear very briefly, though, and vanish after only a moment. The main state seems to be 90% "NotBlocked", with 10% flickering briefly into "PossiblyBlocked".

I'm starting to think I should just remove the NPC completely.. I must have done something weird with the brushes in the area that makes the AI freak out when trying to navigate it in Flee mode.

You could try to replace the rotating door with a sliding door and check whether this makes a difference.

If that does not help and it is not vital for gameplay, then you might consider deleting the door entity completely and simply leave a door frame.

  • Like 1
Posted

For now, I've settled to swapping the unarmed NPC for an armed one. If his default reaction to the player is Combat, everything seems to work normally (he actually pathfinds his way through the door to chase the player easily this way).

Thanks for the advice, maybe I'll puzzle this out later.

Posted (edited)

Maybe this needs a bugtracker? Seems to me a serious ai bug.

I also think we need proper animation for ai opening doors fast. Well actually aparently there is a way to increase the ai animation speed:

On 6/30/2022 at 9:20 PM, Obsttorte said:
float setAnimRate(int channel, string animName, float rate)
sets the animation speed of the named anim on the respective channel to the specified value. 
returns 1 on success, -1 otherwise
negative values are not allowed as they lead to insta-death (why ever)

Not sure if that would look good.

Edited by datiswous

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Xolvix

      Dammit there are too many missions available now. That's what I get for being away for so long. Such a first-world problem.
      · 0 replies
    • DeTeEff

      The best thing about not mapping more than like every other year is the awesome feeling to see how far TDM has gotten in all appartments. I can just create some parallaxing cobblestones and walk to and fro and just let the jaw drop
      · 2 replies
    • Ansome

      Happy Halloween, TDM folks!
      · 1 reply
    • Acolytesix  »  nbohr1more

      Hey, was trying to use the TDM_Update.exe file, but when I do it doesn't do anything! It just goes back to 2.12. I'm trying to run Luitenant 4, but it won't update, so I can't play it. What am I doing wrong?
      · 2 replies
    • The Black Arrow

      Been away for quite a long time, didn't have much free time sadly, but the little that I had I was able to play a Romhack for Ocarina of Time called "Sands of Time".
      It's great, fun, rather hard but too but I like it (except when it's way too tedious, only some parts are, not all of them)
      Although the reason I'm sharing this is...Listen to the music, I've timestamped it to 27:56, it's titled "Memories Lost".
      Doesn't it sound so serene, so melodic...So Thief-like? It's fantastic, I love it, it reminded me of Thief and how much I want to get back to it, so hopefully this month or the next, I will have a lot of free time to play it.
      I can't wait to try that new big Thief campaign, The Black Parade, it seems to be promising.
      No spoilers please, but can someone tell me if it has horror elements? Or better yet, horror mission...Or even missionS?
       
      · 1 reply
×
×
  • Create New...