A couple of questions (newbie)

Announcements, support questions, and discussion for Love/Hate.
Post Reply
Aheydeck
Posts: 5
Joined: Mon Oct 31, 2016 6:30 am

A couple of questions (newbie)

Post by Aheydeck »

Hi,

Just got around to get Love/Hate, but i have had it in mind ever since i started developing my game a year ago.

After implementation and trying some stuff out, i have a few questions:
1. Characters share rumors with friends, but what is the definition of a Friend? Is it someone i have a high affinity to, or someone i have a relationship with? Someone my parent faction have a relationship with?
2. In the events OnShareRumors and OnGossip, how do i know exactly what rumors are being shared, since the entire faction member is passed into it?
3. A Rumor's PAD is defined as "The xxx that this rumor caused the faction". So if a deed is performed on a faction member, the entire faction gets affected? If so, must i create a new faction for every character?

I'm sure there's more to come! =)

Thanks in advance!
//Andreas
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of questions (newbie)

Post by Tony Li »

Hi Andreas,
Aheydeck wrote:Hi,

Just got around to get Love/Hate, but i have had it in mind ever since i started developing my game a year ago.
Thanks!
Aheydeck wrote:After implementation and trying some stuff out, i have a few questions:
1. Characters share rumors with friends, but what is the definition of a Friend? Is it someone i have a high affinity to, or someone i have a relationship with? Someone my parent faction have a relationship with?
A relationship with positive affinity. The character could have a personal relationship with the friend, or it could inherit the relationship from its parents. For example, Juliet might have a personal relationship to Romeo, and that relationship would define her affinity to Romeo. However, if Juliet doesn't yet have a personal relationship to Romeo, then she would inherit the Capulets' relationship to Romeo. If the Capulets don't have a personal relationship to Romeo, it would fall back to the Capulets' relationship to the Montagues, Romeo's parent faction.
Aheydeck wrote:2. In the events OnShareRumors and OnGossip, how do i know exactly what rumors are being shared, since the entire faction member is passed into it?
The gossiper shares all rumors in its memory. The receiver evaluates each shared rumor. If it's a new rumor and the receiver decides it's worth remembering, the receiver will add it to its own memory.
Aheydeck wrote:3. A Rumor's PAD is defined as "The xxx that this rumor caused the faction". So if a deed is performed on a faction member, the entire faction gets affected? If so, must i create a new faction for every character?
Yes. The word "faction" is perhaps misleading because it usually refers to a group. However, in Love/Hate each unique character is its own faction. It may also have multiple parent factions, too.
Nosteme
Posts: 17
Joined: Wed Jul 27, 2016 4:51 pm

Re: A couple of questions (newbie)

Post by Nosteme »

Hey, sorry to necro post, but I have a question related to the discussion.

You said that when an NPC gossips with another NPC, they each swap the entirety of their known rumors? If so, then:
1) Is there any way to limit it to one rumor, in the way one might exchange a secret with someone else? Which brings me to
2) Do rumors have a var for how important or secretive the rumor is? Or similarly, is there any way to have secrets that NPCs are less than willing to share?

Thanks!
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of questions (newbie)

Post by Tony Li »

Hi,
Nosteme wrote:You said that when an NPC gossips with another NPC, they each swap the entirety of their known rumors? If so, then:
1) Is there any way to limit it to one rumor, in the way one might exchange a secret with someone else?
Yes, but it requires a tiny bit of scripting. In the upcoming version 1.8.6 (just submitted to the Asset Store today!), you can assign your own method to the FactionMember's ShareRumor delegate. The default delegate simply tells the other FactionMember to evaluate the rumor, but your own delegate could be more selective. I'll include example code below.
Nosteme wrote:2) Do rumors have a var for how important or secretive the rumor is? Or similarly, is there any way to have secrets that NPCs are less than willing to share?
A little scripting is required again for this. A secretiveness variable isn't built in, but the Rumor object has a customData field that's designed for purposes like this. You can use customData to record how secretive the rumor is.

Here's an example. When the NPC evaluates a rumor in a custom EvaluateRumor method, it determines its secretiveness and records it in the rumor object:

Code: Select all

void Start() { // Assign our custom EvaluateRumor delegate:
    GetComponent<FactionMember>().EvaluateRumor = MyEvaluateRumor;
}

