Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Seeking Feedback on Faction/Relationship System

Discussion in 'Game Design' started by TonyLi, Jan 3, 2015.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,398
    I'm working on a faction and relationship system, and I'd be grateful for your feedback.


    Summary: Characters judge each other's actions (usually player actions) according to their personality and their affinity to the action's target.

    Every character belongs to one or more factions. The blacksmith, for example, has his personal faction and belongs to the Villagers faction and the Blacksmiths Guild faction. If the blacksmith doesn't have an affinity to the player, he'll refer to his parent factions' affinities.

    Affinity specifies how the character or faction feels about another, where -1 is total hatred and +1 is absolute love.

    Personality is comprised of Values and Temperament. Values specify how strongly the character feels amount ideas like wit, violence, and charity, where -1 charity means selfish and +1 means altruistic. Temperament (emotional state) uses the PAD model (thanks for the suggestion, @JoeStrout). It could drive facial expressions and body language in a more sophisticated scene than this one.

    Characters also have short-term memory (for temperament) and long-term memory of actions they've witnessed or heard about (rumors), and they can share them when they encounter friends, so word of your deeds spreads organically.

    The germ for this project was an event in BioWare's Mass Effect. On one planet, you lose influence with a companion if you run over too many animals with your vehicle. What jarred me was that, since this was scripted, you could run over as many animals as you wanted on any other planet and she'd apparently be fine with it. In contrast, this system manages faction/influence/love based on gameplay actions, not just hard-coded events. (You can also use hard-coded events, as in the conversations in this prototype.)

    Feedback I'm Hoping For: I dropped this system into my general-purpose prototyping level. It's not tuned for looks, performance, or playability, so I'm not interested in feedback on control, camera, or UI. NPCs have short fields of view to make it easier to do things without the whole village seeing right away. But this means, for example, if you want to impress the farmer by killing the goblins plaguing his field, you'll have to kill them right in front of him.

    I'm also not so much interested in whether this scene is "fun," but rather if the system seems useful. And I'd be grateful for any suggestions for improving it.


    Controls:
    • Left-drag to look
    • WASD to move
    • Click on NPCs to view their info and activate the skillbar (attack, heal, talk)

    Thanks, everyone!
     
    AndrewGrayGames and JoeStrout like this.
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    7,951
    I think it's great that you're doing this, and I see a lot of potential.

    However, after playing with it for just a few minutes, I wasn't able to affect anything in ways I expected. For example, I noted that Finn is married to Abigail, and both were standing fairly near. So, just to see what would happen, I went over and started attacking Abigail, thinking that Finn might react in some way.

    I wailed on Abigail for quite a while, and not only did Finn not react, but Abigail didn't even get upset about it. Her temperament, happiness, and arousal didn't change as far as I could tell. I paused in my attacking, had a nice chat with her about her potions, and she had no comment about the fact that I'd been slashing her with a knife for some time.

    This may just be a timing problem... as I type this, I left he game up, and now I see that Gwen (who was nearby) is quite disgusted by me, and Abigail's happiness has done down (and arousal has gone up). So this is good. Finn's happiness and pleasure are near zero (yay!), but oddly, his arousal and dominance are 0 too. I'd expect him to be more upset than that; he's just depressed. Is he intended to be a cowardly character? If so, maybe this is working.

    I healed Gwen a couple times, and now she's cool with me again. And in fact, so is Abigail — her affinity towards me is 0.81 now. (I didn't think to check what it was before.)

    ...So, I started whaling on Abigail again. On the first attack, her affinity towards me dropped to 0.67, but then it stayed there as I proceeded to wail on her for quite a while.

    All in all, I think this is a great start, but needs some tweaking. Attacks in particular should have more dramatic effects, immediately triggering a fight-or-flight (high arousal) response and a strong negative change in affinity, which shouldn't be so easily fixed with a couple of nice acts. And, these stats need to be worked into the chat system more. It's very incongruous to exchange pleasantries while attacking someone with a knife. :)
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,398
    Thanks for the feedback, Joe! I really appreciate it. I need to tweak the numbers associated with each action. Modeling like this is essentially a data problem, and I'm still working out how best to tweak those numbers so they make sense and aren't too complicated to manage. For instance, dominance is based on perceived power difference, and in this scene the player is hard-coded to be more powerful, so everyone will feel submissive when the player harms a villager.

    I'll also expand the conversations to remark on current affinity levels. Currently they only allow you to compliment or insult the villager (write-only on the affinity levels). Conversations are a huge part of showing personality, and I shouldn't have skimped here in the prototype.

    None of the villagers do anything beyond their regular routine except for barking their affinity to the player when they see him. Their internal data changes (for example, Finn will hate you for attacking Abigail), but in this prototype it won't be reflected in actions. I might add some reactions (e.g., running in fear, or yelling at you to stop) to make affinities clearer.

    I do have a follow-up question: Actions such as attacking are regulated by time. When you attack a specific character such as Abigail, it only informs the system every, say, 10 seconds (tweakable). This prevents you from spamming the system with a ton of attack actions that all witnesses would have to remember and share when gossiping. The idea is that the event registers the concept of attacking a character, rather than each individual sword swing. You can define a separate action for killing a character (with steeper values), but in this prototype you can only kill goblins, not villagers.

    Do you think this is a good way of regulating the frequency of repetitive actions? Do you have any suggestions for different approaches?
     
    Last edited: Jan 5, 2015
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    7,951
    Yep, I think this is a big problem with systems like this — there are so many free knobs to tweak, it can be very hard to get the effect you want.

    However, there are some things you can do to make it easier. (This is speaking very generally based on when I've run into similar issues in the past — not sure exactly how it applies in this case.) Try to use realistic units wherever those apply, and where you can't do that, at least a consistent scale. For example, have all your free parameters go from 0-100 or from -100 to 100. Add hidden constants within the engine that scale these as needed to make the math work out. Of course that just shoves the problem onto the engine author (you), but that's better than having all the users have to worry about it.

    The other thing you can do is maybe provide "archetypes" like they often do in RPG games. These would be sets of parameters that fit particular characters, with a clear description of how each one behaves. Then when a level designer is prototyping a level, they can just populate it initially with characters from that stock set, and then tweak as needed, which is a lot easier than starting from scratch every time.

    Ah. I'd suggest adding a buff character or two who thinks they're more powerful than the player; that will open up more interesting possibilities.

    Yes, that'd be good. And not just affinity — I think you should try to emote other extremes of the PAD space, too. For example, if arousal is high, the character is either agitated or excited. So he should be waving his arms about, or jumping up and down (or both). At intermediate arousal levels, a character should at least pace about a bit. Just standing there serenely while arousal > 0.6 doesn't seem believable.

    Oh yeah, and I saw a character with an arousal of 0.0, who was also just standing around. At that level of arousal, I'd expect him to be passed out. :)

    Of course all that animation isn't easy... but man, I think it cranks up the coolness factor (and the believability) quite a lot.

    Ah, that explains a lot of the confusing effects I observed. Hmm.

    Well, one idea here is to register each action, but in the character memories, allow events to be combined if they are close in time and of similar nature. Instead of storing just "Player attacked Abigail at time 12", the first attack should result in "Player attacked Abigail 1 times from time 12 to time 12". And then when I attack again, you find this first fact, and just update it to "Player attacked Abigail 2 times from time 12 to time 15".

    You may or may not actually use that extra detail — "player attacked Abigail" is probably the important part — but you could certainly do an additional PAD/affinity adjustment for each subsequent attack as they come in, and later have some weighting factors in the responses that depend on how many times the action was done.

    Keep up the great work! I really do think this sort of thing is the future of RPGs.

    Do you think this is a good way of regulating the frequency of repetitive actions? Do you have any suggestions for different approaches?[/QUOTE]
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,398
    Thanks again for the great feedback. I added all your ideas to my list. I initially intended to accumulate all actions regardless of how fast they occurred and give them a logarithmic dropoff in impact (e.g., a kid isn't going to be as excited after receiving the 100th piece of candy in a row as he is the first piece). Laziness got the better of me on that one. :)

    All values (Values, PAD, Affinities) are in the range [-1,+1]. My thinking was that Arousal +1 would be manic, -1 would be unconscious, and 0 neutral. Normalized values make the math tidy. Do you (and anyone else who's willing to chime in) think a different scale, such as [-100,+100], would be more intuitive?

    I like the archetypes idea. Thanks!

    The next update to the scene above will have more reaction animations and deeper conversations, in addition to the improvements to the core system that you suggested.
     
  6. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,629
    Tony, I like what you are doing. I do agree with Joe in the fact that the numbers don't seem to mean anything yet. However, I am sure this is something you are going to address eventually. It is a very good start. I want to see the NPCs react to each other and to the player character based on what they do and I didn't actually see that. I did see the numbers change but that was all.

    How tweak-able are the settings? Will we be able to change everything there including values, numbers, etc.? Can we add or subtract various descriptions, such as taking out a state and adding new ones? The more customization the better.

    Reaction animations are great and it would be nice if it would be easy for us to add our own in the editor/interface.

    I am not going to address the conversations because I can't imagine the maker of the dialogue system wouldn't allow us to add deeper conversations. :) Adding these to the example would help show off your system.

    I think the value scales would work at either scale. I rather like the -100 to +100 only because it allows more fine tuning without getting into big numbers after the decimal point. It probably is more intuitive to people who might use the system.

    Anyway, good job and I can't wait to see it develop further.
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,398
    @Teila - Thanks for your feedback! All values -- Values, PAD, Affinities, parent factions -- are changeable at runtime and design time. You're starting to lean me toward [-100,+100]. The Faction component's inspector has sliders, so visually it shouldn't make much difference. But in scripts or a Dialogue System conversation node, it'll be easier to say "increase affinity by 1 (out of 100)" instead of "increase affinity by 0.01 (out of 1.00)".

    The system lets you drop in animations (and barks if you have the Dialogue System) in reaction to seeing another character. It will play different animations based on user-defined ranges of affinity values (e.g., hate, dislike, neutral, like, adore) and PAD values. You can also play an animation when NPCs "gossip" (share memories); I should've added this to the scene.

    Apart from changing the way repetitive actions are reported in the core system as Joe suggested, it looks like most of my "to do" items are with the prototype scene -- tweaking values, adding animations and conversations, etc. -- to make it more apparent what the core system is capable of. I'll post an updated scene as soon as it's ready!

    EDIT: One question -- which "states" are you referring to when you write "Can we add or subtract various descriptions, such as taking out a state and adding new ones?" You can report actions (e.g., "player just insulted Abigail's potion-making skill"), but the Values (discussed more in this thread) are a fixed list.
     
    Last edited: Jan 5, 2015
    JoeStrout likes this.
  8. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,629
    Sorry, I meant the values. I was hoping there was a way to add your own values as games have different goals. Our game isn't as combat oriented as some so our values might be different. We might like a piety value, since it is a medieval world. Or maybe a Honor or Valor.

    I understand you have to limit it though. That is one thing I do like about the system we are currently using. We can define the values that are important or not important in our game so that all games that use the system can be unique. I am still hoping I can use your procedural quest system with our own value system. I really like what you have done but just need a bit more customization.
     
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,398
    I'll reply about Values in the spin-off NPC Personality Traits thread.

    I'm designing each system (Dialogue System, procedural quest generator, and this project) to be independent of each other, but with hooks so they can work together. So you'll be able to use the quest generator with your own value system.
     
    JoeStrout and Teila like this.
  10. randomperson42

    randomperson42

    Joined:
    Jun 29, 2013
    Posts:
    975
    @TonyLi, these look great - but shouldn't these threads go in the WIP section?
    Or maybe I missed something. :)
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,398
    Thanks! It's a big enough departure from other AI approaches that I think it warrants a little discussion about design first. I'm getting a lot of fresh design perspectives from all the great people on this forum. I'll move it to WIP when the design has settled in.