Create AI-powered Onboarding Character for Digital Twin Environments | Convai Unity Tutorial

By
Convai Team
November 6, 2024

Creating AI-powered non-playable characters (NPCs) is fast becoming a game-changer in digital twin environments, training simulations, and gaming worlds alike. With Convai's narrative design feature, developers, narrative designers, and virtual world builders can easily create characters that respond dynamically to player actions, similar to the onboarding character we have created for this tutorial. This detailed tutorial showcases how narrative design on the Convai Playground makes building AI NPCs in Unity easy and adaptable, giving characters agency and purpose within immersive digital environments. Here, we’ll dive into creating an onboarding character equipped with AI-driven narratives that can both follow scripted paths and respond generatively based on player input, enhancing realism and engagement in digital twins.

Follow our detailed step-by-step video tutorial and start creating narrative driven AI Characters for your virtual worlds today!

Also, feel free to test out the Narrative Design Unity demo with an AI-powered onboarding character, and reach out to us with any feedback or appreciation! 

Why Use AI Characters in Digital Twin Environments?

Using AI-powered characters in digital twin environments brings numerous benefits. By acting as dynamic characters such as onboarding guides, these AI characters provide a seamless and interactive way for users to familiarize themselves with complex virtual environments. Whether it's for a factory simulation, an educational setup, or a game, having an onboarding character walk new users through the system’s features enhances user experience and understanding. Digital twin technology, when combined with Convai's AI NPC capabilities, makes onboarding more accessible, engaging, and effective. To learn more about such innovations, read our detailed blog on Top AI NPC trends 2024.

Benefits of Using AI NPCs for Onboarding:

- Real-time Interaction: AI NPCs can answer questions, provide instructions, and respond to player inputs dynamically.

- Consistent Onboarding Process: Ensures every user has a thorough, consistent introduction to the environment.

- User Engagement: Keeps users engaged with interactive content, reducing the learning curve.

- Enhanced Realism: Brings AI characters to life, making the experience immersive and realistic.

Introduction to Convai’s Narrative Design Feature

Convai’s narrative design feature is a powerful tool for creating characters that possess both scripted and generative responses. This functionality allows developers to define specific actions and responses while also enabling characters to react based on user input dynamically– Learn more. Here’s how Convai simplifies AI NPC creation:

- Easy Drag-and-Drop Interface: No need for complex code. Simply drag and drop components to bring characters to life.

- Scripted and Generative Responses: Combine preset dialogues with flexible, AI-powered responses for an adaptable experience.

- Character Agency: NPCs are designed with purpose, such as navigating complex objectives and responding to players in real-time.

With Convai, developers can build AI NPCs that feel natural, reacting appropriately in each dynamic scenario (Check out our highly detailed Narrative Design configuration playlist to learn more about creating narrative flow for your AI character on Convai Playground) Here’s a breakdown of the steps to get started.

Getting Started: Setting Up Unity for Convai’s AI NPC

1. Download the Convai Package and Project Files

Head to the Convai website, download the project files, and set up the Convai SDK in Unity. The initial setup includes necessary Unity assets and the Convai Unity package.

1. Open Unity: Launch Unity and navigate to the Unity Hub.

2. Add Project Files: Import your project files, which contain all prerequisites for setting up the Convai demo.

3. Import Convai Package: Access the Unity Asset Store, search for "Convai," and add it to your assets.

2. Initializing the Scene

The demo project features a warehouse environment with NPCs and essential components like conveyor belts and assembly lines. Navigate to `Unity Factory scene > HDRP > Scene Factory` to open the initial setup. We have used the free Unity Factory scene for this demo.

3. Adding Convai Essentials

To start, add Convai's Essentials package, which includes core components like lip sync, head tracking, and eye blinking for realistic character interactions.

Building Your Onboarding Character

To build a character with Convai’s narrative design, follow these steps:

1. Add Your NPC Character

Navigate to the Convai Playground, set up your NPC character profile, and copy the character ID and name.

1. Create a New Character: Under Convai’s narrative design manager, define your NPC’s name and ID.
Here are the character details we have used:
Character Details:

Name: Christina Smith.     |      ID:  84434252-3776-11ef-a746-42010a7be00e

2. Add Prefabs to Scene: Drag and drop the tour guide character prefab into your Unity scene.

2. Configure Core Components

