Combining Reinforcement Learning and Behavior Trees for NPCs in Video Games with AMD Schola

Tian Liu, Alexander Cann, Ian Colbert, Mehdi SaeediarXiv 2025 · DOI · arXiv

Abstract

Traditional Non-Player Character (NPC) design in video games often relies on Behavior Trees (BTs), which offer high controllability but can lead to predictable, "robotic" behaviors. Conversely, pure Reinforcement Learning (RL) provides adaptability but lacks the fine-grained control required by game designers. This paper presents a hybrid architecture that integrates RL agents as specialized leaf nodes within a BT framework. Using the AMD Schola plugin for Unreal Engine, the researchers demonstrate that this approach balances strategic structure with nuanced execution, outperforming end-to-end RL models in competitive 3D combat scenarios.

Introduction

The adoption of Reinforcement Learning (RL) in commercial video games has been hindered by three main challenges: a lack of designer control, the complexity of training multi-task agents, and the repetitive nature of traditional scripted behaviors. While BTs are the industry standard for their interpretability, they often fail to capture the fluid, adaptive movement seen in human players. This research explores a "best of both worlds" approach: using BTs for high-level strategic logic and RL for low-level tactical execution.

The Hybrid BT+RL Architecture

The core of the proposed method is a modular system where a standard BT manages high-level decision-making (e.g., deciding whether to flee or engage), while the actual execution of these decisions is handled by specialized RL "skills."

The Hybrid BT+RL architecture integrates RL agents as leaf nodes within a traditional Behavior Tree structure.

The system utilizes AMD Schola, an open-source middleware that bridges Unreal Engine with RL libraries like Ray's RLlib. Instead of training a single monolithic agent, the researchers trained five distinct RL models using the Proximal Policy Optimization (PPO) algorithm:

  • Flee: Retreating from danger.
  • Search: Locating opponents.
  • Combat: Aiming and shooting.
  • Hide: Seeking cover.
  • Move (Collect): Navigating to ammunition spawns.

Each agent receives a mix of "core" observations, such as 36-ray LIDAR-like sensors for obstacle detection, and "auxiliary" observations specific to its assigned task. This modularity prevents "negative task transfer," where learning one skill degrades performance in another.

Experimental Setup

The architecture was tested in a custom-built competitive third-person shooter environment within Unreal Engine. The arena consists of a 4000-unit² square with static obstacles and eight ammunition spawn points. NPCs are equipped with 100 HP, limited ammunition, and realistic movement constraints.

The hybrid model was compared against two baselines:

  1. Pure BT Model: A fully hard-coded behavior tree.
  2. Curriculum RL Model: A single RL agent trained on all tasks through a five-phase learning curriculum (Combat, Advance, Move, Survival, Strategy).

Results and Analysis

The hybrid model demonstrated superior performance over the end-to-end RL approach. In matches against an "Aggressive NPC" baseline, the Hybrid model achieved a 53% win rate, compared to 41% for the Curriculum RL model. While the Pure BT model maintained the highest win rate (59%) due to its highly optimized scripts, the RL-based models exhibited more "emergent" and varied behaviors.

Distribution of episode lengths across different training methods, showing the increased variance and adaptability of the Hybrid and Curriculum models compared to the Pure BT.

A key insight from the data is the distribution of episode lengths. The Pure BT model showed low variance, indicating highly predictable match trajectories. In contrast, the Hybrid and Curriculum models displayed a much wider distribution of steps per episode. This suggests that RL-enhanced agents provide a more dynamic and less repetitive experience for players, which is often a primary goal in game design.

Discussion and Limitations

While the hybrid approach successfully balances control and adaptability, it introduces a computational "tax." The Pure BT model ran at approximately 155 FPS with 10 agents, while the Hybrid model dropped to 110 FPS. This performance gap is due to the overhead of processing both the BT logic and the neural network inference for each agent.

Future research will focus on optimizing this performance through model batching (processing multiple NPCs in one GPU pass) and model compression. Additionally, the researchers aim to test these agents in more vertically complex or "cluttered" environments to further bridge the gap between simulation and realistic game scenarios. By leveraging tools like AMD Schola, developers can begin to integrate sophisticated RL behaviors into their games without sacrificing the structural integrity of traditional AI systems.

Summary updated

Abstract

While the rapid advancements in the reinforcement learning (RL) research community have been remarkable, the adoption in commercial video games remains slow. In this paper, we outline common challenges the Game AI community faces when using RL-driven NPCs in practice, and highlight the intersection of RL with traditional behavior trees (BTs) as a crucial juncture to be explored further. Although the BT+RL intersection has been suggested in several research papers, its adoption is rare. We demonstrate the viability of this approach using AMD Schola -- a plugin for training RL agents in Unreal Engine -- by creating multi-task NPCs in a complex 3D environment inspired by the commercial video game ``The Last of Us". We provide detailed methodologies for jointly training RL models with BTs while showcasing various skills.
BibTeX
@misc{liu2025combining,
  author = {Tian Liu and Alexander Cann and Ian Colbert and Mehdi Saeedi},
  title = {{Combining Reinforcement Learning and Behavior Trees for NPCs in Video Games with AMD Schola}},
  year = {2025},
  eprint = {2510.14154},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.14154},
}
Figure