public Rumor MyEvaluateRumor(Rumor rumor, FactionMember source) {
    var myRumor = DefaultEvaluateRumor(rumor, source);
    var secretiveness = rumor.impact * rumor.aggression; // Some formula of your choice.
    myRumor.customData = secretiveness;
    return myRumor;
} 
You only want an NPC to share a rumor if it loves the other NPC sufficiently -- that is, if the NPC's affinity to the other NPC is greater than the rumor's secretiveness value. (You could define a new relationship trait called Trust or something like that, but for the sake of this example we'll just use the built-in affinity value.)

Code: Select all

void Start() { // Assign our custom ShareRumor delegate:
    GetComponent<FactionMember>().ShareRumor = MyShareRumor;
}

public void ShareRumor(Rumor rumor, FactionMember other) {
    var secretiveness = (float) rumor.customData;
    if (GetAffinity(other) > secretiveness) {
        other.EvaluateRumor(rumor, this);
    }
} 
Combining these into one script that you can add to your FactionMember GameObject, you get:

Code: Select all

using UnityEngine;
using PixelCrushers.LoveHate;

public class MyFactionMemberDelegates : MonoBehaviour
{
    void Start() { // Assign our custom delegates:
        var factionMember = GetComponent<FactionMember>();
        factionMember.ShareRumor = MyShareRumor;
        factionMember.EvaluateRumor = MyEvaluateRumor;
    }

    public Rumor MyEvaluateRumor(Rumor rumor, FactionMember source) {
        var myRumor = DefaultEvaluateRumor(rumor, source);
        var secretiveness = rumor.impact * rumor.aggression; // Some formula of your choice.
        myRumor.customData = secretiveness;
        return myRumor;
    }

    public void ShareRumor(Rumor rumor, FactionMember other) {
        var secretiveness = (float) rumor.customData;
        if (GetAffinity(other) > secretiveness) {
            other.EvaluateRumor(rumor, this);
        }
    }
} 
Aheydeck
Posts: 5
Joined: Mon Oct 31, 2016 6:30 am

Re: A couple of questions (newbie)

Post by Aheydeck »

Hey!

Another newb question!

I'm in a situation where i define different characters (factions) traits such as "Leadership", but where i don't want them to be accounted for when looking up trait alignments with other characters. Is there a way to accomplish this?
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of questions (newbie)

Post by Tony Li »

Aheydeck wrote:I'm in a situation where i define different characters (factions) traits such as "Leadership", but where i don't want them to be accounted for when looking up trait alignments with other characters. Is there a way to accomplish this?
Typically you'd assign a replacement method to the FactionMember's EvaluateRumor() delegate. But in this case you'd end up copy-pasting the entire DefaultEvaluateRumor() method and customizing just one line. Instead, I'll post a patch today (which will also be included in v1.8.7) that will let you assign a delegate for GetTraitAlignment(). You can then assign a replacement that excludes certain traits from the alignment calculation, and the default EvaluateRumor will use it seamlessly.
Aheydeck
Posts: 5
Joined: Mon Oct 31, 2016 6:30 am

Re: A couple of questions (newbie)

Post by Aheydeck »

That sounds awesome! Thanks for the great support!
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

Re: A couple of questions (newbie)

Post by Tony Li »

Okay, you can download the patch here: http://pixelcrushers.com/lovehate/downloadaccess.php

You'll need to enter your Unity Asset Store invoice number to access the download.

The manual has code examples for custom delegates for the other functions like GetTrustInSource() and EvaluateRumor(). You can follow the same format to assign a delegate for GetTraitAlignment(). The default function just calls Traits.Alignment(), which compares all traits. Say your Leadership trait is trait #3 in the list. You could use a function like this:

Code: Select all

public class MyFactionMemberDelegates : MonoBehaviour {
    private FactionMember m_factionMember;

    void Start() {
        m_factionMember = GetComponent<FactionMember>();
        m_factionMember.GetTraitAlignment = MyGetTraitAlignment;
     }
     
     Rumor MyGetTraitAlignment(float[] traits) {
         var originalValue = traits[3];
         traits[3] = 0;
         var result = Traits.Alignment(traits, m_factionMember.traits);
         traits[3] = originalValue;
         return result;
     }
 } 
I hard-coded "3" for brevity. If you wanted to make it more general, you could loop through the faction database's personalityTraitDefinitions[] array to find the right traits[] index instead.
Post Reply