Non-Playable Characters Based On Large Language Models For Role Playing Games (RPG) - Ade Mulyana; Yudi Wibisono; Ani Anisyah (Yayasan Cita Cendekiawan Al Khwarizmi, 2025)
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.