Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Memory-Driven NPC Behavior: Context-Aware and Emotion-Based Game Conversations
Blekinge Institute of Technology, Faculty of Computing, Department of Computer Science.
Blekinge Institute of Technology, Faculty of Computing, Department of Computer Science.
2025 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesis
Abstract [en]

Background: Non-playable characters (NPCs) in digital games frequently sufferfrom shallow interaction design, lacking emotional nuance, contextual memory, andadaptive dialogue. Traditional rule-based systems and branching scripts restrict im-mersion due to their inability to model affective state or conversational history. Whilelarge language models (LLMs) enable fluent text generation, they inherently lackmechanisms for emotional alignment and memory persistence, leading to disjointedand impersonal responses.

Objectives: This thesis aims to design, implement, and evaluate a lightweight,modular framework that integrates sentiment analysis and episodic memory to enableemotion-aware, context-aware NPC dialogue. The primary objective is to assess theframework’s impact on players’ self-reported immersion, engagement, and perceivedNPC realism through standardized usability assessment (SUS) andpost-interactionquestionnaires.

Methods: The proposed system integrates: (1) a RoBERTa-based sentimentanalysis module for classifying emotional tone of player input; (2) a structuredJSON-based memory repository to store and retrieve contextually significant dia-logue history; and (3) a prompt engineering pipeline that fuses character biography,memory logs, and sentiment context into an input format suitable for large languagemodel inference using a locally-hosted Mistral GGUF model. The entire frameworkoperates via a Gradio-based user interface for real-time interaction and evaluation.

Results: System evaluation with 20 users yielded a mean System Usability Scale(SUS) score of 89.78, placing the framework in the 95th percentile for usability.Component-level validation confirmed the sentiment classifier’s high accuracy (0.90weighted F1-score) and the memory engine’s efficiency (0.41 ms retrieval latency),demonstrating the technical robustness of the underlying architecture.

Conclusions: The findings validate that a lightweight, modular framework cansignificantly enhance NPC believability and user satisfaction. This work provides apractical blueprint for creating memory-driven, emotionally responsive NPCs withoutrelying on resource-intensive, monolithic AI models, offering a scalable solution forgame developers and researchers.Keywords: Non-playable characters, affective computing, sentiment analysis, con-versational memory, prompt engineering, large language models, game artificial in-telligence, Gradio interface, RoBERTa, emotion-aware NPCs.

Place, publisher, year, edition, pages
2025. , p. 58
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:bth-28875OAI: oai:DiVA.org:bth-28875DiVA, id: diva2:2013165
Subject / course
DV1478 Bachelor Thesis in Computer Science
Educational program
DVGDT Bachelor Qualification Plan in Computer Science 60.0 hp
Presentation
2025-10-01, Campus Grasvik, BTH, Karlskrona, 19:48 (English)
Supervisors
Examiners
Available from: 2025-11-13 Created: 2025-11-11 Last updated: 2025-11-13Bibliographically approved

Open Access in DiVA

fulltext(6259 kB)1110 downloads
File information
File name FULLTEXT01.pdfFile size 6259 kBChecksum SHA-512
12f1d0b82bc62eb92223796b61ad1a12de6db2c3079d37149942b241b1f11eab7efbd863329ce7141c064455721264b186687734fbb1f5089600c18359f670f9
Type fulltextMimetype application/pdf

By organisation
Department of Computer Science
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 286 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf