0.C-20509-gce5e825 (tiles)
Build 6123
This issue has actually been around for a while.
Hostile NPCs seem to have clairvoyance. The first sign of this hostile NPC being around was her coming out of nowhere and instantly start shooting at me from 14 tiles away in the dark.
The NPC did NOT have any night vision mutations on her at all, and average perception.
This can be easily recreated by finding an area with darkness (Basements, anywhere outside in the middle of the night, etc), spawning a npc, pissing it off, and trying to hide somewhere out of sight. The NPC will find and kill you no matter what, even if you debug teleport to where it couldn't have possibly seen you. The only way to actually "hide" from a hostile NPC is to keep running away until it's several tiles away (Which should be outside the reality bubble or possibly near the edge of it, haven't tried getting an exact number yet).
For best results, give yourself a Clairvoyance artifact so that you can see the NPC homing on you with laser-perfect accuracy, walls, vehicles, entire houses, and anything else blocking line of sight be damned.
They probably could hear you (though I dunno if they can shoot relying on sounds).
Tried some testing, but I'm not sure if this is enough confirmation:
I create a new character, teleport into the evac shelter basement, and debug-build a small-yet-majestic underground town. I give myself the Clairvoyance Artifact.
There isn't any lighting at all without Clairvoyance. I can see this far in the dark because I have Night Vision and 20 Perception.
I spawn in a test subject 14 tiles away in the dark. She can't see me for sure due to the lack of an exclamation mark next to her name.
I instigate a fight with the test subject by throwing a knife at her in the dark.
She immediately beelined towards me.
I silently teleport somewhere else. She'll never find me here!
The NPC easily tracks me down.
I teleport again. The NPC finds me again.
I teleport to a corner of the evac shelter basement town and spawn several metal doors to hide behind. I wait for an hour and the NPC doesn't move a muscle.
I change one of the locked metal doors to a metal door that isn't locked. The NPC immediately begins moving again and opens the door.
I've found that NPCs will always move towards your location once they're hostile, even if they can't see you in the dark. They only stop once they can't get to you.
That's more than enough I think. Thanks for the thorough and so well illustrated testing.
This seems to be a regression, not merely a bug. In older versions NPCs were restricted by darkness. It may have been an effort to fix the inverse issue were they would ignore you in darkness unless you got too close, and the related issue were they would home in on you if attacked, but would not be able to attack until they were close enough.
Should be clarified that NPCs have to actually turn hostile first before X-ray vision kicks in. This can easily be seen with the Old Guard quest requiring you to kill Hells Raiders Bandits (they're neutral until they see you for some reason).
If you do it at night, they can't see you and won't turn hostile unless they see you or you shoot them. Do it during the day, they see you coming a mile away, turn hostile, and have X-ray vision kick in from that point onwards.
I spent some time looking into this. I think the problem is in npcmove.cpp. I don't know C++, so I'm vague on the details, but I think there should be two different ways that npcs move to the player. Friendly NPCs should use this movement system to unrealistically lock on the player and catch up. I think there should be a different system for hostile NPCs that is either broken or missing. Specifically the trouble is with "look_for_player(g->u)" I don't understand that parenthetical, but the implementation of "look_for_player" contains this note:
" // The part below is not implemented properly"
Hopefully this saves the next person some detective work.
Most helpful comment
Tried some testing, but I'm not sure if this is enough confirmation:
I create a new character, teleport into the evac shelter basement, and debug-build a small-yet-majestic underground town. I give myself the Clairvoyance Artifact.
There isn't any lighting at all without Clairvoyance. I can see this far in the dark because I have Night Vision and 20 Perception.
I spawn in a test subject 14 tiles away in the dark. She can't see me for sure due to the lack of an exclamation mark next to her name.
I instigate a fight with the test subject by throwing a knife at her in the dark.
She immediately beelined towards me.
I silently teleport somewhere else. She'll never find me here!
The NPC easily tracks me down.
I teleport again. The NPC finds me again.
I teleport to a corner of the evac shelter basement town and spawn several metal doors to hide behind. I wait for an hour and the NPC doesn't move a muscle.
I change one of the locked metal doors to a metal door that isn't locked. The NPC immediately begins moving again and opens the door.
I've found that NPCs will always move towards your location once they're hostile, even if they can't see you in the dark. They only stop once they can't get to you.