CleverRaven / Cataclysm-DDA

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

Roadmap to managing friendly fire better #73570

Open I-am-Erk opened 5 months ago

I-am-Erk commented 5 months ago

Is your feature request related to a problem? Please describe.

Currently, the friendly fire assessment model for NPCs is mostly nonexistent. If you hit an allied NPC, for any reason, they'll either attack you or run away from you. As we get more robust NPC followers with nice long storylines and hundreds of lines of dialogue and reasons to trust you, this gets increasingly silly. We need a proper way to assess whether or not a friendly fire attack was: 1) harmless, eg firing a bb gun into melee where your friend is dressed in head-to-toe plate armour 2) justifiably risky, eg. firing into a melee because your friend is about to die if you don't 3) bad but forgiveable, eg. hitting your old buddy Liam with a polearm in melee one time 4) bad and unforgiveable, eg. stabbing your old buddy Liam repeatedly for no reason because you're an edgelord who treats all NPCs as walking meat, seriously why, food is not scarce.

Solution you would like.

NPCs should use a few different stats to decide if they care about being hit in friendly fire. Specifically:

This leads me to a general, rough plan of attack: I made a flowchart. I hope it's less, not more, confusing than my usual writeup...

Untitled Diagram

As you can see, the first branch point is based on the NPC's assessment of current danger. An NPC that figures they're in a truly desperate situation is going to be much more tolerant of you making an attack that doesn't hurt them. However, all these checks are going to rely significantly on how many times this has happened before,

When we log "benign" friendly fire, I'd like the NPC to use a 3 strikes system. The first time it logs a benign hit, it has no other effects. It's not used in calculations to see if the NPC decides you suck, it doesn't impact trust. This is most likely to be a low-risk shot that happened to hit them and didn't cause damage. The second time, they still don't care. The third time, they log it exactly as if it were a "dangerous" friendly fire incident, and from this point on, they no longer use the 'benign' friendly fire pathway. They now consider you reckless, because you've probably been using them as bait. That's rude.

When we log "dangerous" friendly fire, the total count of the number of times you've hit them will constantly ramp up. If you've hurt yusuke significantly by shooting into melee before, he's going to remember it even if it happens a year later. People don't like being shot. Also note that a single dangerous friendly fire event will have a significant negative impact on trust that regains over a few days; this should help to keep your NPC from letting you beat on them no matter how kind and forgiving they are.


To come: I'll post some concept calculations for the rolls depicted in yellow in the chart.

Describe alternatives you have considered.

The system doesn't have to be this complicated, but I don't think this is really all that much to code, so I won't propose a bunch of simpler versions of the same.

Additional context

It might be worth considering a special flag for NPCs that will never leave you, to use for Liam in specific, or at least that just causes them to run away temporarily... or we could just hard code liam to be very trusting and altruistic.

IdleSol commented 5 months ago

Is it even possible to accidentally hit an NPC in melee? I've almost never taken them with me, so I don't know.

Maybe we should start with the type of damage? I.e. any hit done in melee is considered an act of aggression.

The only exception to this is if you and the NPC share some set of traits. Brawler + Killer Drive or Uncaring or something else = you can punch each other in the face without damaging the relationship.

b3brodie commented 5 months ago

Is it even possible to accidentally hit an NPC in melee? I've almost never taken them with me, so I don't know.

Maybe we should start with the type of damage? I.e. any hit done in melee is considered an act of aggression.

The only exception to this is if you and the NPC share some set of traits. Brawler + Killer Drive or Uncaring or something else = you can punch each other in the face without damaging the relationship.

Reach weapons are very easy to hit friendly npcs with. If there's an enemy on the other side of the npc then pressing tab will automatically attack towards the enemy but hit the npc.

I-am-Erk commented 5 months ago

Yes, almost all my friendly fire hits are in melee.

That's also a separate issue, we should probably disable that. Polearms aren't ray attacks, and our current settings make phalanxes impossible

DSeyka commented 5 months ago

pressing tab will automatically attack towards the enemy but hit the npc

I seem to remember getting a popup warning about accidental damage in this particular case.

Void-Seeker commented 5 months ago

It would be immersive if sometimes, when NPC's concern reaches certain point, they initiate a dialog to the player after combat where they would demand explanation, and the player can defend their behavior with some chance rolls, similar to ones during recruitment. Successful saves would reduce NPC suspicion a bit.

I-am-Erk commented 5 months ago

Yes, I'd love to have that at some point. If this was sufficiently plugged in to eocs it could work.

PatrikLundell commented 5 months ago

I think a strict count is a bit rigid, even if there's a cool off period for some of it. There's a significant difference between getting hit in every combat spaced apart and getting hit every 100:th combat even if it's within a single week. A rigid count will cause companions to expire as useful combat companions as their hit limit gets degraded over time.

However, it would definitely be an improvement if they became useful at all (the last time I took someone into combat it was required by a quest, and the idiot climbed a fence, charged and got itself killed, and since the idiot wasn't a companion I couldn't even give it any orders, in particular to stay put and not get involved into the combat at all). Companions mustn't charge enemies to pulp corpses near those enemies, and they must be capable of retreating at a rate faster than a sightseeing stroll.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.