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

    • Goblin of Akenash

      Goblin-Secrets episode 2 is out now!
       
      · 3 replies
    • Airship-Ballet

      https://www.twitch.tv/airshipballet2 There was a mapping stream here, it's gone now.
      · 8 replies
    • peter_spy

      Stumbled upon a documentary on Enki Bilal, he is one of the most influential comic book artists of my adolescence. English auto-subtitles is rubbish, so you might need to brush up on your French
      · 3 replies
    • Goblin of Akenash

      Today I did a bit of an experiment! I wanted to see if I could get a dark radiant map into garry's mod, the quickest and dirtiest and not-workiest method is "OBJ2VMF" which converts .obj models into VMF files for hammer to then compile, the way its supposed to work is that you input a 6 sided cube and it turns it into a 6 brush room (not exactly ideal for this since that's not how TDM maps work, this honestly would have been a better idea with any thief game from 1 to the one from 2014 since they all work like that) so what ended up happening was that for every brush there was 6 brushes would be ontop of that almost inflating everything in the map like a balloon, map scale was also an issue that I couldn't fine-tune easily either so the scale is way off ontop of everything being inflated making the space inside the map very tiny! anyways heres the result of that and it looks almost nothing like footloose (plus I did add a bunch of random props in gmod for funsies and better visibility since the process involved replacing all the textures with dev ones that look very flat when in full-bright)

      https://streamable.com/ctmh58

      (streamable link will expire in 2 days but I'll have a spoken word version of this post along side the video and other fun images relating to the bsp inflation effect in the next "Goblin Secrets" video next month)
      · 0 replies
    • Frost_Salamander

      @taaaki Wiki seems broken. Main page works but click any link and:

      · 2 replies
×
×
  • Create New...