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, conferencesparty- Celebrations, festivals, gatheringsfamily_gathering- Family reunions, home gatheringsinterview- Job interviews, auditionsnegotiation- Business deals, bargaining
Action Scenes
chase_scene- Pursuits, escapesstealth_mission- Infiltration, sneakingtraining_session- Practice, learningcompetition- Contests, matches, tournamentsrescue_mission- Saving, recovery operations
Emotional Scenes
funeral- Memorials, burialswedding- Marriage ceremoniesgraduation- Commencement ceremoniesreunion- Meetings, gatheringsfarewell- Goodbyes, departures
Mystery/Thriller Scenes
investigation- Detective work, searchesinterrogation- Questioning, examinationsdiscovery- Findings, revelationsrevelation- Disclosures, exposuresconfrontation- Conflicts, showdowns
Fantasy/Sci-fi Scenes
magic_ritual- Spellcasting, ceremoniesspace_battle- Space combat, warstime_travel- Time jumps, temporal eventsdimension_hop- Portal travel, riftsmagical_duel- Magical battles, confrontations
Original Scenes
romantic_date- Romantic encountersbattle_scene- Combat situationscasual_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
- Base Emotion Detection: Uses a pre-trained model to detect the initial emotion
- Scene Context: Applies scene-specific emotional adjustments
- Context Override: Applies any specified context overrides
- 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emotion_aware_narrative-0.1.0.tar.gz.
File metadata
- Download URL: emotion_aware_narrative-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ca66ec90cee47ac2cc5c4731bf5476005c89023c1d2c628e85cc3991f4d1b41
|
|
| MD5 |
f7c3fb5d26065f119cccbb8d9ce624c7
|
|
| BLAKE2b-256 |
b9695e71104501a2e37641a94276f62f031b5300c73732d21bc530d1472891e0
|
File details
Details for the file emotion_aware_narrative-0.1.0-py3-none-any.whl.
File metadata
- Download URL: emotion_aware_narrative-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0378b11eda055035d9a130cf3f91d3423e7f881111a981f73a55845c2d2a6382
|
|
| MD5 |
a15c1dcc89b00a69cc9156b4d83ae8e5
|
|
| BLAKE2b-256 |
1ad51098d71942cde2e4d842819edfd20cb966407c35db86ee1678b79abe2c83
|