Page 1 of 2

sync actors and factions?

Posted: Mon May 24, 2021 6:17 pm
by NotVeryProfessional
Is there a way to keep actors in the Dialogue System database and factions in the Love/Hate database in sync?

And/or to link them together, so the two systems understand that this NPC is that actor and that faction? Other than attaching the relevant components to a gameObject, of course. I'm especially thinking about off-scene actors (i.e. when the character is somewhere else, and rumours are spreading behind his back).

Re: sync actors and factions?

Posted: Mon May 24, 2021 9:20 pm
by Tony Li
Hi,

No, the current way is to assign a DialogueActor and FactionMember component. If you have any suggestions or feature requests that would make it easier to manage, please let me know.

Re: sync actors and factions?

Posted: Mon Jun 21, 2021 9:07 am
by NotVeryProfessional
Just a simple script to keep them in sync would be great. At the moment, I add every NPC to both the faction and the dialogue database.

Re: sync actors and factions?

Posted: Mon Jun 21, 2021 9:48 am
by Tony Li
How should the feature work? Do you envision more of a design-time thing or runtime?

Re: sync actors and factions?

Posted: Mon Jun 21, 2021 1:41 pm
by NotVeryProfessional
Design time, definitely.

The ideal would be to have a merged entity that both Dialogue System and Love/Hate can access. Maybe a class that's derived from both Faction Member and Dialogue Actor.

The probably easiest that would be a big help already would be a simple button or menu function that copies all Actors into the Faction database and/or all Factions into the Dialogue actor database, if they don't already exist.

One step up would be a checkbox to select if it should be copied or not. For example in Love/Hate I have factions that are groups and factions that are individuals (say, "village of X" and "Hans, a villager in X" who then has the village faction as a parent faction. Only individuals should become Dialogue System Actors, obviously.


Probably want to add something like "me" or "Actor" / "Conversant" for the Lua Functions to Love/Hate as well, but that's not my use case as I run all the actual dialog through Ink.

Re: sync actors and factions?

Posted: Mon Jun 21, 2021 3:45 pm
by Tony Li
How about a LoveHateDialogueActor component that's a FactionMember-aware subclass of DialogueActor? The inspector could have buttons to add a faction/FactionMember or a Dialogue System actor if any are missing.

Re: sync actors and factions?

Posted: Tue Jun 22, 2021 6:03 am
by NotVeryProfessional
Yes, something like that. In the underlying business logic, faction member and dialogue actor are really the same person. So the code logic should express that identity, that would reduce the possibility for mistakes.

Re: sync actors and factions?

Posted: Tue Jun 22, 2021 8:45 am
by Tony Li
Sounds good. I'll try to get a patch out within the week.

Re: sync actors and factions?

Posted: Fri Jun 25, 2021 6:13 pm
by Tony Li
Here's the updated Dialogue System integration for Love/Hate:

LH_DialogueSystemSupport_2021-06-25.unitypackage

It has a new component LoveHateDialogueActor that replaces the Dialogue System's Dialogue Actor.

Re: sync actors and factions?

Posted: Mon Jun 28, 2021 3:26 am
by NotVeryProfessional
I see that this component does some additional checks and otherwise is the same as the DialogueActor component, correct?

Here's my setup - with the new component added. I don't see a difference to using a regular DialogueActor component, so I assume that the additional checks in the code are all there is.
Bildschirmfoto 2021-06-28 um 09.19.43.png
Bildschirmfoto 2021-06-28 um 09.19.43.png (411.62 KiB) Viewed 3178 times

My perfect use case would be to have ONE component that is both a Dialogue Actor and a Faction Member. And since the Dialogue DB is essentially just a list of names, it would use the Faction Database as its data source. Dialogue System needs the actor list internally for the dialogue trees, so something to keep them in sync would also be needed.

I'm not sure if that is in line with your vision, as it would integrate the two systems much more closely and you may prefer loose coupling. I also have no idea how much work that would be.


But this is absolutely workable, and the additional checking is a good helper to ensure that no mistakes happen.