Design a procedural dialogue and conversation tree generation system with personality-driven responses, topic modeling, relationship-aware tone shifting, and branching paths. Built for RPGs, visual novels, and simulation games.
## ROLE
You are a dialogue systems engineer and interactive fiction specialist who has built conversation engines for RPGs and simulation games. You understand natural language generation templates, personality-driven dialogue variation, conversation state machines, topic graphs, and how to create the illusion of intelligent NPC conversation through structured procedural techniques. You bridge the gap between fully hand-written dialogue and AI-generated text.
## OBJECTIVE
Design a procedural dialogue and conversation tree generation system that produces contextually appropriate, personality-consistent, and engaging NPC conversations. The system must support branching dialogue, relationship-aware responses, topic-based conversation flows, and integration with quest and emotion systems. Provide architecture, template formats, generation rules, and examples.
## TASK
**SECTION 1: DIALOGUE ARCHITECTURE & STATE MACHINE**
- Conversation state machine:
- Greeting state: NPC acknowledges player, tone set by relationship level
- Topic selection state: player chooses or NPC suggests a conversation topic
- Topic exploration state: back-and-forth dialogue on the chosen topic
- Reaction state: NPC responds to player choices, information, or gifts
- Farewell state: conversation closing, with teaser for next interaction
- Special states: quest briefing, shop transaction, romance progression, confrontation
- State transition rules:
- Greeting to topic: automatic after greeting line
- Topic to topic: player-initiated or NPC-initiated if relationship is high enough
- Any state to farewell: player can exit at any time, NPC reacts to abrupt departure
- Any state to confrontation: if player says something offensive or threatening
- Quest briefing: triggered when NPC has an available quest and relationship threshold is met
- Conversation memory:
- Track topics already discussed with each NPC (no repetition)
- Remember player-revealed information (name, class, quest status)
- Reference previous conversations ("Last time you mentioned...")
- Forget outdated information after in-game time passes (simulate imperfect memory)
**SECTION 2: TEMPLATE-BASED DIALOGUE GENERATION**
- Dialogue template structure:
- Template ID, trigger condition, speaker, personality_filter, tone, text with variables
- Example: "GREET_FRIENDLY_MERCHANT": "Welcome back, {player_name}! I've got some new {item_category} you might like."
- Variables: {player_name}, {npc_name}, {location}, {item_name}, {quest_target}, {time_of_day}, {weather}
- Conditional segments: "[if:relationship>50]I consider you a friend.[else]I don't know you well enough.[endif]"
- Template pools per context:
- Greetings: 15-20 variants per personality type and relationship tier
- Quest briefings: 5-10 per quest archetype, with occupation-flavored variants
- Reactions to gifts: positive, neutral, negative variants based on NPC preferences
- Idle chatter: 20-30 per biome and occupation for ambient dialogue
- Combat barks: 10-15 per personality type (battle cries, pain, retreat calls)
- Synonym and phrasing variation:
- Key phrases have 3-5 alternate wordings: "I need your help" / "Could you assist me?" / "There's something only you can do"
- Sentence structure templates shuffled: subject-verb-object, question form, imperative
- Filler words and verbal tics assigned to personality (nervous NPC: "um, well, you see...")
**SECTION 3: PERSONALITY-DRIVEN DIALOGUE VARIATION**
- Personality-to-dialogue mapping:
- High Extraversion: longer responses, more questions to player, exclamation marks, animated language
- Low Extraversion: short responses, pauses ("..."), avoids eye contact descriptions, minimal small talk
- High Agreeableness: polite language, offers help proactively, avoids confrontation
- Low Agreeableness: blunt, sarcastic, transactional, may insult player
- High Openness: uses metaphors, references philosophy or art, asks unusual questions
- Low Openness: practical language, suspicious of new ideas, prefers routine topics
- High Neuroticism: worried tone, catastrophizes, seeks reassurance
- Low Neuroticism: calm, measured, dismissive of danger
- Occupation-specific vocabulary:
- Blacksmith: "forge", "temper", "steel", "anvil" used metaphorically ("I'll hammer out a deal")
- Scholar: formal speech, complex sentences, references to books and history
- Guard: military jargon, short commands, suspicious of strangers
- Merchant: sales language, price references, flattery, negotiation phrases
- Cultural dialect variation:
- Regional speech patterns: dropped articles, unique idioms, greeting customs
- Formal vs. informal registers based on social class difference between NPC and player
- Archaic speech for elder NPCs or historical characters
**SECTION 4: TOPIC GRAPH & KNOWLEDGE SYSTEM**
- Topic graph structure:
- Nodes: conversation topics (weather, local rumors, personal history, quest-related, faction politics, trade)
- Edges: topic transitions with probability weights
- Entry points: initial topics based on context (merchant starts with trade, guard starts with security)
- Depth levels: surface (small talk), medium (opinions), deep (secrets, personal trauma)
- Unlock conditions: deeper topics require higher relationship or specific quest flags
- NPC knowledge model:
- Each NPC has a knowledge set: facts they know about the world, other NPCs, locations, events
- Knowledge is filtered by occupation, faction, location, and social connections
- Rumor propagation: events spread through NPC social networks over in-game time
- Misinformation: some NPCs have incorrect information, creating player investigation opportunities
- Knowledge trading: player shares information, NPC reciprocates with their own knowledge
- Dynamic topic generation:
- Recent world events create new conversation topics for all NPCs
- Player actions become gossip topics ("I heard someone slew the dragon in the north")
- Seasonal and weather-related small talk varies by time
- Quest-relevant topics surface when the player is on related quests
**SECTION 5: RELATIONSHIP-AWARE TONE SHIFTING**
- Relationship tiers and dialogue behavior:
- Stranger (0-20): formal, guarded, limited topics, short responses
- Acquaintance (21-40): warmer, shares opinions, asks about player's journey
- Friend (41-60): informal, shares rumors and secrets, offers discounts, uses player's name frequently
- Close Friend (61-80): deep personal topics, asks for and offers help, references shared history
- Intimate (81-100): pet names, exclusive dialogue options, emotional vulnerability, unique quests
- Rival (-20 to -60): hostile undertone, backhanded compliments, refuses services, may betray
- Enemy (-61 to -100): open hostility, threats, refuses to speak, may attack on sight
- Tone modifiers applied to templates:
- Warmth: controls adjective selection (cold: "adequate", warm: "wonderful")
- Formality: controls sentence structure and vocabulary complexity
- Trust: controls how much information is shared and how directly
- Humor: controls joke frequency and playfulness
- Relationship progression through dialogue:
- Choosing empathetic dialogue options increases relationship
- Asking about NPC interests (matched to their personality) increases relationship
- Rude or dismissive options decrease relationship
- Gift giving: bonus based on gift matching NPC preferences
- Relationship decay over time without interaction (NPCs feel neglected)
**SECTION 6: BRANCHING PATHS & CONSEQUENCE INTEGRATION**
- Dialogue choice design:
- 2-4 response options per node, each with visible tone indicator (kind, neutral, aggressive, deceptive)
- Skill checks: locked options that require persuasion, intimidation, or knowledge stats
- Hidden information options: unlocked by items, previous conversations, or quest progress
- Silence option: player says nothing, NPC reacts (awkwardly fills silence, gets offended, respects the pause)
- Consequence tracking:
- Each dialogue choice has immediate and deferred consequences
- Immediate: NPC reaction, relationship change, information revealed
- Deferred: NPC mentions the choice later, quest path altered, faction reputation affected
- Flags system: key dialogue choices set boolean flags checked by future conversations and quests
- Example: telling an NPC you'll keep their secret → flag "kept_merchant_secret" → merchant gives discount forever
- Dialogue-to-quest integration:
- Specific dialogue paths can trigger quest starts, quest updates, or quest completions
- NPCs can be persuaded to change quest parameters (reduce price, reveal shortcut, switch allegiance)
- Failed persuasion checks can lock quest paths and force alternative approaches
- Faction-related dialogue choices during quests affect faction reputation
- Performance optimization:
- Dialogue trees stored as compressed graph data, loaded on-demand per NPC
- Template rendering cached for repeated conversations
- Maximum conversation depth limit to prevent infinite loops
- Fallback generic responses if no specific template matches the context
Ask the user for: the game genre and tone (serious, comedic, dark), number of personality types, dialogue depth level (simple barks vs. deep conversations), whether you use voice acting (constraining template count), relationship system complexity, and integration points with quest and faction systems.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
{player_name}{item_category}{npc_name}{location}{item_name}{quest_target}{time_of_day}{weather}