Skip to main content

An AI-powered emotion detection system for game narrative enhancement

Project description

Emotion-Aware Narrative Engine

A sophisticated emotion detection system for games and interactive narratives that combines scene context with emotion detection to provide accurate emotional analysis and mood suggestions.

Features

  • Emotion Detection: Uses advanced NLP to detect emotions in text
  • Scene Context: Understands different scene types and their emotional implications
  • Context Overrides: Allows for specific emotional contexts to modify detected emotions
  • Mood Suggestions: Provides game mood cues based on detected emotions
  • Flexible Integration: Works with various dialogue systems and game engines

Supported Emotions

Basic Emotions

  • joy
  • anger
  • sadness
  • fear
  • surprise
  • disgust
  • neutral

Additional Emotions

  • hope
  • excitement
  • gratitude
  • anxiety
  • disappointment
  • guilt
  • jealousy
  • confusion
  • sympathy

Scene Types

The system supports various scene types that can influence emotion detection:

Social Scenes

  • formal_meeting - Business meetings, conferences
  • party - Celebrations, festivals, gatherings
  • family_gathering - Family reunions, home gatherings
  • interview - Job interviews, auditions
  • negotiation - Business deals, bargaining

Action Scenes

  • chase_scene - Pursuits, escapes
  • stealth_mission - Infiltration, sneaking
  • training_session - Practice, learning
  • competition - Contests, matches, tournaments
  • rescue_mission - Saving, recovery operations

Emotional Scenes

  • funeral - Memorials, burials
  • wedding - Marriage ceremonies
  • graduation - Commencement ceremonies
  • reunion - Meetings, gatherings
  • farewell - Goodbyes, departures

Mystery/Thriller Scenes

  • investigation - Detective work, searches
  • interrogation - Questioning, examinations
  • discovery - Findings, revelations
  • revelation - Disclosures, exposures
  • confrontation - Conflicts, showdowns

Fantasy/Sci-fi Scenes

  • magic_ritual - Spellcasting, ceremonies
  • space_battle - Space combat, wars
  • time_travel - Time jumps, temporal events
  • dimension_hop - Portal travel, rifts
  • magical_duel - Magical battles, confrontations

Original Scenes

  • romantic_date - Romantic encounters
  • battle_scene - Combat situations
  • casual_conversation - Informal chats

Each scene type has:

  • A specific mood
  • Intensity level (low/medium/high)
  • Default emotions
  • Scene aliases for flexible matching

Installation

pip install emotion-aware-narrative

Quick Start

from emotion_engine import EmotionEngine

# Initialize the engine
engine = EmotionEngine().initialize()

# Process dialogue with scene and context
result = engine.process_dialogue_file({
    "text": "quit it",
    "scene": "romantic_date",
    "context": "flirty"
})

print(f"Detected Emotion: {result['emotion']}")
print(f"Mood Suggestion: {result['mood_suggestion']}")

Usage Examples

Basic Emotion Detection

result = engine.detect_emotion("quit it")

Scene-Based Detection

result = engine.detect_emotion("quit it", scene="romantic_date")

Context Override

result = engine.detect_emotion("quit it", context="flirty")

Combined Scene and Context

result = engine.detect_emotion("quit it", scene="romantic_date", context="flirty")

How It Works

  1. Base Emotion Detection: Uses a pre-trained model to detect the initial emotion
  2. Scene Context: Applies scene-specific emotional adjustments
  3. Context Override: Applies any specified context overrides
  4. Mood Suggestion: Generates appropriate mood cues for the final emotion

License

This project is licensed under the MIT License - see the LICENSE file for details.

Badges

PyPI version Python Versions License: MIT GitHub Actions

Acknowledgments

  • Uses the emotion detection model from Hugging Face
  • Inspired by the need for better emotional understanding in games

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emotion_aware_narrative-0.1.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emotion_aware_narrative-0.1.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file emotion_aware_narrative-0.1.3.tar.gz.

File metadata

  • Download URL: emotion_aware_narrative-0.1.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for emotion_aware_narrative-0.1.3.tar.gz
Algorithm Hash digest
SHA256 29b1c499f465c58a568a6c808d7198bf16e99cdf051b4833007c25e1c56921e5
MD5 71ea7d38685caf4b60b790b835ba088e
BLAKE2b-256 3d6fbb232d0fb7d430366b6702cda3700dc5e781a7bf11cbb3e12807dc25e292

See more details on using hashes here.

File details

Details for the file emotion_aware_narrative-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for emotion_aware_narrative-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a2c139c13a636a1dc64c655ccf6b9025feedba5e9365ed36362925f2f87bd0
MD5 e472fb8009e7f8484f3aef76fda8ebbc
BLAKE2b-256 7df6195c7ddacb7fdd28281ffb71c42f3c2f0636d282150fdb375e4373eb78da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page