-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPCs Will Forgive the Player Over Time #75535
base: master
Are you sure you want to change the base?
Conversation
Does the anger reduction apply to literally all NPCs? Won't this eventually make bandits nonhostile? |
I don't believe that to be the case. Bandits attack not because they are "angry" (well… technically they do, but that's not the primary source) but because their faction is hostile towards player's. AFAICR, they are "Ignoring" initially and only turn hostile if a player approaches them. So, it is proximity that is the source of their "anger". No amount of waiting will ever restore their faction's attitude to neutral. But yes, if a bandit is "angered" but a player manages to flee then it is a sound decision on the bandit's part to eventually forget about its "lost prey", calm down and return to its hiding place for other opportunities. |
Do we really want to give every NPCs EOC fueled amnesia? |
If only there was a way to talk to hostile NPCs and have a percent chance to defuse their hostility, if you fail then have to run away and wait out a cooldown to try again much like asking an NPC to become a follower. Maybe the chance would be increasingly more difficult with every failed attempt but could slightly increase the chance by dropping your weapon or offering them something valuable from your inventory. |
There's a pretty big difference between, "stop being angry at someone" presumably for a social gaffe or something, and "forget someone tried to kill you". The minimum thing I could see working for this is tracking "anger from social sources" seperately from "anger from combat actions" and "anger from faction triggers", the social anger could decay over time but not the combat anger or faction anger. |
I'm not clear how what you changed relates to what I suggested. I was saying add two different variables that are updated seperately. Also on further review values related to anger don't have a very wide range, one point an hour seems excessively fast. |
I decided to only have this EOC track social anger and leave combat anger for something different.
The EOC doesn't trigger for one point every hour, it just checks NPC anger each hour and sees if the forgiveness EOC has been queued or not. The actual forgiveness occurs several days after that. |
This needs a lot more grounding and clarity about what's happening and why, and I'm thinking EOC is not where it belongs. The original goal was "hostile NPCs should stop being hostile", but we're dropping that because the #1 reason for that is "the player physically attacked you", which I'm asserting isn't a forgettable event. Now it's, if you (repeatedly?) push a NPC too far they might, what not want to talk to you? What social interactions are you having that are angering NPCs enough for us to track it, but little enough that they're just going to forget about it in a few days? That's the other layer here, I don't think simply decrementing a value is a reasonable approach here, if we want anger-inducing actions to have a "life cycle", we need to do something like stuff anger-causing events on a list, where they may or may not decay, depending on their details, not just "ehh people forget so eventually we're back at a blank slate no matter what the cause was". |
That's the sort of thing I'm tracking with this, social gaffes. This would include things like being generally unpleasant towards NPC's in conversations (name calling, telling someone to go fuck themselves, etc.), attempting to intimidate somebody, failing certain missions of small scale (i.e not doing something in time), and other things of that nature. #75392 demonstrates some of what I was going for and what you previously mentioned, with certain NPC's refusing to talk to you above certain anger thresholds. I made this partially as a way to avoid permanent lockouts with NPC's in that PR, so that you can talk to them again after some time.
What if some conversation topics which currently add anger at a flat rate just ran an EOC linked these changes, assigning a flag that tracks a reason for the anger gain? Perhaps 'minor_offense', 'personal_affront', 'betrayal', and so on. These flags would then just modify the decay rate, increasing for more serious offenses. If the NPC has enough anger to become flat-out hostile, then no anger decay queues are run. What do you think about this method? |
I'm concerned about several aspects of this: Lumping together failure to deliver on missions, intentionally giving offence, threats/intimidation, "just saying the wrong thing", etc. These are all very different interactions you would expect to have very different consequences, even if recovery is scaled differently it feels weird that these are being scored on the same axis in the first place. I'll repeat, I'm concerned about doubling down in EoC here, that is not what it's for, this is far more complex and fundamental than what EoC is supposed to handle in the game and I'm not comfortable extending things in the direction you're talking them. Both the narrative and game purpose here are weak, it's better to be forgiving of the player acting badly indefinitely? No it isn't. It's this something people uniformly do? Not at all. I'm kind of thinking this would only be suitable for a system where immediately after an anger causing event the npc has some increase to their anger score, then after some time it might drop to 1/2 or 1/4 or so if the original, basically relatively small events could cause the npc to stop talking to you immediately or even kick you out of a settlement, they might calm down over time but you never fully erase the impact. Then the next time it could trigger an even worse immediate response, and with enough times you're simply cut out. I think that's the thing that bugs me the most here, fully erasing the impact of bad behavior doesn't make sense. If you're going to have ways explicitly outlined to make npcs angry, you're going to eventually pass a point of no return. Otherwise why even have them get angry in the first place, this should be serious stuff, not window dressing. |
I am concerned about this scenario: a player has met a new NPC (not a bandit, just a survivor).This NPC "decided" that the PC is weak and demanded to surrender. The player refused and failed skill/stat check. Now NPC is "attacking to kill". In this case PC did nothing "irredeemable" (apart refusing to comply with robbery) but NPC now thinks it is OK and totally justifiable to murder PC. :( And I repeat, that NPC is not a bandit: if reload earlier save and succeed in skill/stat check then you can learn that this NPC was just an office clerk and actually wanted to harvest some cattails. Shall NPC (that caused the conflict in the first place) be able to "forgive" PC in this case? |
You are asking about a completely unrelated scenario. This isn't related to the proposed mechanic, the way it works just needs to be overhauled. Since you brought it up just a brief outline of the problems: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I previously said "I'm thinking EOC is not where it belongs."
This is a very big deal, we can NOT have core systems like this defined entirely in EOCs.
Would it be possible to have some parts of this defined in EOC's, and some in C++, or is it preferable to have all of the existing code for this converted into C++? If the former is true, I'm planning to keep (most of) the effects defined in an EOC and converting the triggers to C++, in the form of a new Also, how much JSON is usually acceptable for core systems to rely on before C++ is needed? |
The whole thing with multiple types of anger needs to be in code. |
Summary
Content "NPCs will forgive the player over time."
Purpose of change
For a very long time now, once an NPC became hostile to the player, there was no way for them to calm down, remaining angry forever. Under certain circumstances, this blocked off many actions with that NPC and was also unrealistic; people don't stay mad forever. As such, I decided it was time to change that.
Describe the solution
Whenever an NPC would gain anger against the player, an EOC is run to determine how much anger they should gain and what "type" of anger it is.
Anger can have four different kinds associated with it:
Minor Offenses - These cover small blunders which are not too serious, such as accidentally insulting someone, being insensitive without realizing it, or otherwise unintentionally upsetting someone, the little things in life. This can also cover minor name-calling.
Personal Affronts - These cover intentionally insulting actions the player commits against the NPC, such as insults, directed vulgarity, personal betrayal, nonviolent theft, or deceitful behavior. It's intentionally doing something to significantly harm someone, not covered by other categories.
Intimidation - This covers any attempt, successful or not, at intimidating or strong-arming an NPC for any reason. This can include the forced join options for recruiting companions, violent theft not involving injury (sticking a gun to someone's side and demanding money), or threatening to detonate mininukes if demands aren't met.
Mission Failure - This covers anger gain for failing a mission given by the NPC, be it anything from personal favors to critical life-and-death jobs.
Anger gain works exactly the same as using
opinion
to change it, but anger type determines how long it takes for the NPC to forgive you for it. Minor offenses are the shortest, then it goes up from personal affronts, intimidation, then mission failure. The base rates of forgiveness for these types are 1/2/3/5 days, which is increased by the NPC's current anger and lowered by their friendliness and trust in you. This makes good friends more inclined to forgive you faster than random strangers, and this effect becomes faster the more anger is forgiven.They are only forgiving to a point, however, as gaining anger has it only decay to a percentage (listed further down) of its original value, leaving a permanent consequence for naughty behavior. This makes repeated offenses have greater impact on your relations with that character, and makes it take longer for subsequent offenses to be forgiven. Additionally, if their anger passes a threshold of 20 for any reason, then they will no longer forgive you for any reason. This is usually where the NPC becomes hostile, which is why I chose this threshold.
Small anger gain values scale differently, they are calculated normally and saved to their own personal value. When they exceed 1, and the NPC gains more anger for whatever reason, then this is worked into the normal forgiveness values. This means that small increases in anger will still have a permanent effect but require several repeated gains to leave permanent impact.
NPCs can also have a few personality traits related to how forgiving they are:
Forgiving - The NPC's gained anger will decay to 1/6th of its original value, they don't hold much of a grudge.
Lenient - This NPC is very much inclined to turn the other cheek, and anger will decay to 1/8th of the original value.
Begrudging - This NPC remembers slights very easily, and anger will only decay to 1/2 of the original value.
70% of the time, NPCs won't have any of these traits, and anger will decay down to the standard 1/4th of the original value. Forgiving is the most common of the traits, appearing 18% of the time, followed by Begrudging at 9% and Lenient at 3%. These are distributed as part of the starting traits group.
Note that all of these values are rounded. For example, gaining 6 anger with a 1/4th decay value returns 4.5, which is rounded to 5, leaving the NPC with 1 anger. *
Note, this only extends to personal anger. If an NPC tries to kill you or you attack the NPC, they will remain hostile indefinitely in this way. Faction-based anger is also unaffected and will not lower over time, so making a whole faction hostile to you is a permanent decision and unreversible with normal gameplay. Factions which are predisposed to hostility, like the Hell's Raiders, will stay hostile forever.
Describe alternatives you've considered
*Instead of rounding the anger decay rates, floor them instead. This leaves more anger left over from interactions, like the previous example of 6 now leaving 2 anger left over instead of 1. I thought this might be leaning on the harsh side for higher gains, but I also don't want to make NPC's too forgiving either.
Splitting up some sub-categories from anger types to be their own separate thing, like dividing theft (nonviolent and violent) into its own category, or lying into its own. I've also considered splitting mission failure into different categories, based on why you failed the mission in question.
Having the various types of anger decay to different percentages. Say, minor offenses would work as they do now, defaulting to 1/4th of the original value, while mission failure may only default to 7/10ths. The more severe the type of anger, the smaller the decay is.
Adding a "Completely Unforgiving" trait that rarely appears, making the NPCs anger either never decay or only by 20%.
Testing
Everything works great. Testing with multiple NPCs in the same reality bubble demonstrated that each one decreased over time, and at rates independent of each other. The various forgiveness mutations did affect anger decay percentages as I intended them to, and small anger gain values worked properly. Back-to-back anger gains worked properly, decayed at different rates, and didn't decay lower than expected values.
Additional context
Right now, I'm having trouble getting the final EOC to only run on NPCs and not the character. This will be fixed soon.The previous issue has been fixed, and now produces no errors on activation from invalid talkers.
There are a few minor bugs/oversights that should be fixed before this is ready:
I also want to have NPCs differ on how much they're willing to forgive you, rather than having everyone go down to 1/4. Some might only forgive to 1/2, others to 1/8, or some not at all.This has been implemented, NPC's now have dynamic forgiveness rates between them.The actual effects of what this anger does needs to be on a case-by-case basis with each NPC, and is out of the scope of this PR. This could include NPC's not wanting to talk to you, not giving you certain missions, or something like that. Working on this also made me realize just how sparsely NPC opinions are used in dialogue in the game, which could do with some expanding of its own.