DiceTales

AI Setting-Based Storylines Implementation

Overview

The AI system has been successfully modified to support different storylines based on the chosen game setting, while maintaining the same general structure and functionality.

Changes Made

1. Dynamic Campaign Stories

2. Updated Methods

getCampaignInfo(settingId)

getHuggingFaceStoryPrompt(type, settingData)

getHuggingFaceFallbackResponse(type, settingData)

getHuggingFaceFallbackChoices()

getCampaignStoryPrompt(settingData, characterData)

getFallbackCampaignStory(settingData, characterData)

3. Console Logging

4. Maintained Compatibility

How It Works

  1. Setting Detection: The AI checks the current game setting from gameState.getCampaign().setting
  2. Campaign Selection: getCampaignInfo() returns the appropriate campaign data for that setting
  3. Prompt Generation: All story prompts are generated using the setting-specific campaign information
  4. Adaptive Language: Prompts use genre-appropriate language and terminology
  5. Character Customization: Character hooks and scenarios are adapted based on both setting and character class

Campaign Details

Medieval Fantasy - “The Shadow Crown”

Modern Day - “The Veil Protocol”

Sci-Fi Space - “The Quantum Relay”

Eldritch Horror - “The Arkham Manuscripts”

Testing

Result

The AI now provides genre-appropriate storylines that match the chosen setting while maintaining the same high-quality storytelling structure. Players will experience completely different adventures based on their setting choice, with appropriate atmosphere, language, and plot elements for each genre.