Enable NPC components to provide a seamless experience:

Animator: Define animations for expressions and lip sync.

Eye and Head Tracking: Set up tracking for realistic interaction.

Collider and Nav Mesh Agent: Enable navigation for NPC movement.

Configuring Dynamic Narratives in Convai

Convai’s narrative design feature lets you define a narrative flow that adapts to user choices.

To learn more about creating narrative flow for your character using sections and triggers, check out our detailed Documentation for Adding Narrative Design to your Character.

1. Create Narrative Flow: Design a structured tour by setting up each step as a narrative “section” (e.g., start, conveyor belt, assembly line).

2. Script Dialogue Options: Assign predefined dialogues that guide players through the tour, while allowing dynamic responses to questions.

Example Narrative Flow:

Section   

Description 

Trigger Point  

Start

Greets the player and initiates the tour

Player approaches 

Conveyor Belt 

Explains conveyor functionality, prompts questions

Player reaches belt

Assembly Line 

Introduces assembly robots, allows further questions. 

Player reaches line

Setting Triggers and Objectives

Use triggers to direct players through the onboarding process. As players reach specific points, activate narrative sections that guide their next steps.

1. Create Trigger Points: Place triggers at locations like the conveyor belt and assembly line.

2. Set Actions on Trigger: For each trigger, set the narrative section that becomes active.

Example Objective and Trigger Setup:

Objective  

Trigger Event

Action

Start Tour

Approach NPC

Dialogue greeting and tour start

Conveyor Belt 

Reach Conveyor Trigger

Dialogue on conveyor functionality

Assembly Line 

Reach Assembly Trigger 

Dialogue on assembly line  

Advanced Character Behavior and Animation

To enrich your onboarding character’s behavior, add animations and further AI capabilities:

1. Facial Expressions: Enable lifelike expressions that respond to player actions.

2. AI-driven Conversations: Use generative responses to give more detailed answers based on player inquiries.

3. Event-driven Actions: Use Convai’s action handler to move the NPC dynamically between locations.

You can watch some of our other Unity tutorials on our YouTube channel to learn more about customizing character actions and animations

Testing and tweaking the NPC Experience

Once you’ve set up your onboarding character, it’s crucial to test the flow and make adjustments.

1. Run the Scene: Observe how the NPC interacts with the environment and the player.

2. Test Responses: Check each section’s responses and the NPC’s navigational accuracy.

3. Adjust Triggers: Fine-tune trigger placements to ensure smooth progression through the tour.

The Perks of Convai’s Narrative Design for AI NPCs

Convai’s narrative design is not only easy to implement but also offers robust benefits for game developers and virtual world creators:

1. Simplified Interface

Convai’s drag-and-drop system allows even novice developers to design AI characters without intensive coding. This accessible approach speeds up the workflow for creating onboarding and tutorial experiences in digital twins.

2. Scripted and Generative Responses

With Convai, characters can give scripted responses for structured tasks or adapt to users’ questions. This feature provides flexibility for game narratives and training simulations, making onboarding characters feel more human-like and intuitive.

3. Seamless Integration with Unity and Other Game Engines

Convai’s SDK integrates smoothly into Unity projects, making it easy to add essential character components like head tracking, eye blinking, and lip sync. Developers can quickly create believable characters who enhance the user experience in digital twin environments across game engines like Unreal Engine too.

Check out our Narrative Design Tutorial documentation to get started.

Conclusion and Next Steps

Creating AI-powered onboarding characters in digital twin environments has never been simpler, thanks to Convai’s narrative design feature. By offering an easy-to-use interface and a robust set of capabilities, Convai empowers developers to build engaging AI NPCs that guide users intuitively. Whether you’re setting up a training simulation, an interactive educational tool, or a game tutorial, Convai makes it easy to provide users with an interactive and immersive experience.

Next Steps:

- Start exploring Convai’s Narrative Design Manager for more complex character setups.

- Experiment with AI-driven responses and behavioral triggers to create diverse NPC interactions.

- Visit Convai’s blog to read more about narrative design.

Sign up at https://convai.com to try it out. Also, subscribe to this YouTube channel and stay updated with our latest developments. Write to us at support@convai.com for any queries, bug reports, collab, or business-related engagement.

Happy developing and enjoy bringing your virtual onboarding characters to life with Convai!