Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Love/Hate: The Emotion-Driven Relationship System

Discussion in 'Assets and Asset Store' started by TonyLi, Mar 24, 2015.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670


    Love/Hate is a relationship and personality simulator for Unity. It models characters’ feelings about each other using emotional states and value-based judgment of deeds. Play the WebGL demo.

    With Love/Hate, your characters will…
    • …have personalities and emotional states.
      Love/Hate uses powerful, customizable personality and emotional state models.
    • …maintain relationships.
      Love/Hate tracks how different characters and groups (factions) feel about each other, allowing you to define a dynamic web of social ties among your characters.
    • …judge and remember deeds.
      Characters witness deeds committed by others, judge them according to their own personality and relationships, and remember them.
    • …gossip with other characters.
      Characters share memories realistically, allowing news of actions to spread organically.
    Love/Hate doesn’t replace reason-based AI such as finite state machines and behavior trees, but instead works alongside them to provide interesting, character-based motivation.

    Love/Hate lets you create complex characters that react emotionally to what’s actually happening in the game.

    Love/Hate is the product of several years of research and development in realtime simulation of emotions and value-based appraisal, incorporating the latest academic and industry strategies. It includes complete, fully documented source code as well as support for:
    • Adventure Creator
    • Behavior Designer (provided by Opsive)
    • Bolt
    • Dialogue System for Unity
    • ICE Creature Control
    • Makinom
    • Node Canvas (provided by Paradox Notion)
    • ORK Framework
    • PlayMaker
    • plyGame and plyBlox
    • Quest Machine
    • TradeSys
    • Zone Controller
    • UFPS
    Love/Hate implements sophisticated AI, but is very lightweight and CPU efficient at runtime.

    5-Star Asset. Some customer reviews:
     
    Last edited: Nov 19, 2020
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @nosyrbllewe - That might be a better question for philosophers. What is love? :) But, yes, one way you could define it is to add more relationship traits -- perhaps Friendship and Lust? I'd probably just add a Lust trait and use the default Affinity trait for general like/dislike.

    Chris Dahlen's talk at GDC 2014, "Love/Hate Relationships: New Approaches to Game Romances" is well worth watching. He breaks down genres such as romantic comedies and plots how two traits -- Respect and Rivalry -- could play together in a game to build interesting romances with tension.

    I originally called this a "perception" check, but went with "sight" check because I think it's clearer in most cases. By default, it uses a simple raycast. But you can assign a delegate method to override this with any kind of sensory check you want to implement. Every deed also has a notification radius; a whisper might have a tiny radius, while an explosion might be global. Potential witnesses who are outside the deed's radius don't even get a chance to try to perceive it.

    Thanks for catching that! Is your last name Holmes by any chance? ;)
     
    hopeful likes this.
  3. randomperson42

    randomperson42

    Joined:
    Jun 29, 2013
    Posts:
    974
    I will be watching this one closely. There seems to be quite a bit of potential here - I'll be curious to see how customizable this is. But judging from the great feedback on your dialogue system I'm sure it will be good.
     
  4. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Can I ask who drew that graphic above?
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks! Please feel free to browse the manual to get an idea of how customizable it is. All attributes (the list of personality traits, the list of relationship traits, etc.) are customizable, and delegates are available to override much of the default behavior if you want. If you have any feature suggestions, please let me know!

    A local game artist. (Thank goodness. If it were up to me alone, you'd only get stick figures.) If you're looking for an artist who does good work at good rates, I can get you in contact with her.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Social NPC simulation, what Love/Hate does, got a lot of attention at GDC this year. (Unity will hopefully approve Love/Hate on the Asset Store soon -- stay tuned!)

    Mitu Khandaker-Kokoris recently posted his excellent talk notes, "Thinking About People: Designing Games for Social Simulation". As you design your faction databases and NPCs, this could be a very helpful resource. Especially useful is the section about 1/3 down, "6 important considerations for designing social simulations". It's practically a checklist of what to do to make interesting NPCs.

    Gamasutra also posted the video of Chris Dahlen's talk from last year, "Improving romance in games with rivalry and respect". If you're planning to have any kind of romantic or competitive relationships in your game, it's well worth watching. Love/Hate faction databases start with a default "Affinity" relationship trait (like "respect" in Dahlen's talk), and with a simple click of the "+" button you can add more traits such as "Respect".
     
    Last edited: Mar 26, 2015
  7. halfbot

    halfbot

    Joined:
    Sep 22, 2013
    Posts:
    19
    Really excited to try this out. Hopefully it comes out soon. I have a prototype that I think would benefit from playing around with relationships more organically. Good job as always Tony.
     
    TonyLi likes this.
  8. Nyt0x

    Nyt0x

    Joined:
    Feb 3, 2014
    Posts:
    18
    Is it something like that one asset https://www.assetstore.unity3d.com/en/#!/content/29973 you are doing? Anyway I'm curious about it, I can see plenty of other way to use such an asset (other than just social sim). Any hint about the price tag? And is it going to be a full source asset or a dll one ? (dll is why I didn't buy the other social AI asset as you then rely only on the dev when it comes to fix and the "high" price tag for a dll that might become abandoned by the dev at any time is kind of a no go..)

    edit: looking at the manual it seems that it is full source! :)
    edit2: god so sorry I should take time to read all the post! It's full source yay, sounds like an insta buy.
     
  9. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Can't answer the DLL/source question.. Hopefully it at least has the source available in a zip to have in the event that he might disappear some day. Hope that is never the case since he seems to be one of the few responsive asset devs out there..

    As far as what you can do with it, he linked the online manual a couple of posts up.. --> Manual

    It should give you an idea of what you can do with it.

    I'm still watching for it to hit the asset store, @TonyLi! We need to light a fire under the folks that do approvals. heheh Also watching for the procedural quest system. Definitely keep me on your list of folks interested in that one too!
     
  10. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I'm sure it will be out soon. Hang in there! :)
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @Nyt0 - yes, just to confirm, it's full source, thoroughly documented. The API reference is here. (Thanks for pointing out the manual link, @Shawn67!) The price I submitted to the Asset Store is $35 USD. I encourage you to look through the manuals for both products and choose the one that you feel is appropriate for your needs. Differences from the other product include:
    • You can define the exact personality values and relationship values that you want to use in your game. It comes with templates for the OCEAN model and others if you want to get a quick start.
    • NPCs remember deeds and can gossip (share memories of deeds) with each other.
    • Has integration with PlayMaker, Behavior Designer, and the Dialogue System. Opsive is putting the finishing touches on the Behavior Designer integration. I plan to add integration for ORK RPG Framework and Realistic FPS Prefab.
    The full source is in a Scripts folder, no DLLs.

    I'll take some of that "Hang in there", too! Thanks! It's a bit of a black box once it's submitted, and I'm sure they're busy with post-GDC stuff, too, but I'm also eagerly waiting to hear back from them. I'll post here when it's available!
     
    BackwoodsGaming likes this.
  12. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Seems that a lot of authors are having issues getting updates/assets submitted since the 5 release. And I wasn't being impatient on your end. The whole submit and wait is beyond your control. Doesn't help with the patience tho.. heh
     
  13. Nyt0x

    Nyt0x

    Joined:
    Feb 3, 2014
    Posts:
    18
    @TonyLi and @Shawn67 Thx for all the infos and links!
    I know there are differences, and the other asset is doing things differently but the way I see it is that 35$ full source against more than 100$ dll I can just buy your product and see if it fit my needs, if not that's ok I can put that amount just to take a look at the source, always interested to see how people implement things.
     
    BackwoodsGaming likes this.
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Love/Hate is now live on the Asset Store!
     
    Karearea, Licarell, twobob and 2 others like this.
  15. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Bought instantly! Major puzzle piece is now in my box!

    Thanks for the hard work Tony, looking forward to how far you can take this...
     
  16. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Yay, Tony! I have been waiting for this! Thanks so much. Can't wait to play with it. :)
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks @Licarell and @Teila - If you notice any issues or have any feature requests, just let me know!
     
  18. halfbot

    halfbot

    Joined:
    Sep 22, 2013
    Posts:
    19
    Sweet. Just bought it. Cant wait to play around with this this long weekend!! Thanks Tony.
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Thanks, @halfbot! I'll be around, updating a bigger testbed demo for Love/Hate, so if you have any questions, please post here, PM, or email me at tony (at) pixelcrushers.com.
     
    halfbot likes this.
  20. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    So I fiddled around converting it to 3d.

    Really nice system, can't speak to data integrity so far but nice UI and, after the learning curve, nicely laid out.

    From a usability point of view I will be implementing a "button spam" cool-down.
    I recognise this is just a demo and not indicative of best practice.. however this does lead into a question of overall optimisation strategies.

    A first reflective refocusing might be trimming down the completion path on calculation, or ideally, even making it frame-spanning as the current loop is a bit chunky on the example databases when hit hard. Does it frame span already? I will go digging.

    This indicates that a more complex psychological arrangement with more than a few factions / faction members a no-go for real-time on anything but desktop, whereas a non-blocking info request could be tamed across a few frames. A Performance Hit vs Fast Results model (slider) would be obviously ideal.

    (Button Spamming)
    upload_2015-4-3_19-30-46.png

    I appreciate that it is up to the developer to limit the input wisely but (for example mid-battle) that might be better handled in the engine than some noodle mid-ware code imagined up by all and sundry on a piece-meal basis.
    Support nightmare.

    A gizmo or two might not hurt, I will certainly be slapping a few on my version here to make it a bit easier on the mind in Scene view.

    Final note is about the whole "GetComponent" pattern on the Colliders / Triggers / Whatevers.
    It would be really nice to see a Type of Collider/(GameObject/Whatever) implemented that upon Collision/Triggering returns the required components reference as a first class property of said class. Or something, clever, that demonstrates a better way to avoid this pattern. Which whilst may seem relatively efficient at low revs really does glue up the engine once you open it up. Every time as far as I can make out.

    So anyway, religious and political discussions aside (I can see Hippo spinning in his chair) this seems like a perfect solution to an incredibly tricky-to-implement-well-yourself problem. Will make a few more tests before I decide on any hard and fast metrics but would be interested to see how much removing all those "foreach"s etc could shave off of it.

    Nice one
     
    Last edited: Apr 3, 2015
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @twobob - Thanks very much for the feedback! I have some followup questions.

    What's your intended purpose for the "button spam" cool-down? I ask because Love/Hate may already provide the functionality. A faction member has an acclimatization curve, which defines how quickly it gets accustomed to deeds. The default curve tapers off at 20 repetitions. So the first time you insult Horn Girl, your deed will have full impact on her. But after the 20th insult, it will have no impact. She's so acclimated to your insults that she ignores them. Once all the insults have fallen out of her memory, new insults will have impact once again. This prevents you from spamming deeds to game your faction with an NPC.

    If you want to implement a cool-down for a different reason, could you explain why? Other people might find it useful, too. If it's to prevent CPU spikes, please see below.

    The core evaluation method doesn't span frames because it only runs a handful of floating point operations and int-indexed array lookups. But frame-spanning is still a good idea. If you commit a deed in the middle of crowd of a hundred NPCs, each one will run the evaluation method. I'll distribute these across frames.

    As for the demo scene, the CPU spikes are probably due to the demo scripts, not the core Love/Hate code. I'll dig into it and confirm.

    Great idea! I'll add a gizmo for faction members. Would any others be helpful? Should the gizmo show the faction name, or just an icon indicating that the GameObject has a FactionMember component?

    I'm not sure I follow. Which GetComponent's and foreach's are you referring to?

    And thanks again for the detailed feedback!
     
    twobob likes this.
  22. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    basically on a test with 3 characters and the main player a single click results in a long solution time
    I can mock this up and it online but the databases, scripts, implementation, pretty much everything is just gutted from your demo, I see no obvious gaffs in implementation, yet... But I will double check.

    Thus gating the input on something like that could be key.

    I also get stutter when trying out your 2d web demo. Even on my desktop.

    Thanks for your consideration.

    EDIT: Wait... I think this is caused by the debug being on by default... let me go check
     
  23. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Edit. Heh. Yeah. it was the debug, which was on by default? in the demo? anyways. needless to say I will amend my earlier test.
     
  24. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    [EDIT: Was typing when you posted about debug. That's exactly what I ask going to ask. I figured the debug info would be helpful when playing with the demo in the editor, to show you what's going on under the hood. Maybe that wasn't such a good idea. :)]

    In the next version, I'll still distribute evaluation for different NPCs across frames.
     
    BackwoodsGaming likes this.
  25. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Excellent, really appreciate your timely, professional and helpful feedback.
    Great product

    I will track down the offending foreach's (spotted them in passing in the guts), the GetComponent<YourType> is the model you use for all collisions (2d in the demo) - an alternate speciliased collision - perhaps with a collider-side protocol? - could alleviate this problem by passing the value by reference upon collision.

    Was that any clearer?

    Will get back to you on the gizmos when I have had a chance to check.
     
    Last edited: Apr 3, 2015
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I'm still trying to sort out my thoughts, but generally speaking I would probably tend toward using cool-downs to help smooth out behavior influences.

    Alternative methods to a cool-down could include responding to too many judgment events in a short period by becoming momentarily overwhelmed, hesitant, or confused - which are all kind of like a cool-down behavior - or possibly irritated, wary, and/or suspicious. I suppose in the PAD model, a lot of judgment events in a short period of time could be taken as "arousal" and handled that way.

    Most of the time I think you'd want a lengthy cool-down on reactions as you wouldn't want situations where a character's reactions are purposefully being whipsawed back and forth (except maybe to demonstrate shallowness for comedic value). And in most cases you wouldn't necessarily want a rapid escalation in an attitude, you'd want some temporizing instead ... except possibly in case of being intimidated. In that case, the whole goal is to rapidly move the target's attitude in a direction of compliance, so with intimidation it would probably be better to have something more like an acceleration toward compliance rather than a cool-down, depending on how rapidly the intimidating events come in. Again, I guess this is something that might be handled by the PAD method, as rapid acts of intimidation could bring a heightened state of arousal, trying to get the character to cross the excitability threshold.
     
    twobob likes this.
  27. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yeah. The curves do cover a lot of that ground in the short term

    upload_2015-4-3_22-6-33.png

    I was thinking more of "network-storm" fire-walling. However you make great points about medium term handling - and - as you said - this could possibly just be handled by a trait all of it's own or by cross utilising aspects of the others.

    Do I say I love this?
    I do.
     
  28. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    If a character can have membership in several factions, maybe it is best to allow each faction to be represented by a symbol that can also have a color assigned. Then those symbols would be strung together. Or something like that. ;)
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Please do let me know about any foreach's whose performance you're concerned about. There are a few in the code, but in testing there wasn't a significant difference from using a hashed lookup such as a Dictionary.

    I'm afraid I still don't follow you regarding GetComponent. In the core scripts, there's only one GetComponent, in the default perception check method. In the interaction scripts, it's only used in Awake and in OnTriggerEnter/OnTriggerEnter2D. Do you have any performance concerns about them?

    That's a good idea for another behavior that you could add to an NPC. The behavior would implement IWitnessDeed and do what you describe if it witnesses too many events done to itself in a short period.

    I'll have to give this some thought and reply back later. Off the top of my head, you're right that negative actions should generally escalate immediately, especially things like being attacked or witnessing friends being killed. The system already simulates warming up to deeds -- for example, when a character's pleasure is high, it responds more positively. As the player does more nice things to the character, the character's pleasure and affinity to the player both increase, which increases the effective impact of the deed. At the same time, the acclimatization curve can tamp it down, to simulate the character getting accustomed to the deed.

    What do you mean by "network-storm" fire-walling?

    Thanks! And let me say again that I really appreciate all the feedback that all of you are providing. I want Love/Hate to be as useful, and easy to use, as possible. Your ideas help make that happen.

    Hmm, not a bad idea. In a typical scenario then, it would be easy to tell, say, goblins (red) from villagers (green) from soldiers (blue). And a soldier from the village would have blue and green. I like it!
     
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    "What do you mean by "network-storm" fire-walling?"​

    I meant: Preventing http://www.techopedia.com/definition/6270/broadcast-storm but making reference to that pattern in regards to "event bubbling" (via near neighbour passing and gossip)


    About the foreach's - as I understand it 24b of garbage will be created each time one is iterated.
    So - in general - wherever an alternate enumeration is possible that is the one I will choose.

    At first glance this would appear to happen in several places
    Code (csharp):
    1. \Assets\Pixel Crushers\LoveHate\Example\Scripts\InteractionUI.cs(73):       foreach (var parentID in member.faction.parents)
    2. \Assets\Pixel Crushers\LoveHate\Example\Scripts\InteractionUI.cs(92):       foreach (var relationship in member.faction.relationships)
    3. \Assets\Pixel Crushers\LoveHate\Example\Scripts\InteractionUI.cs(98):       foreach (var rumor in member.longTermMemory)
    4. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\Faction.cs(63):       foreach (int p in parents)
    5. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\Faction.cs(102):       foreach (var current in relationships)
    6. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(61):       foreach (var faction in factions)
    7. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(78):       foreach (var faction in factions)
    8. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(95):       foreach (var faction in factions)
    9. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(129):       foreach (var parentID in faction.parents)
    10. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(174):         foreach (var relationship in parent.relationships)
    11. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(299):       foreach (var subjectParentFactionID in subject.parents)
    12. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(317):       foreach (var judgeParentFactionID in judge.parents)
    13. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(334):       foreach (var judgeParentFactionID in judge.parents)
    14. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\FactionDatabase.cs(336):         foreach (var subjectParentFactionID in subject.parents)
    15. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Database\Traits.cs(46):           foreach (var database in Resources.FindObjectsOfTypeAll<FactionDatabase>())
    16. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionManager.cs(50):       foreach (var faction in factionDatabase.factions)
    17. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionManager.cs(341):       foreach (var members in m_members.Values)
    18. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionManager.cs(343):         foreach (var member in members)
    19. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionMember.cs(158):           foreach (var database in Resources.FindObjectsOfTypeAll<FactionDatabase>())
    20. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionMember.cs(307):       foreach (var rumor in longTermMemory)
    21. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionMember.cs(327):       foreach (var rumor in longTermMemory)
    22. \Assets\Pixel Crushers\LoveHate\Scripts\Core\Faction Members\FactionMember.cs(542):       foreach (var rumor in longTermMemory)
    23. \Assets\Pixel Crushers\LoveHate\Scripts\Interaction\Greeting\AbstractGreetingTrigger.cs(62):       foreach (var greeting in greetings)
    I also favour anything other than co-routines when an InvokeRepeating will do for the same reasons
    upload_2015-4-4_0-39-59.png


    And Yes, Demonstrating a "colliidee-side" lookup-free component reference system would be cooler than the constant requirement to lookup the "hit" component. It's not essential, just would have been a nice to have OOTB. It's a personal dislike for the implicit waste that occurs as a result of the DOM-style component lookups.

    Having spent weeks (months even) getting together the latest "truly tidy toolset" from the many options available I have to admit I am pretty reticent to idly let anything through that is going to make life more difficult down the road, a) targeting other platforms b) where GC policies are various and optimising for them all is a nightmare c) when I try to strap a game on top and wonder why I get random glitches. All of which have happened, many times over, hence me bothering to weld together "a better toolset"

    Hope that is a tad clearer.
     
    Last edited: Apr 4, 2015
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Got it. The design already regulates this. Gossip does a self-check and also updates the other gossiper, so they can't get into a feedback loop. On top of this, there's a minimum time between gossiping to prevent gossip spam. Witnessing deeds is one-way. Witnesses don't acknowledge that they've witnessed; they just update their own internal state. Now if you write some AI on top of Love/Hate that causes the witness to commit a deed in response, this could cause a chain reaction, but that's entirely up to you, and it's kind of realistic. If person A yells at person B, B might respond by pushing, then A will counter by punching, and so on. But again it's above Love/Hate, and it's up to how you want to handle it.

    Darn, thank you for reminding me. Having dug into the code, you've probably seen that Love/Hate uses object pooling everywhere, but the foreach garbage totally slipped my mind. I'll get rid of them all in the next release.

    Could you describe in a little more detail how you envision this working? I want to make sure I have it all clear.
     
    twobob likes this.
  32. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Feel free to ignore the following navel-gazing ideal-world ramblings should you wish
    Magic pseudo code
    Code (csharp):
    1.  
    2. ///
    3. //This (catchily named) class - and ones like it - should be crafted to replace all
    4. ///component lookups by embedding the expected information references ahead of time
    5. ///
    6. FactionedGameObjectWithReference: GameObject
    7. {
    8. Public ?FactionMember member
    9. Public Gameobject obj;
    10. }
    11.  
    and the relevant base constructor.

    to make OnTriggerEnter
    work like

    Code (csharp):
    1.  
    2. private void OnTriggerEnter(Collider coll)
    3. {
    4. target = coll.gameObject.member;
    5. }
    6.  
    instead of

    Code (csharp):
    1.  
    2. private void OnTriggerEnter(Collider coll)
    3. {
    4. target = coll.gameObject.GetComponent<FactionMember>();
    5. }
    6.  
    See what I mean?

    and before anyone says anything GameObject is a Sealed class, I am trying to make a general point. That wouldn't prevent

    Code (csharp):
    1.  
    2. ///
    3. //This (catchily named) class - and ones like it - should be crafted to replace all
    4. ///component lookups by embedding the expected information references ahead of time
    5. ///
    6. FactionedGameObjectWithReference // Not derived
    7. {
    8. Public ?FactionMember member
    9. Public Gameobject obj;
    10. }
    11.  
    I seem to recall Tryz from ooti solved this issue in a similar way, basically I am suggesting using an alternate pattern - whatever / actual / solution you come up with - that prevents the need for constant run-time lookups - via making the HIT object already contain a public reference to the component.
    Stupid changes such as these will pay dividends in the future - not only here - but in all your product demos :) (It's just my opinion, but I believe it)

    also I threw you a PM about

    upload_2015-4-4_0-52-35.png
    as that is an odd one to do with animators - with a known fix - thanks to the Inventory System author.


    Nice one for removing that other garbage problem for the next release.
    Here is a 6 people + 1 player intentionally chaotic cluster.
    NavMeshAgents constantly moving in and out of each other triggers.REALLY FAST.. (nasty ey)

    I would suggest this is /waaaaaay/ less spam than the average battle.

    and nothing compared to a huge dynamic crowd scene...

    Those spikes are me pressing "Flatter" when under such stupid strain.

    upload_2015-4-4_2-20-0.png

    I am not even sure all of that is your garbage but it is the Total Burden that is causing that utter belch. In this convoluted situation of per-frame torture; a large part of that burden is inevitably the constant component look-ups.

    As you can see, and as you know, even on the desktop (Standalones); stupidly tiny things matter done often enough. Also actually implementing such a situation would be really stupid... I mean no-one would ever implement hundreds of colliders potentially being triggered like that...

    We have all been at this meeting:
    Me: We should think of implementing a minimum footprint solution since we are cognizant of the hardware restrictions...

    Client: I like trees (with 50 colliders per branch) and those Shuriken rain particles, ooh World Colliding rain on hundreds of trees... ooh ooh let's give every rain drop emotions and affect each tree it falls upon, NO! each leaf and we can have different types of rain... Can each molecule have an emotion?

    Hence my fervor. Just because it is stupid does not stop anyone doing it. Filters, load-spreading mechanics and proper defensive design suggestions do ;)

    Cheers
     
    Last edited: Apr 4, 2015
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I might add - anyone thinking of buying this system - the above post is picking at the very bones of the project - moreover the demo implementation, ephemeris at best.

    The system as far as I can see is excellent - don't let the previous post influence your judgement to the contrary
     
    TonyLi likes this.
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Not at all! I'll get as many of these suggestions as I can into the next release. I placed a high priority on optimizing performance as you've seen with the ubiquitous object pooling and overall design, but the individual suggestions you've pointed out will help bring it that much closer to perfect. ;)
     
    BackwoodsGaming and twobob like this.
  35. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    A better answer I could not have hoped for.

    Many thanks from all your future users. And me.



    I did stress test it to a few HUNDRED and it stood up well.

    upload_2015-4-4_5-0-37.png

    amazing
     
    Last edited: Apr 4, 2015
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    We all love efficiency. And hate wasted cycles. :)
     
    twobob likes this.
  37. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I think we're in the same frame of mind on this, but just to be clear, here's another example.

    Let's say we've got a game set in a fictional Renaissance Italy. Five colors represent five families or five cities. Four symbols represent four ranks of citizen: diamond is merchant, spade is nobleman, club is peasant, heart is church. So you could have a yellow diamond or a purple heart, or whatever, but it is easy to figure out the basic factions at a glance.

    Then you could add in additional colored symbols to represent other alliances with guilds, secret societies, street gangs, mercenary companies, and so on. So in a complex system like that there could be several colored symbols in a string, but in a typical system there would be something simple like one colored symbol: white / black for good / evil or blue / red for friendly / hostile, and a symbol for class (ranger, bard, thief, etc.).
     
  38. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    @hopeful - To minimize visual clutter in the Scene view, what if the main gizmo (probably a heart) is the character's faction color, with a stack of colored bars for the parent factions?
     
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    If the idea is to have symbols show up in the editor's scene view, as I think about it I guess that it may not have much impact for me, as I expect most of my characters will be procedurally generated. Probably it would be helpful for many, though, to have a heart show up if a character has been assigned a faction, with a color that represents the faction.

    If I end up implementing L/H, I'd likely set up some test indicators in game mode that could potentially be revealed to players.

    Like, in the case of intimidation, once an attempt at intimidation starts maybe there'd be a symbol over the target's head representing the current stage of intimidation ... which would be handy for me to eyeball in testing, and potentially handy for players to eyeball during play as well, to know if they are getting anywhere with that ploy.

    Another example would be to have a "witness" symbol appear for a character when that event occurs, and possibly one for a "gossip" or "sharing rumors" state.

    While I haven't really gotten into the PAD / RPG / OCEAN aspects yet, maybe there's stuff there that could eventually benefit from symbolic tracking measures, like an "excited" status under PAD.
     
  40. Parallaxe

    Parallaxe

    Joined:
    Apr 9, 2013
    Posts:
    118
    If it's from TonyLi then it will be awesome (his DialogueSystem can't be praised highly enough). Just bought "Love & Hate". I'm curious to see how it blends in with DialogueSystem.
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @hopeful - I'll introduce more examples of this in upcoming versions. The system is designed to make it easy to add things like this if you want, or leave them off if you don't want them. The demo shows a very simplified version of this, animating a heart cartoon bubble when a witness approves of a deed or a tear bubble when the witness disapproves.

    Thanks, @Parallaxe! In the Dialogue System + Love/Hate example folder, you'll find a dialogue database that uses two new Lua commands heavily: GetAffinity() and ReportDeed(). There are a lot of new Lua commands, but these two alone will let you do all kinds of interesting things with the two products. If you have any questions about using Love/Hate with the Dialogue System, or any ideas or feature requests, just let me know![/USER]
     
    Licarell and hopeful like this.
  42. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Hi Tony, I hope that some detailed step by step tut's on DS and LH ties will come soon, (how data and variables are passed back and fourth) also the example of the vampire and purity settings, would that be tied into pathfinding so the vampires would stay away from certain areas? I have no idea how to wire something like that up?
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @Licarell - I plan to do some video tutorials, one of them for DS + LH. I'll add a pathfinding one to the list also!
     
  44. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    GREAT!

    BTW, My pathfinding flavor is APEX, thought I would just throw that pencil up in the air...:rolleyes:
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    I'll use Unity's built-in navigation in the tutorial, but I'll make sure it's written to be applicable to any pathfinding system.
     
  46. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    upload_2015-4-4_20-47-6.png

    50+ emotion aware roaming navMesh agents. Stats.
    Very decent. even with the old garbage sub .5 ms for the Behaviour updates.

    all working in-game 3d.
    upload_2015-4-4_20-49-49.png
    The spikes are camera.render and NavMeshManager as they should be :)


    Really very pleased I got this.
    Viva the next update!
     
    BackwoodsGaming and TonyLi like this.
  47. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Once you start putting faces to the numbers it becomes somehow more real.

    upload_2015-4-5_6-17-34.png

    upload_2015-4-5_6-26-3.png

    upload_2015-4-5_6-29-40.png

    upload_2015-4-5_6-30-28.png

    moody ;)
    upload_2015-4-5_6-34-14.png

    Seldom have I been so excited about a twiddly thing. Top job,
     
    TonyLi likes this.
  48. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Gave me a moan about "deeds not being reportable" on webplayer
    A different null reference error on Win 8.1...
    So I did a "simpler build" target (classic windows) Hmm, mystery, does that on x86_64,

    upload_2015-4-5_15-3-17.png

    Need to add some logical debugs and figure out if something is not being stored right, or what....

    I have no further details, will see if I can find it

    EDIT: Log is not much help..

    A script behaviour has a different serialization layout when loading. (Read 32 bytes but expected 1096 bytes)
    Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    (Filename: C:/buildslave/unity/build/Runtime/Serialize/SerializedFile.cpp Line: 1652)
    there aren't any #ifdef UNITY_EDITOR calls I can find.

    Will go try this in the alternate, utterly clean demo.

    EDIT: Okay demo works fine. this appears to be an UBER annoying transitory error that is reported spuriously when in fact something else is missing.

    (I have indeed been thru and gutted out all non-standard "plugins" folder structures, next up I am gutting everything else)
    Okay so I have basically deleted everything from the project and I still get

    upload_2015-4-5_16-49-6.png

    This isn't your error.

    Will have to rebuild from scratch. Sigh.. Thanks for listening.

    when I /do/ manage to get an error from your side it is:
    upload_2015-4-5_17-38-1.png
     
    Last edited: Apr 5, 2015
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    Hi @twobob - The example scene's NPC script assumes that the NPC has an Animator component, and that its animator controller has states "Happy" and "Sad". The actual Love/Hate code has thorough error-checking and validation, but the example scripts are written to be short and easy to understand rather than super-robust.
     
  50. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    ah. fair point. Let me go wedge in some basic holders for those states... I did actually do that in the 1st instance and then rolled it out to the other NPC's, perhaps I missed a step.

    Excellent support by the way. Happy holidays.