Non-Playable Characters Based On Large Language Models For Role Playing Games (RPG)
DOI:
https://doi.org/10.47709/brilliance.v5i2.6779Keywords:
Artificial Intelligence, Large Language Model, Non-Playable Character, Retrieval-Augmented Generation, Role-Playing GameAbstract
Interactive dialogue is a central element in role-playing games (RPG), particularly those that emphasize storytelling and immersion. This study explores the development of a dynamic Non-Playable Character (NPC) system using a Large Language Model (LLM) to simulate responsive conversations in a fictional world. The objective of this research is to design an NPC dialogue system that can maintain contextual consistency with the game’s lore while adapting to player input dynamically. The method used is engineering-based development, involving prompt engineering and a Retrieval-Augmented Generation (RAG) approach to embed narrative context into the LLM prompts. The system is implemented in a 2D RPG titled Kage no Meiyaku: Shinobi no Michi, where players interact with multiple NPCs whose responses evolve based on both pre-defined lore and game progression. Evaluation is conducted using a Likert scale across four dialogue quality dimensions: coherence, emotional engagement, narrative relevance, and persona consistency. The results show that the system generates engaging and contextually accurate responses, with average scores ranging from 4.0 to 4.5. Some limitations are identified, such as occasional misspellings and generic responses in ambiguous inputs. However, the approach demonstrates strong potential for AI-assisted storytelling in games. This research contributes to expanding LLM applications in interactive fiction and opens future work toward feature-rich RPG elements such as transactional systems, branching narratives, and real-time battle interactions.
References
Collins, J., Hirst, W., Tang, W., Luu, C., Smith, P., Watson, A., & Sahandi, R. (2016). EDTree: Emotional dialogue trees for game based training.
Gallotta, R., Todd, G., Zammit, M., Earle, S., Liapis, A., Togelius, J., & Yannakakis, G. N. (2024). Large Language Models and Games: A Survey and Roadmap. 1–19. https://doi.org/10.1109/TG.2024.3461510
Gao, Q., Isaac, S., Way, B., Catharines, S., Emami, A., & Catharines, S. (2023). The Turing Quest?: Can Transformers Make Good NPCs?? 93–103.
Gao, Y., Xiong, Y., Gao, X., Jia, K., Pan, J., Bi, Y., Dai, Y., Sun, J., Wang, M., & Wang, H. (2023). Retrieval-Augmented Generation for Large Language Models: A Survey. 1–21. http://arxiv.org/abs/2312.10997
Jenkins, H. (2004). Game Design as Narrative Architecture. In N. Wardrip-Fruin & P. Harrigan (Eds.), First Person: New Media as Story, Performance, and Game (pp. 118-130). MIT Press.
Jennett, C., Cox, A. L., Cairns, P., Dhoparee, S., Epps, A., Tijs, T., & Walton, A. (2008). Measuring and defining the experience of immersion in games. International Journal of Human-Computer Studies, 66(9), 641–661. https://doi.org/10.1016/j.ijhcs.2008.04.004
Ji, K., Lian, Y., Li, L., Gao, J., Li, W., & Dai, B. (2025). Enhancing Persona Consistency for LLMs’ Role-Playing using Persona-Aware Contrastive Learning. http://arxiv.org/abs/2503.17662
Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., ... & Kiela, D. (2021). Retrieval-augmented generation for knowledge-intensive NLP tasks. Advances in Neural Information Processing Systems, 33, 9459–9474. https://papers.nips.cc/paper/2020/file/6b493230205f780e1bc26945df7481e5-Paper.pdf
Mao, Y., Ge, Y., Fan, Y., Xu, W., Mi, Y., Hu, Z., & Gao, Y. (2024). A Survey on LoRA of Large Language Models. 1–144. https://doi.org/10.1007/s11704-024-40663-9
Newzoo. (2021). RPGs are mobile’s biggest genre by revenues: How do gamers across East and West engage with the genre?https://newzoo.com/insights/articles/rpgs-are-mobiles-biggest-genre-by-revenues-how-do-gamers-across-east-and-west-engage-with-the-genre
Ou, J., Lu, J., Liu, C., Tang, Y., Zhang, F., Zhang, D., & Gai, K. (2024). DialogBench: Evaluating LLMs as Human-like Dialogue Systems. https://arxiv.org/abs/2311.01677
Radež, G., & Bohak, C. (2024). Integrating Environmental Awareness Into NPCs?: Contextual Conversational Interaction in Games.
Ren, M. (2024). Advancements and Applications of Large Language Models in Natural Language Processing?: A Comprehensive Review. 0, 55–63. https://doi.org/10.54254/2755-2721/97/20241406
Shahsavar, Y., & Choudhury, A. (2023). User Intentions to Use ChatGPT for Self-Diagnosis and Health-Related Purposes: Cross-sectional Survey Study. JMIR Hum Factors, 10, e47564. https://doi.org/10.2196/47564
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, ?., & Polosukhin, I. (2017). Attention is all you need. Advances in Neural Information Processing Systems, 30.
Warpefelt, H., & Verhagen, H. (2016). A model of non-player character believability Keywords.
Xu, Z., Jain, S., & Kankanhalli, M. (2024). Hallucination is inevitable: An innate limitation of large language models. arXiv preprint arXiv:2401.11817
Zhang, Q., Wen, R., Hendra, L. B., Ding, Z., & LC, R. (2025). Can AI Prompt Humans? Multimodal Agents Prompt Players’ Game Actions and Show Consequences to Raise Sustainability Awareness. https://arxiv.org/abs/2409.08486
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Ade Mulyana, Yudi Wibisono, Ani Anisyah

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.














