Page 1 of 1

Negative Aggression and Modelling Attack/Counter Attack with Deeds

Posted: Wed May 17, 2023 11:23 am
by slippyfrog
Hello and thanks again for support/feedback! I'm really excited about the systemic possibilities of Love Hate but I need a bit of advice on deed modelling. Please pardon the message if the solution is obvious as I'm pretty new to this asset

Goal:
My goal is to model some systemic combat behaviour in my population simulation.
I want Entities Attack when they are Hostile and flee when they are Anxious. Further more, I want friends of B to become Hostile when B has been attacked enough or flee when they see a friend being attacked enough..

Setup
Attack Deed have (-) Impact and (+) Aggression
Entities Attack when they are Hostile.
Entities Flee when they are Anxious.

With the above setup, I’m having some trouble wrapping my head around how to model an attack deed that would yield this result. I can never increase Dominance such that the entity becomes Hostile and counter attacks. Dominance always decrease. This is described below.




Observations/Assumptions:
Let’s assume an Attack Deed has negative impact. To simplify, we only want to increase or decrease the Dominance and we do not care about the change in magnitude for now. As such, a deed either increased or decrease the dominance. Also, let’s ignore the PowerModifier for now. Based on the DefaultEvaluateRumor equation, a few observations below:
  • Negative aggression means nothing in any of the stock computations as use of aggression is always wrapped in ABS
    This makes sense unless we want to model a ‘friendly’ deed which may decrease dominance??
  • Out-of-the-box, Dominance does not seem to reflect the specific personality traits.
  • My Dominance Goes DOWN when:
    • [I don’t like the target] And [Deed Impact is (+)]
    • And [Deed Impact is (-)]
  • My Dominance Goes UP when:
    • [I don’t like the target] And [Deed Impact is (-)]
    • And [Deed Impact is (+)]



Concert Example to illustrate what I’m observing:

An Attack Deed should likely have (-) Impact to the Target with a (+) Aggression (sign of aggression doesn’t matter).

A and B like each other so when A (Actor) attacks B (Target) :
- B witnesses the Attack from A on themselves and his dominance goes down. (B likes B And Attack Impact is (-)).

When A Attacks B and A and B don’t like each other,
- B witnesses the Attack from A on themselves and his dominance goes down. (B likes B And Attack Impact is (-))


Friends of B also suffer from the same issue with their dominance decreasing when B is attacked.

This works if the entities being attacked are Sheep and become more passive when they are attacked :) but I want them to agro.


Options:
  • Is this something that can be molded using the PowerModifier?
  • Should I have a deed that only the Target can observed that is dispatched along with the Attack deed from A? For example DefendYourself Deed that would be (+) impact or (-) aggression (if the sign of aggression mattered)
    • Not sure if this gets too into too many deeds as there might also need to be another deed to trigger/actualize the friends of B into fighting back.
  • Should I even be using deed to model this (vs just directly modifying/adjusting Pad values of B similar to how Auras apply direct change to the PAD values)?
    • I feel that I would loose a lot of the systemic benefits of Love/Hate in this case.
  • Do I need a more complex DefaultComputeDominance that would consider sign(aggression), or perhaps specific Personality Traits?
    • For example the DefaultComputeDominance could include ocean traits such as -Agreeableness or +Neuroticism). Ie the Dominance of the target will increase if the target has -Agreeableness, +Neuroticism and - Conscientiousness.
    • This seems to make sense as timid units would run and bold entities would turn and fight.
  • Other solutions?


I’d like to know if my goal can be achieved without mucking with the ‘big equations’ :) I’m assuming attack/counter attack a pretty standard use case so just checking if there is a recommended best practice on how to model this. I’d like to maintain the stock implementation Using PAD and OCEAN if possible. But it would be wonderful if you or anyone in the community here could provide some insight/recommendations.

Thanks again for the wonderful asset and support!

W

Re: Negative Aggression and Modelling Attack/Counter Attack with Deeds

Posted: Wed May 17, 2023 1:11 pm
by Tony Li
Hi,

You don't need to modify the big function (FactionMember.DefaultEvaluateRumor). As you suggested, assign your own function to FactionMember.ComputeDominance so the faction member will use your function instead of DefaultComputeDominance. You can use whatever logic you want. For example, this function bumps dominance up or down by 1 with each deed:

Code: Select all

void Start()
{
    GetComponent<FactionMember>().ComputeDominance = CustomComputeDominance;
}

public float Custom ComputeDominance(Rumor rumor, float affinityToTarget, float changeInAffinityToActor, float powerModifier)
{
    var isTargetEnemy = affinityToTarget <0;
    var isTargetFriend = affinityToTarget > 0;
    var isSadAction = changeInAffinityToActor < 0;
    var isHappyAction = changeInAffinityToActor > 0;
    if (isSadAction && isTargetFriend)
    {
        // Someone hurt my friend, so make me more dominant (aggro):
        return 1;
    }
    else if (isHappyAction && isTargetEnemy)
    {
        // Someone hurt my enemy, so make me more dominant (aggro):
        return 1;
    }
    else    
    {
        // Otherwise rely on default:
        return DefaultComputeDominance(rumor, affinityToTarget, changeInAffinityToActor, powerModifier);
    }
}
You can also adjust the Power Difference Curve to change how powerModifier is computed. The default is a value [-1, +1]. With the default curve:
  • If the deed actor is 10 power levels higher than me, powerModifier is 0. (I'm nothing compared to the mighty actor.)
  • If the deed actor is 1 level lower than me, powerModifier is 0.1. (I'm a little tougher than the actor.)
  • If the deed actor is 10 levels lower than me, powerModifier is 1. (I feel totally dominant over the puny little actor.)[/code]

    And you can also assign a delegate to FactionMember.GetSelfPerceivedPowerLevel -- for example, if a character overestimates their own ability.