CleverRaven / Cataclysm-DDA

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

System for NPC personality models, opinions, and emotions #75233

Closed zachary-kaelan closed 1 month ago

zachary-kaelan commented 1 month ago

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

The system for the personalities of NPCs and their opinions of others require an inevitable rework at some point in the future. This is a complete write-up for how I think the reworked system should work.

Solution you would like.

I propose using the personality models of Chris Crawford, who’s been experimenting with personality models and social simulation in games for 30 years. He proposed a simple personality model with 3 float scales and one add-on, that go from -1 to 1 on a rough bell curve:

Bad_Good

You use this variable to make decisions that hinge upon how nasty or nice a person is. For example, suppose that Fred slaps Tom. Tom has two possible options: he can pull out his Magnum .45 and blow Fred’s head off, or he can turn the other cheek. You would use Bad_Good to make the choice between options. A high value of Bad_Good would favor turning the other cheek; a low value would favor blowing Fred’s head off.

It's quite obvious how this would translate to NPCs in CDDA (aggression).

Faithless_Honest

This affects whether they tell the truth, honor their promises, and behave with integrity.

Honest doesn't mean good and dishonest doesn't mean bad. A hitman for hire would be an honest murderer.

Timid_Dominant

This trait is used when some kind of conflict of wills arises between two characters. When a confrontation occurs, the character with the higher value of Timid_Dominant will prevail, all other factors being the same.

Someone heavily armored with an assault rifle can still be crying with trembling hands when it comes to basic social interaction. Shooting a zombie in the face counts as "social interaction" for the purposes of this system.

Ascetic_Hedonistic

This reflects the degree to which a character pursues any form of sensual gratification. A person with a high value of this trait enjoys good food, likes to wear fancy clothes, desires to accumulate nice things, and is lustful.

Again, quite obvious how this would translate to NPCs in CDDA (collector). But otherwise this one is less useful for social interactions, so it could be optional in the model or considered separate.

These can be renamed and their meanings modified at will, the important thing is the flexibility with which these values can be used.


For opinions of other characters, we don’t actually need any new scales at all:

Affection = Perceived level of Bad_Good, or pBad_Good

Trust = Perceived level of Faithless_Honest, or pFaithless_Honest

Respect = Perceived level of Timid_Dominant, or pFaithless_Honest

Intimidation/Fear = Perceived level of Timid_Dominant relative to oneself, or pTimid_Dominant - Timid_Dominant

 

So for instance, the willingness of someone to be around you might be something like 0.4 * Trust + 0.4 * Affection + 0.2 * Respect.

Trust would determine most of someone’s willingness to trade, take or give jobs for pay, and to be anywhere near you in general. Affection would determine most of whether someone wants to actually be a friend. Respect would determine most of whether someone thinks you have leadership and combat skills.

 

There are also “accordance values”, which determine the baseline for a character’s opinion of other characters.

Altruism = Accordance level of Bad_Good, or aBad_Good

Gullibility = Accordance level of Faithless_Honest, or aFaithless_Honest

Confidence = One's Timid_Dominant relative to accordance level of Timid_Dominant, or Timid_Dominant - aTimid_Dominance

 

I think it would also be very easy to model emotions by simply adding temporary adjustments to someone’s personality model and/or perceptions. For example, anger would decrease Bad_Good and increase Timid_Dominant, making someone more likely to take risks and harm others.


Actions represented using the system would have personality values associated with them, used to help determine what actions one might take and how the perceptions of others change based on those actions. The impact of an action is multiplied by 1 / n with n being how many times it’s been done by the other character, so a player can’t just do the classic pretty flowers spam to win affections. Each time an NPC witnesses an action it has a slight impact on their accordance values, and each time an NPC takes an action it has a slight impact on their personality traits, both together representing a form of “character development”, allowing NPCs both to develop trauma and to recover from it.

The curve is in an S-shape with the formula x / ( 1 + abs( x ) ), and addition of two float values is done by converting back to integer first and adding before converting back.

Describe alternatives you have considered.

I saw the Big Five personality model come up in an old Discord discussion, but that model has no means of expressing opinions or emotions, and working with a system like this is exponentially more difficult the more scales you add.

Additional context

I've efficiently implemented the complete system in the past and can do it again.

esotericist commented 1 month ago

