Offline / Hybrid AI Pipeline for Fully Reactive NPC Dialogue, TTS, and Facial Animation in UE5
Powered by Ollama (LLaMA 3.2), NVIDIA NeMo FastPitch, and NVIDIA ACE Audio2Face.
This project presents a semi-offline AI pipeline for dynamic, conversational Non-Playable Characters (NPCs) in Unreal Engine 5.
Instead of relying entirely on cloud APIs, the system focuses on local text generation, local text-to-speech synthesis, and real-time facial animation.
The architecture integrates:
- ๐ง Ollama-hosted LLaMA 3.2 โ Contextual NPC dialogue
- ๐ NVIDIA NeMo FastPitch (WSL2) โ High-quality, low-latency TTS
- ๐ NVIDIA ACE Audio2Face โ Facial animation & blendshape generation
- ๐ง MetaHuman โ Final in-engine expressive performance
The final prototype supports real-time playerโNPC conversations with near-instant speech playback and dynamic facial animation.
While LLM and TTS components run fully offline, Audio2Face remains the main vendor-dependent limitation, requiring NVIDIA tools and licensing.
This work demonstrates a feasible hybrid workflow balancing immersion, privacy, and creative controlโwhile highlighting future opportunities for optimization and localized facial animation.
| Component | Purpose | Notes |
|---|---|---|
| Unreal Engine 5.4.4 | Core game engine | Hosts MetaHumans + A2F integration |
| MetaHuman (UE5) | High-fidelity character rig | Default UE5 plugin |
| Ollama / LLaMA 3.2 | Local LLM for dialogue | Called via Python subprocess (cmd) |
| NVIDIA NeMo FastPitch | TTS engine | Runs in WSL2, requires Conda + GPU |
| NVIDIA ACE / Audio2Face (Kairos Template) | AudioโBlendshape | Requires NVIDIA developer access |
| Python 3.13 | Pipeline orchestration | Calls Ollama & WSL2 NeMo |
| cmd / PowerShell / WSL | Shell automation | Required for cross-environment workflow |
- Player Input โ UE Blueprint/Python Handler
- Prompt sent to Ollama (local LLaMA 3.2)
- LLM returns structured JSON response
- Python script sends text to NeMo FastPitch (WSL2)
- Generated WAV file sent to NVIDIA ACE Audio2Face
- Blendshapes streamed to UE5 via Live Link
- MetaHuman animates + audio plays in sync
git clone https://github.com/<your-repo>/dynamic-ai-npc-ue5.git
cd dynamic-ai-npc-ue5For detailed character setup, prompts, and MetaHuman/Audio2Face integration, see CHARACTER_SETUP.md
curl -fsSL https://ollama.com/install.sh | sh
ollama pull llama3.2Test:
ollama run llama3.2For detailed NVIDIA NeMo, WSL, conda, and text-to-speech integration, see TTS_SETUP.md
wsl --installInside WSL:
conda create -n nemo python=3.10
conda activate nemo
pip install nemo_toolkit['all']Check GPU support:
nvidia-smiDownload from:
https://docs.nvidia.com/ace/latest/
Enable required plugins:
- Python Editor Script Plugin
- MetaHuman
- Live Link
- Audio2Face / Kairos
/Dynamic-AI-NPCs-NeMollama-Unreal
Config/
Content/
ExternalDependencies/
modelfile.7z
tts_en_multispeaker_fastpitchhifigan.7z
Plugins/VisualStudioTools/
Source/
README.md
CHARACTER_SETUP.md
LOCAL_SETUP.md
TTS_SETUP.md
KairosSample.uproject
...This repository contains the UE5 project only. To fully enable dynamic NPC dialogues and TTS:
- Ollama LLaMA 3.2 must be installed locally, see TTS_SETUP.md
- Custom character models (Damien Cross, Clarissa Vane, Emily Langford) are required to setup manually, see CHARACTER_SETUP.md
- NVIDIA NeMo FastPitch + HiFi-GAN models for TTS must be set up in WSL2, see TTS_SETUP.md
- Python helper scripts (
tts_inference.py,tts_runner.py, etc.) must be placed in your local workspace, see LOCAL_SETUP.md
These files are not included in the repo due to size/licensing constraints. For full local directory structure, see LOCAL_SETUP.md
- โ Local LLM dialogue (no cloud)
- โ WSL2-accelerated TTS synthesis
- โ Real-time facial animation via Audio2Face
- โ Fully compatible with MetaHumans
- โ Modular Python pipeline
- โ Audio2Face requires NVIDIA ecosystem + license
- โ Real-time performance depends on GPU
- โ Sync accuracy tied to Live Link
- Fully local open-source alternative to Audio2Face
- Real-time phoneme-based animation (OpenFace / DeepSpeech)
- UX latency benchmarking
- Emotion tagging + expressive NPC mood models
- GPU optimization
NVIDIA ACE:
https://docs.nvidia.com/ace/latest/index.html
Kairos Unreal Sample Project:
https://docs.nvidia.com/ace/latest/workflows/kairos/kairos-unreal-sample-project.html
Distributed as a research prototype.
NVIDIA ACE components follow their respective licenses.

