Emotion-Aware and Context-Grounded Dialogue Agents for Personalized Video Game Interactions

Michael Adjeisah, Jin Zhang, Pierluigi Vito Amadori, Ryan Spick, Eshani Kawshika Fernando, Kwame Omono Asamoah, Huiwen Zhao, Jian Jun Zhang, Guy Moss, Jian ChangarXiv 2026

It’s late, your eyes are a bit heavy, and you’ve probably spent the last few hours dealing with code that doesn't talk back—or at least, doesn't talk back well. We’ve all been there in a video game: you’re in the middle of an epic, heart-pounding boss fight, you scream "I need help!" into your headset, and your AI companion responds with a flat, pre-recorded, "I am standing by."

It’s the digital equivalent of a blank stare.

This paper introduces ChatNPC, a system designed to bridge that immersion gap. The goal is to move away from static scripts and toward "game companions" that actually sense your frustration, celebrate your wins, and stay grounded in the ever-shifting context of the game world.

TL;DR

ChatNPC is an architecture for game AI that uses Large Language Models (LLMs) to generate dialogue that is both emotionally aware and contextually grounded. By "listening" to the player's emotional shifts and tracking the game state through a specialized "sentinel" agent, it creates NPCs that feel less like bots and more like believable partners in your adventure.

What Problem Does This Paper Address?

The "immersion gap" in gaming is a tough nut to crack. Even as LLMs have become incredibly articulate, dropping them into a game often leads to two problems:

  1. Context Blindness: The AI forgets you just lost half your health or that you’re currently sneaking through a dark hallway.
  2. Emotional Flatness: The AI doesn't care if you're whispering in fear or shouting in triumph; it just processes the text.

Current LLM implementations in games are often "causally detached"—they can chat, but they don't really know what’s happening in the engine. ChatNPC aims to fix this by turning game state and player emotion into first-class inputs for the dialogue generation process.

Methods

The authors break the problem down into three main modules, which you can see in the architecture diagram below:

Figure 2: The overall architecture of ChatNPC consists of three main modules. The sentinel-guided agent with two different encoding types (an in-game context and emotion encoders), the memory manager to process information between the in-context and the out-of-context window, and the chat planning agent to format the output request.
  • SeGent (Sentinel-Guided Agent): This is the "eyes and ears." It features an Emotion Encoder that classifies player speech into 28 distinct emotional categories (like surprise, anger, or fear). It also has a Game Context Encoder that uses embeddings to compare the current game state to the previous one. If the situation has changed significantly (e.g., moving from exploration to combat), it triggers an "on-the-fly" prompt adjustment.
  • Memory Manager: This handles the "wait, what did we just do?" problem. It uses a short-term "meta-buffer" for immediate context and a long-term archival storage (using a vector database) for broader narrative continuity.
  • Chat Planning Agent: This is the brain. It uses a Game-Template (a lightweight framework of the story and objectives) and a specific Agent Persona to ensure the response sounds like the character, not a generic chatbot. It also uses a "problem distiller" to extract key constraints before the LLM ever starts writing.

Datasets

The researchers didn't just use generic chat logs. They introduced the iGCD (in-game context dialogue) dataset, which contains 14,397 pairs of utterances, game contexts, and responses.

  • Source: Real production archives from a commercial game studio.
  • Genres: Adventure, Action-Adventure, FPS, and Vehicular Combat.
  • The "Gold Standard": They used Llama 2 70B to generate initial responses, which were then rigorously edited by human experts to ensure they met high standards for naturalness and relevance.

Key Insights and Ideas

  • Emotion as Metadata: Instead of hoping the LLM "gets" the tone from the text, ChatNPC explicitly extracts emotion as metadata. This allows the model to inject conversational cues—like sighs or pauses—that make the interaction feel human.
  • The Power of the Sentinel: The "Aha!" moment here is the use of cosine similarity between context embeddings. By detecting when the game context shifts, the system knows exactly when to update the LLM’s instructions to keep the narrative from breaking.
  • Naturalistic Flourishes: As shown in Figure 1, the difference between a standard LLM and ChatNPC is often in the "flavor" text. ChatNPC adds non-verbal actions like *adjusts sunglasses* or *cracks knuckles*, which players found significantly more believable.
Figure 1: Snippets of ChatNPC responses showing more naturalistic and human-like, with appropriate conversa- tional cues, making it more believable with the SeGent.

Key Results

  • Performance Boost: Fine-tuned ChatNPC (based on Llama 3 70B) achieved a ROUGE-WE score of 0.862, significantly outperforming base models (0.595) and even specialized roleplay models (0.648).
  • Ablation Success: Removing the "Sentinel" (SeGent) led to a noticeable drop in performance, proving that tracking the game state is just as important as the LLM's raw intelligence.
  • User Approval: In a study with 18 participants, 97.2% of responses were rated as "Very well" or "Quite well" in terms of emotional cues and coherence.

Limitations and Future Work

The authors are refreshingly honest about the hurdles remaining:

  • Latency: The response time is currently 5–8 seconds. In a fast-paced shooter, that’s an eternity. Future work will focus on low-latency "frontier" models.
  • Modality: Currently, the system only "hears" you. The authors want to integrate facial expression analysis to get an even richer picture of the player's state.
  • Group Dynamics: Right now, it’s a one-on-one conversation. Managing a "party" of multiple NPCs all chatting with the player is the next big challenge.

In short, ChatNPC is a glimpse into a future where your favorite game character doesn't just follow you—they actually get you. Now, go get some sleep; your own "internal monologue" probably needs a break.

Summary updated

Abstract

We present ChatNPC, a game companion that dynamically personalizes its responses in real time based on players' emotional shifts to enhance user immersion. The model integrates sequential data, leveraging the dynamic nature of streams to benefit from player information, spoken lines, and in-game context. We leverage recent progress in LLMs' tool-calling capabilities to extract vital information from memory and recognize potential constraints for accurate reasoning, thereby tackling the complexity of NPC conversation scenarios. The task is divided into a game sentinel-guided agent (SeGent), a memory capability, and a chat planning tool for reasoning instantiation. The approach uses a lightweight game template as an information framework, with relevant details and a thorough reasoning layout. We conduct extensive experiments on a newly developed game dataset for in-game context NPC dialogue and demonstrate that ChatNPC sequentially captures players' emotional shifts over time; responses are more naturalistic and human-like with appropriate conversational cues, pauses, and sighs; and utterances remain faithful to the dynamics of in-game context and player actions, supporting narrative continuity.
BibTeX
@misc{adjeisah2026emotion,
  author = {Michael Adjeisah and Jin Zhang and Pierluigi Vito Amadori and Ryan Spick and Eshani Kawshika Fernando and Kwame Omono Asamoah and Huiwen Zhao and Jian Jun Zhang and Guy Moss and Jian Chang},
  title = {{Emotion-Aware and Context-Grounded Dialogue Agents for Personalized Video Game Interactions}},
  year = {2026},
  eprint = {2611.29372},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.29372},
}
Figure