Our character plugin provides a simple way to set up Social Groups. Social Groups are freestanding conversational groups, with 2-10 participants. In theory, groups bigger than 10 are possible, but have not been tested.
- Finding the Blueprint
- Quick Start
- Social Group Actor
- Social Group Behavior
- Useful Functions
- Known Issues
Finding the Blueprint
First make sure that "Show Plugin Content" is enabled in the Content Browser and then navigate to the Character Plugin folder.
In the Character Plugin folder, simply navigate to Blueprints/SocialGroups and place the SocialGroupBP Blueprint into the scene.
Quick Start
At first, depending on the size of the group, place the desired amount of VHs into the scene. Make sure that each VH has the VHSocialGroups
and VHGazing
component added. Then place the Social Group blueprint into the scene. In the details panel of the Social Group actor, make sure that Spawn as Group
is false, then add the VHs to the Agents in Group
array. Under dialogue, make sure that Start Dialogue
is false, as this requires additional setup. That's all, if you press play, the agents should arrange themselves in a circular formation around the Social Group actor and follow the behavior described in the Social Group Behavior section.
Adding Dialogue
First of all, make sure that all the VHs that are in the group, have the VHSpeech
, VHAudiofileSourceComponent
and VHFaceAnimation
(LiveLink, OpenFace or OculusLipsync see LipSync) components. In the details panel of the Social Group actor, enable Start Dialogue
. Create entries in the Dialogues
array, in the form of Paths to the LipSync and Audio files. These files will be used by the VHAudiofileSourceComponent
and VHFaceAnimation
. For more information, see LipSync and Virtual Acoustic Plugin. Additionally, specify the gender of the agent, that this dialogue should be assigned to. Add as many dialogues as you want. Finally, specify the number of agents, the dialogues should be distributed between and decide, if the dialogue should be looped, once it has finished. E.g. the Dialogues
array contains five entries and Number of Agents in Conversation
is set to three. Then three agents will be chosen at random, matching the gender if possible. The first three dialogues will then be distributed to the 3 agents, the fourth dialogue will be assigned to the first agent and the fifth one to the second agent.
Spawn in Group formation
Instead of placing VHs into the scene and adding them to the Social Group, it is also possible to activate Spawn as Group
. You can then specify the amount of agents you want to spawn and also provide the types of VHs that should be spawned in the VHTypes
array. Ideally, you want the amount of entries in theVHTypes
array to match the group size, otherwise the same agent will get spawned twice.
Social Group Actor
The Social Group actor will show up in the scene as white sphere and will not be visible during the game. Move the Actor to the position, where the center of the group should be. In the details panel under the category Social Group, the following properties can be changed:
Parameter | Details |
---|---|
Agents in Group | Only available to edit, if Spawn as Group is turned off. Allows the user to specify the agents, that should form a group. |
Spawn as Group | If this is set to true, the agents will spawn automatically. |
Group Size | The amount of agents that shall be spawned, if Spawn as Group is set to true. |
VH Types | The different types of VHs that will be spawned. If Spawn as Group is set to true, provide at least one entry here, otherwise no agent will be spawned. Ideally, the amount of entries should be equal to the group size, otherwise, the same agent might get spawned twice. |
Conversation Distance | Default: 140. Specifies the distance between each VH. |
Gaze Distance | Default: 220. The Euclidean distance between a non group actor (e.g. the user) and a group member. Below this distance, the agent in the group will gaze at the outsider. See State Machine. |
Still Standing Variance | Default: 100. The radius in which the user is allowed to move, before a leave is detected. See State Machine. |
Join Distance | Default: 100. The Euclidean distance to the group, before a leave is detected. See State Machine. |
To Group Threshold | Default: 30. If the users angular distance to the group center is below this angle, he is classified as oriented towards the group. See State Machine. |
When tinkering around with these values, make sure the following relationship is preserved: Gaze Distance > Join Distance >= Still Standing Variance.
Under the Subcategory Dialogue, parameters can be found for setting up the dialogue system of the Social Group.
Parameter | Details |
---|---|
Dialogues | A list of Dialogues, that will be distributed among the group members. |
Start Dialogue | If true, the dialogue system will start with the game |
Number of Agents in Conversation | Specifies, on how many group members, the Dialogues will be distributed. |
Loop Dialogue | If true, dialogue is replayed again. |
Dialogues
is a list containing parameters necessary to make agents speak and includes:
Parameter | Details |
---|---|
Animation File | The path to the animation file, used by the VHFaceAnimation component. See Face Animation |
Audiofile | The path to the audiofile, used by the Virtual Acoustic Plugin. |
Gender | The gender of the group member, this dialogue should be assigned to. |
Social Group Behavior
The "behavior" of the Social Group is programmed as a state machine. The following state machine provides an overview of the behavior.
Because the group forms a circular arrangement, we specify D as the distance between the user and the group center minus the group radius, i.e. the distance between the user and the perimeter of the circle. We start in the Idle state. If D is smaller than the Gaze Distance, the group changes to the gazing state.
Gazing
The two agents closest to the user, add the user to their gazing pattern. If the distance increases to D > GazeDistance + R/3, we go back to the Idle state. To not jump around sates, R/3 was added (R = Group Radius). If the distance decreases to D < JoinDistance and if the user is oriented towards the group center, a join is detected and the state changes to In Group.
In Group
If the user is in the group, he is added to the agents gazing pattern. If the distance to the group center increases to D > JoinDistance + StillStandingVariance and if the user is not oriented to the group center anymore, a leave is detected and the state is changed to Leaving.
Leaving
The Leaving state, ensures, that the user needs to increase his distance to D > GazeDistance + R/3 in order for a new Join to be detected.
Useful Functions
The VHSocialGroups component introduces the following functions:
-
JoinGroup(ASocialGroup SG)
Makes the agent walk towards the given Social Group. If close enough, the agent will join the group. -
LeaveGroup()
Removes the agent from its current Social Group. After this call a movement call should follow, otherwise, the agent will not move away from the group.
The Social Group actor introduces the following functions:
-
JoinGroup(AVirtualHuman* VH)
Makes the given agent walk towards the Social Group. If close enough, the agent will join the group. -
LeaveGroup(AVirtualHuman* VH)
Removes the given agent from the Social Group. After this call a movement call should follow, otherwise, the agent will not move away from the group.
Known Issues
- When agents do not spawn in group formation, they might get stuck while forming the group.
- Re-arrange the agents so they are roughly in a group formation
- It seems hard to join a group of size 2
- Play around with the distance values in the SocialGroup actor. Setting
JoinDistance
andStillStandingVariance
to 150 seems to work good here.
- Play around with the distance values in the SocialGroup actor. Setting
- Whenever
SetupDialogue()
is called, the game lags, as the LipSync and Sound files will be preloaded. Currently,SetupDialogue()
is called, when the Dialogue starts for the first time, when an agent joins the group and when an agent that was part of the conversation left the group.