CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.64k stars 4.18k forks source link

NPCs ignore relatively weak monsters until they are extremely close. #14888

Closed kevingranade closed 5 years ago

kevingranade commented 8 years ago

Spawn a friendly NPC with a decent ranged weapon and some ammo, give it decent ranged stats/skills. Set the NPC engagement rule to something relatively permissive, like "engage nearby" or "engage everything". Spawn a regular zombie at ~20 squares away from the NPC. Expected: NPC waits until it has a decent chance of hitting and starts shooting the zombie as it approaches. Actual: NPC ignores zombie until it is about 2 squares away, then unloads on it.

The reason seems to be the code in npc::choose_monster_target(), which calculates a priority score based on the monster and its distance from the NPC (scaled by enemy speed, which is a nice touch). This code produces a very low score for regular zombies and a lot of other weak enemies, meaning the NPC is literally unaware of their presence until they are very close.

chaosvolt commented 8 years ago

I can see this causing problems, yeah.

But on the other hand, that's amusingly consistent with how I play when using a ranged weapon. Always gotta have that maxed-out steadiness.

kevingranade commented 8 years ago

While looking at that code it made me realize it would be nice for npcs to have a personality aspect or similar that influences when they start firing, more calm ones could wait to the last second, more nervous types might not even spend the time to aim properly.

chaosvolt commented 8 years ago

That does sound like it might be an interesting occurrence.

Do any of the existing NPC stats sound useful for determining that? I think they have a...confidence or something value, or maybe fear. Not sure. If an existing stat can be used for that, that allows for the possibility of NPCs getting worn down and unnerved until they get an itchy trigger finger, rather than it being a fixed part of their personality.

Night-Pryanik commented 5 years ago

Well, tested on latest experimental as of April 07 2019.

Gave NPC M14, set it to 10 in all skills, set her engagement rules to engage all enemies and fire when it's convenient. изображение

изображение

The distance at which she started to fire is 6, which is definitely not 2 tiles away and seems to be just like fine distance for that kind of monster.

Should be closed?