Create AI Characters Using 3D Avatars for VR Games and Simulations

By
Convai Team
June 10, 2024

Creating immersive and interactive experiences in VR games and simulations is becoming increasingly sophisticated, thanks to advancements in AI technology. And now with Convai, you developers can further elevate their VR projects by adding AI functionalities to 3D avatars. This blog post will guide you through the process of integrating AI characters into your VR projects, making your virtual worlds more dynamic and engaging. Alternatively you can also check out our detailed video on integrating AI characters into your VR projects, shared below.

Download the sample scene in this demo from Unity Demos, and test the sample scene out for yourself in this drive link.

Introduction to AI Characters in VR

What Are AI Characters?

AI characters or AI NPCs, are virtual beings powered by artificial intelligence, capable of natural communication, and now with Convai, perceiving their environment, and also performing different complex actions. To learn more about the actions system, read our detailed blog on NPC actions. In VR games and simulations, these characters can enhance immersion by providing lifelike interactions and responses.

Why Use AI in VR Games?

- Enhanced Interactivity: AI characters can engage with players in meaningful ways, making the game world feel alive. Learn more about the benefits of AI generated characters in the in-depth MIT blog.

- Dynamic Environments: AI allows for adaptive and responsive game environments that react to player actions.

- Improved User Experience: Players can enjoy more personalized and engaging experiences through interactions with AI-driven NPCs (Non-Player Characters).

Getting Started with Convai

Convai is a powerful tool that enables developers to integrate AI capabilities into their 3D avatars. Whether you are using Reallusion, Metahuman, Ready Player Me, or custom avatars, Convai can bring them to life with real-time lipsync, animations, and natural language processing.

Key Features of Convai

- Real-time Lip Sync and Actions: Ensures that characters' speech and movements are synchronized.

- Environment Perception: AI characters can perceive and respond to their surroundings.

- Natural Language Processing: Allows characters to understand and engage in conversations with users.

Note: you’ll need the Convai plugin for Unity to get started. Download it from the Unity Asset Store!

Automatic Setup for New Projects

Step-by-Step Guide

1. Open the Console: Go to the `Window` tab, then `General`, and select `Console`.

2. Install VR Package: Navigate to the `Convai` tab, choose `Convai Custom Package Installer`, and select `Install VR Package`.

3. Follow Installation Prompts: Confirm changes and follow the prompts to complete the installation.

4. Load Demo Scene: Open the `Convai VR` folder, navigate to `Scenes`, and load `Convai Demo VR`. 

5. Import Text Mesh Pro (TMP): If prompted, import TMP Essentials for UI text objects.

6. Set Up API Key: Ensure your API key is set by selecting `Convai Setup` from the `Convai` tab.

7. Build the Project: Go to `File`, select `Build Settings`, ensure the demo scene is included, and build the project.

Tips for Automatic Setup

- New Projects: Automatic setup is ideal for new projects or when existing project settings can be changed.

- Troubleshooting: If you encounter errors, such as package resolution failures, they are typically resolved automatically during the process. 

Manual Setup for Existing Projects

Step-by-Step Guide

1. Install Necessary Packages: Ensure that XR Interaction Toolkit, Universal Render Pipeline (URP), and OpenXR or Oculus XR packages are installed.

2. Import Convai Packages: From the `Project` tab, go to `Assets`, `Convai`, `Convai Custom Unity Packages`, and double-click `Convai VR Upgrader`.

3. Select Import Options: Review the assets to be imported and select the ones you want to overwrite. Confirm by pressing `Import`.

4. Add Prefabs to Scene: Drag and drop `Convai VR Base Scene Prefab` into your scene hierarchy.

5. Resolve Shader Issues: If 3D objects appear pink, use the `Convai URP Converter` to fix shader issues.

6. Adjust Object Positions: Position NPCs and VR players appropriately in the scene.

7. Validate Project Settings: Ensure all necessary settings are configured in the `Project Validation` section under `XR Plug-in Management`.

Tips for Manual Setup

- Existing Projects: Manual setup is better for existing projects where maintaining current settings is crucial.

- Custom Settings: Carefully review and select which project settings to overwrite to avoid disrupting custom configurations.

Use Cases of AI Characters in VR

Enhancing Storytelling

AI characters can significantly enhance storytelling in VR games by providing dynamic and interactive narratives. For example, an AI character could adapt its dialogue based on the player's previous actions, creating a more personalized and engaging storyline. Also, check out this super interesting blog at Famous Writing Routines which dives into the future of storytelling with AI, specifically AI characters.

Training Simulations

In training simulations, AI characters can serve as virtual instructors or trainees, providing realistic and adaptive training environments. This can be particularly useful in fields such as medical training, military simulations, and customer service training.

Social VR Experiences

AI characters can populate social VR platforms, interacting with users and facilitating social interactions. They can act as guides, hosts, or even participants in virtual events, making social VR experiences more vibrant and engaging.

Educational Tools

Educational VR applications can benefit from AI characters that act as tutors or interactive learning companions. They can provide explanations, answer questions, and guide students through educational content in a more interactive and engaging manner.

Best Practices for Integrating AI in VR

Ensure you follow the detailed steps in the building for VR documentation!

Focus on Natural Interactions

Ensure that AI characters can interact with users in a natural and intuitive manner. Utilize natural language processing and real-time animations to make interactions seamless and believable.

Leverage User Feedback

Incorporate feedback from users to continuously improve the AI characters. This can help in fine-tuning behaviors and interactions to better meet user expectations and enhance overall experience.

Conclusion

Integrating AI characters into VR games and simulations can transform the user experience, making virtual worlds more interactive, immersive, and engaging. Tools like Convai simplify the process of adding AI functionality to 3D avatars, allowing developers to focus on creating rich and dynamic virtual environments.

Additionally, if you want to learn more about integrating Reallusion Characters with Convai for your AI Unity projects, you can check out the video below:

By incorporating these elements into your VR projects, you can create more engaging and dynamic experiences that stand out in the competitive world of game development and virtual reality.