Skip to content
Open access

Adaptive Non-Playable Characters with Reinforcement Learning: Training and Shipping a Learned Game Opponent

Aug 2026 · International Journal of Innovative Science & Technology · 0 citations · 11 references

TL;DR

The results show that adaptive, learned NPCs are possible on commodity hardware and the pipeline described here provides a reproducible template for future games, simulations and educational tools.

Abstract

Most Non-playable characters (NPCs) in modern video games still rely on scripted logic, finite state machines, and decision trees. This reliance on hand-authored rules means that their behaviour is easy to predict and repeat, which reduces player immersion and long-term engagement. Although reinforcement learning has been proposed as an alternative production method, prior demonstrations are often limited to experimental training environments and seldom implemented in a complete playable prototype. The present study fills this gap by taking a reinforcement-learning-trained NPC through the entire production pipeline, from initial design to a tested, standalone game capable of running on ordinary consumer hardware. We implemented a 3D foraging environment called the Flower Island in Unity, where we trained a hummingbird agent (with a 10-value observation vector, 5 continuous actions and a primary reward based on successful nectar collection) using Proximal Policy Optimization with the Unity ML-Agents toolkit and domain randomization applied throughout training. Training was run until the episodic cumulative reward, monitored in Tensor Board, showed progression from exploratory behaviour to more stable behavioural patterns, followed by a reward plateau, at which point the policy was exported for deployment. Once converged, the policy was exported in ONNX format and executed inside the finished game via Unity's Inference Engine on the Burst CPU backend; in playtesting the exported policy ran in real time without observed frame-rate degradation during playtesting and without inference-related runtime exceptions. This was part of a full title with two different game modes, a full user interface and layered audio system. The resultant policy showed purposeful and diverse foraging behaviour and was able to play against a human player in real time. The game passed all ten functional test cases, and the final acceptance test suite ran without any runtime exceptions. Among the engineering factors considered, integration effort, choice of inference backend, and simplicity of the reward structure exerted the greatest influence on the outcome. Formal quantitative benchmarking against a scripted baseline (reward curves, latency figures, and significance testing) was not captured for this iteration of the project and is identified as the primary direction for follow-up work. These results show that adaptive, learned NPCs are possible on commodity hardware and the pipeline described here provides a reproducible template for future games, simulations and educational tools.

Read PDF

Similar papers

#machine learning Preprint Aug 2026

LLM-Guided Reinforcement Learning for Adaptive NPC Behavior in Multi-Agent Combat Games

A runtime strategy-selection framework in which a large language model (LLM) guides a trained RL policy without modifying its underlying behavior is investigated, demonstrating both the potential and limitations of LLM-guided runtime strategy selection for adaptive multi-agent game AI.

H. D. Nair, Kayvan Karim · 0 citations
Conference Aug 2026

Hybrid Behavior Tree and Reinforcement Learning for Adaptive Combat Agents in Real-Time 3D Game

The design of fully autonomous agents that are capable of adaptive and realistic combat behavior in a 3D environment is still a big challenge in developing game AI. Reinforcement Learning agents pose issues like erratic behaviour outside of their training distribution. At the same time, rule-based agents are easy to un...

Ritwika S, Sravya Boya, Divya Boya et al. · 0 citations
#artificial intelligence Preprint Oct 2026

Constrained Command-Conditioned Reinforcement Learning with Bandit Strategy Selection in Real-Time Strategy Games

Deep reinforcement learning agents reach strong performance in real-time strategy games but can be brittle against opponents outside their training distribution. Separating strategic command selection from learned unit control allows different strategies to be selected for different opponents while reusing the same exe...

Nick Leenders, R. Lindelauf, J. van Oijen et al. · 0 citations
#machine learning Preprint Sep 2026

PlayTrain: An Efficient Reinforcement Learning Framework for LLM-Generated Adaptable JavaScript Games

Through PlayTrain, an RL framework that combines the abilities of large language models to robustly generate JavaScript games from a minimal human prompt, and an efficient pipeline that can run any JS game in a standard'gym'environment, this work reimagine RL VGE development.

R. Truong, Lance Ying, Samuel Gershman et al. · 0 citations
Open access Sep 2026

A Machine Learning Framework for Strategic Gameplay Optimization in Scrabble Using Reinforcement Learning

: This paper explores and compare various artificial intelligence-based techniques used for playing classic board game Scrabble. As the world is evolving around finding quick and efficient techniques for the solution of each problem using Machine learning, gaming industry is also a flourishing industry and has grown 9....

M. Kaleem, Kanta Prasad Sharma, Tapsi Nagpal et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.