NPCs and Michael Myers = What they have in common

So I’m playing the latest experimental. Testing is fun and all. I came across a Military Base surrounded by mines and Raider/Bandits.

Well I’m up for some action and they catch sight of me. They give chase. They chase…and chase…and keep chasing me. I find myself walking through a dead infested town and before I knew it the little bandit turds get swarmed. Not that I mind. But the problem I noticed I did mind. They ignored attacking and defending against about 30 mobs. Even tearing into them, they ignored the mobs. Just because they could see me and were giving chase like Halloween’s Michael Myers!

This was rather a bother since they both had machine rifles and I kept having to stay out of their range.

I also figured out. That simply walking behind a tree or building seemed to make them give up. As if to assume losing sight of me hiding behind 1 lone tree in an empty field was able to “givem the slip”.

I understand NPCs are piss poor and all. But that seems exceptionally poor that they could lose an arm and be like "THERE HE IS FELLAS! LETS GITTEM!!! arm torn off YEEEHHAAAA!!! keeps coming after player character.

Please tell me I’m not the only one seeing this. Any hope on the horizon this will change? :slight_smile:

NPCs don’t know how to retreat. I have a proposal to address it, but like everything else I’m doing these days, doing one moderately complex thing requires first doing two dozen other moderately complex things first. I’m already doing four dozen other moderately complex things and I don’t want to get further distracted from them.

Then I tip my hat to you for the response. I was hoping it was known. =D

So no idea how to get side tracked. Heh. I should think assuming you haven’t thought of it already. That the NPC should have a radious buffer “if” mob gets within x tile nearby to defend + percetage of retreat “if” out numbered".

Am I close? :slight_smile:

See https://github.com/CleverRaven/Cataclysm-DDA/issues/25687

In short, the NPC will estimate how long it will take him and his allies to kill all the enemies in sight, and how long it will take the enemies in sight to kill him. If the ratio of time to kill them to time to kill him is too high, the NPC will perform emergency actions, which will include fleeing if he thinks he’s faster than the enemy.

While the actual algorithm is simple enough, gathering the time to kill numbers requires reworking a bunch of code.

Sounds neat. If I had the head for coding I’d do it up. Sorry I can’t. I only grasp the basics. Not the actual how too.