Personalized Non-Player Characters: A Framework for Character-Consistent Dialogue Generation
Generating character-consistent and personalized dialogue for Non-Player Characters (NPCs) in Role-Playing Games (RPGs) poses significant challenges, especially due to limited memory retention and inconsistent character representation. This paper proposes a framework for generating personalized dialogues based on character-specific knowledge. By combining static knowledge fine-tuning and dynamic knowledge graph technology, the framework generates dialogue content that is more aligned with character settings and is highly personalized. Specifically, the paper introduces a protective static knowledge fine-tuning approach to ensure that the language model does not generate content beyond the character’s cognitive scope during conversations. Additionally, dynamic knowledge graphs are employed to store and update the interaction history between NPCs and players, forming unique “experience-response” patterns. During dialogue generation, the paper first parses player input into an Abstract Meaning Representation (AMR) graph, retrieves relevant memory nodes from the knowledge graph, and constructs a fused graph structure. This integrated graph is encoded via a graph neural network to generate high-dimensional semantic vectors, which are then used to retrieve and supplement knowledge from the vector database. Ultimately, the model generates personalized responses consistent with the NPC’s identity. Experimental results demonstrate that the framework significantly enhances the authenticity of NPC dialogues and player immersion and performs well on multiple large-scale language models.