Love/Hate capability for creating/managing social networks

Announcements, support questions, and discussion for Love/Hate.
Post Reply
DoubleJ
Posts: 3
Joined: Wed Jul 21, 2021 7:36 am

Love/Hate capability for creating/managing social networks

Post by DoubleJ »

Hey,

I'm looking at using Love/Hate for the following project:

A small but dense sandbox (similar idea to Streets of Rogue scale), where NPCs belong to factions , different classes and have different personalities. The player is a hunting a target (NPC) and interacts with NPCs in the level to work out their social connections, get their favour/help, interrogate them etc. to uncover clues to the player target. I'm looking for a system that will help with:
• Procedurally generate a database of NPCs with variations of all the above traits
• NPCs have a schedule based on their traits
• NPCs are aware of events going on around them.
• NPCs are part of a social network based on their traits
For instance, NPC 1 has 3 connections to other NPCs based on their personalities (e.g. NPC number 6, 12 and 15).
NPC 1 will know details about these other NPCs, and will react to their status changing.

Now looking at the Love/Hate youtube materials, it seems it hits the mark on the first 3 points, but how well can it support on the last point? How well can it handle a web of connections rather than just broader and more binary factions? Also how well does this scale? Could I run it for 100 NPCs at once? with those NPCs interacting without the player near by? what are the limits on this?

Thanks and I'm looking forward to your answer.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Love/Hate capability for creating/managing social networks

Post by Tony Li »

Hi,

>• Procedurally generate a database of NPCs with variations of all the above traits

You can procedurally generate NPCs and/or create them manually in the editor. You'll probably want each NPC to have its own faction. The NPC's faction can inherit from any number of parent factions. (Those parents can have parents, and so on.) The NPC's faction can inherit personality traits and relationship values from its parents. However, Love/Hate doesn't have a concept of classes. You could either add a class "faction" as another parent, or define classes on your own separately from factions.


>• NPCs have a schedule based on their traits

You can certainly read trait values and take action based on those values, but there's nothing built into Love/Hate to, for example, animate an NPC to wake up and walk to the bakery to bake bread based on those values.


>• NPCs are aware of events going on around them.
>• NPCs are part of a social network based on their traits

Yes. These are the two key elements of Love/Hate.


> Also how well does this scale? Could I run it for 100 NPCs at once?

100 NPCs is no problem. The "performance load" test case we use is 10,000 NPCs all interacting at the same time.


> with those NPCs interacting without the player near by? what are the limits on this?

Each event can specify that it's reported globally (i.e., to all NPCs in the scene) or within a specified radius of the actor. If it's within a specified radius of the actor, you can optionally configure NPCs to do perception checks to determine if they notice the event.

Please feel free to try the evaluation version. Love/Hate will be on sale on the Asset Store through the end of next Monday.
DoubleJ
Posts: 3
Joined: Wed Jul 21, 2021 7:36 am

Re: Love/Hate capability for creating/managing social networks

Post by DoubleJ »

Thanks for the swift reply. And thanks for being clear on what the Love/Hate system can and cant do.

>• NPCs have a schedule based on their traits

On this one, I did assume I would do the coding for the scheduling, but really what I wanted to know was that Love/Hate could pass traits to my scheduling system and then my scheduling system could generate the kind of things that they would do.

A bit of a detailed question but I'm curious if you have thoughts: the suggestion you made is using Love/Hate to determine schedules by reading the NPC Trait values as an input to a NPC scheduling system. Given an NPC has multiple traits, how would it work?

As an example: if an NPC had a high Social trait, I could give them tasks to go to the bar and talk to people
If the same NPC had a high Violence trait I could make them go to a fight club.

So both activities are applicable, and I could easily code it so that one is chosen randomly, but can you think of smarter ways to do this?

I suppose I'm asking is how should we know how to process an NPC accounting for all the traits together
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Love/Hate capability for creating/managing social networks

Post by Tony Li »

Your scheduling system can read personality trait values by calling FactionDatabase.GetPersonalityTrait(). For performance, traits are identified by int IDs, so it might look something like:

Code: Select all

int socialID = FactionManager.factionDatabase.GetPersonalityTraitID("Social");
float socialTraitValue = FactionManager.factionDatabase.GetPersonalityTrait("Adam", socialID);
(Here's the complete API Reference.)

If you want to spice up activity selection, you could treat the combination of traits as a vector. For example, say you have 3 traits: Social, Violence, and Hedonism. So an NPC's "personality" might be defined by the vector <Social, Violence, Hedonism>.

Then define a vector for each activity. Going to a bar could be <Social=100, Violence=0, Hedonism=100>, whereas going to church could be <Social=100, Violence=0, Hedonism=0>:

loveHateActivitySelection.png
loveHateActivitySelection.png (21.68 KiB) Viewed 3994 times

Then identify the activity vector that's closest to the NPC's vector. That's the NPC's "ideal" activity.

To make it more interesting, check the distances of all activities to the NPC's vector. Make a list of all activities that are, say, within 10% of the same distance as the ideal activity. Finally, do a weighted random selection of the list.

For example, if the player's vector is <Social=100, Violence=0, Hedonism=50>, then the weighted selection would be 50% for Bar and 50% for Church.

However, if the player's vector is <Social=100, Violence=0, Hedonism=75>, then the weighted selection would be 67% for Bar and only 33% for Church.
DoubleJ
Posts: 3
Joined: Wed Jul 21, 2021 7:36 am

Re: Love/Hate capability for creating/managing social networks

Post by DoubleJ »

Thats a great way of framing the approach. Thanks for the help, I will be making a purchase and looking forward to playing around with those systems.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Love/Hate capability for creating/managing social networks

Post by Tony Li »

Sounds good! If you have any questions about using Love/Hate as you dig into it, just let me know.
Post Reply