so i should start with that i have a great deal of respect for the original research crawford has performed over the years, but this seems to be a fairly significant misapplication of his work.

for one, the article you cited is specifically intended to be used for modeling social interactions and how dynamic dramatic personalities are involved, not combat evaluations in what is functionally a turn-based tactical simulation.

for two, any such model needs to be in service of the design, where you are looking at what the design requires and how those requirements can be fulfilled; the details for the model selected must follow from that.

further, even if we decided we wanted to use crawford's methodology for conversations (what it's actually INTENDED for), we would need a pretty drastic restructuring of how our conversation content is structured and created. questions about what that would require would, also, need to come before deciding technical details about the model.

here, you've skipped straight to implementation details without even asking any design questions. this isn't tenable.

zachary-kaelan commented 1 month ago

not combat evaluations in what is functionally a turn-based tactical simulation

That's a strictly separate system. Once the NPC makes a decision to do something involving combat, they enter combat and the personality models don't apply.

any such model needs to be in service of the design

NPCs already have aggression, bravery, altruism, and collector, and opinions already have trust, fear, anger, and value. Those things can be directly derived from Crawford's model.

crawford's methodology for conversations (what it's actually INTENDED for)

It's intended for interactivity using verbs. Those verbs aren't strictly limited to what goes on in casual conversation. "Mug at gunpoint" is a verb. "Stab in the back" is a verb. "Make trade deal" is a verb. "Flee" is a verb. "Loot" is a verb. "Bury" is a verb.

It is also intended for modeling relationships. Currently what we have is a social skill roll to either converse with or get shot in the head by an NPC. If conversing, you do a fetch quest or two then you have their undying loyalty. I'm making the calculated assumption that this isn't the intended end state for NPC interactions.

pretty drastic restructuring of how our conversation content is structured and created

Not really. The way trials work is combined multipliers on personality and opinion values weighed against a social roll. There are also hardcoded combinations of personality and opinion values determining things like getting mugged.

"text": "You can keep me safe.",
"trial": {
  "type": "PERSUADE",
  "difficulty": 0,
  "mod": [ [ "ALTRUISM", 6 ], [ "POS_FEAR", -6 ], [ "BRAVERY", 2 ], [ "ANGER", -6 ], [ "VALUE", 2 ] ]
}

This is basically how Crawford's system works. Notice how the example he uses is whether or not to response to violence with violence, taking physical strength and aggression into account.

questions about what that would require would, also, need to come before deciding technical details about the model.

That's why this is an issue and not a PR, I thought that was obvious.

kevingranade commented 1 month ago

That's a strictly separate system.

Take a look back at your description and see if you can find anything saying that, this is a symptom of what eso was saying, you aren't being clear about what you are trying to address.

NPCs already have aggression, bravery, altruism, and collector, and opinions already have trust, fear, anger, and value. Those things can be directly derived from Crawford's model.

This is a terrible legacy system that needs replacing, and it very much is tied into both npc relationships and tactical decision making. It's not a good example of anything.

It's intended for interactivity using verbs. Those verbs aren't strictly limited to what goes on in casual conversation.

It does not say that at all, "The starting point for any dramatic interaction is a personality model." Side note, you taking "conversation" and changing it to "casual conversation" is a big problem, that is not a good faith rephrasing.

I'm making the calculated assumption that this isn't the intended end state for NPC interactions.

That's correct as far as it goes, but you haven't drawn "the rest of the fucking owl", you have a vaguely worrded statement of intent and then some implementation details not anchored to anything in the game. This isn't enough to even start a conversation on the subject.

As Crawford specifically calls out, step one is describing the scope of the system you're modeling (enumerating its verbs), and you've simply skipped that step. If you're interested in working on this, start from there and do it right.

zachary-kaelan commented 1 month ago

you taking "conversation" and changing it to "casual conversation" is a big problem, that is not a good faith rephrasing

You are correct, it was not civil and not constructive to healthy debate, my apologies to esotericist.

After some reflection, I think overall my entire GitHub issue was basically just a full explanation of Crawford's model with a few mentions of how it would tie into the game at a high-level, which is the kind of thing that would maybe be presented to uninformed players in a discussion, definitely not to developers in a GitHub issue. Thank you both for your feedback, any future GitHub issues or discussions will take all of that into account.