Skip to main content

Mutations Showcase

This room showcases various ways in which Character Mutations can be utilized to modify the properties of Inworld characters at runtime in Unity.

Playground Mutations Showcase

Description and Motivation Mutation

The Description and Motivation Mutation showcase is an example of how you can use Parameters and Character Mutations to modify properties of an Inworld character at runtime.

In this example we modify the Motivation and Core Description of a character to update their favorite food.

Description and Motivation Mutation Showcase

In the Unity Playground there is a UI panel where the player can select either the chocolate or pizza icon to set the Mutation Bot's favorite food.

Description and Motivation Mutation Panel

When a food type is selected the client sends a trigger containing a favorite_food parameter to activate the change_food_type goal.

public void OnChocolateToggleValueChanged(bool value)
{
if (!value) return;

m_InworldCharacter.SendTrigger("change_food_type", false, new Dictionary<string, string>()
{
{
"favorite_food",
"chocolate"
}
});
}

public void OnPizzaToggleValueChanged(bool value)
{
if (!value) return;

m_InworldCharacter.SendTrigger("change_food_type", false, new Dictionary<string, string>()
{
{
"favorite_food",
"pizza"
}
});
}

This updates the Mutation Bot's Motivation and Core Description.

goals:
- name: "change_food_type"
repeatable: true
activation:
trigger: "change_food_type"
actions:
- character_changes:
set_motivation: "{character} wants to serve {{p.favorite_food}} to {player}."
set_core_description: "Mutations Bot is a {{p.favorite_food}} fanatic. They are quick to tell {player} fun facts about {{p.favorite_food}}.{character}'s favorite food is {{p.favorite_food}}."

For example, if pizza is selected the Motivation will be set to: "{character} wants to serve pizza to {player}." and the Core Description will be set to: "Mutations Bot is a pizza fanatic. They are quick to tell {player} fun facts about pizza. {character}'s favorite food is pizza."

Description and Motivation Mutation Pizza

For more information on utilizing Parameters see Customizable parameters changing action in runtime. For more information on modifying character fields at runtime checkout Character Mutations.

Relationship and Emotion Mutation

The Relationship and Emotion Mutation showcase is an example of how Character Mutations can be used to dynamically update the Emotion and Relationship parameters of an Inworld character at runtime.

In this example, you can set the Trust Bot's trust level to compare their willingness to provide secret information to the player with differing relationship parameters and emotional state.

Relationship and Emotion Mutation Showcase

In the Unity Playground demo the 'Trust level' can be set using the provided UI panel. There are three Trust levels to choose from, either Suspicious, Uncertain, or Trusting.

When you select a Trust level a trigger is sent to the server to activate a goal corresponding with the level of trust. See how the Relationship and Emotion parameters are modified depending on the Trust level in the Goals YAML below:

Suspicious

goals:
- name: trust_level1
repeatable: true
activation:
trigger: trust_level1
actions:
- character_changes:
set_relationship: ENEMY
set_relationship_primitives:
trust: -1000
respect: 0
familiar: 0
set_personality:
negative_positive: 4
cautious_open: 2
introvert_extravert: 2
set_mood:
disgust_trust: 2
set_emotion: ANGER
set_motivation: "{character} doesn't want to tell player any information at all."

Uncertain

goals:
- name: trust_level2
repeatable: true
activation:
trigger: trust_level2
actions:
- character_changes:
set_relationship: ACQUAINTANCE
set_relationship_primitives:
trust: 0
respect: 4
familiar: 4
set_personality:
negative_positive: 6
cautious_open: 5
introvert_extravert: 5
set_mood:
disgust_trust: 5
set_emotion: NEUTRAL
set_motivation: "{character} wants to find a way to trust {player} but isnt ready to share secrets just yet."

Trusting

goals:
- name: trust_level3
repeatable: true
activation:
trigger: trust_level3
actions:
- character_changes:
set_relationship: CLOSE_FRIEND
set_relationship_primitives:
trust: 1000
respect: 9
familiar: 9
set_personality:
negative_positive: 9
cautious_open: 9
introvert_extravert: 9
set_mood:
disgust_trust: 9
set_emotion: JOY
set_motivation: "{character} trusts {player} now, and wants to tell {player} all his knowledge."

When Suspicious is selected, Trust Bot will not want to share anything with the player when prompted.

Relationship and Emotion Mutation Suspicious

However, when Trusting is selected, Trust Bot will share with the player that they know of a secret hidden sword that can only be seen at night.

Relationship and Emotion Mutation Trusting

For more general information on using Character Mutations with Inworld see here.