5_Lifesim Dialogue
Lifesim dialogue is a system for NPC and player characters to socialize with one another based on events that have taken place during their routines.
NPC Memory
Each NPC maintains a running memory log composed of short event notes. Logs represent what the NPC experienced recently.
These logs are created from events that have occurred during their daily schedule:
- Routine events
- work finished, breaks taken, errands completed
- Interactions
- barter success/failure, being overcharged, receiving help
- Personal events
- finding something, seeing someone, crafting progress
- Environment
- weather change, temperature, crowd density
- Global events
- festivals, economy shifts, construction, tram maintenance
Each log contains:
- Event Tags
- Timestamps
- Subjects
- Emotional Intensity
Conversation Triggering
NPCs around the player's render distance have a chance to engage in conversation. When NPCs engage in conversation, they look for another NPC who wants to have a conversation and group together.
One NPC will become the speaker based on personality. All others will become listeners. Its possible for multiple NPCs to engage in a single conversation.
The speaker begins a conversation by generating a Seed Event and creating dialogue from it. They then pass the speaker role to the next NPC based on personality. At least 1 other NPC needs to speak before a previous speaker is eligible to speak again.
Seed Events
Seed events are memories pulled from the NPC’s memory log.
Seed Events are weighted depending on the following information:
- NPC personality
- Time of day
- Current mood
- Nearby NPC types
- Memory recency
- Event intensity
Seed Events are then categorized into the following topics:
Gossip
- Daily life
- Environmental observations
- Complaint
- Bragging
- Personal rant
- Advice
- Economy talk
- Small talk
Thought Bundle
Once a Seed Event is chosen, the NPC converts it into a Thought Bundle. A Thought Bundle represents what the NPC is trying to express and why.
Each Thought Bundle includes Intent, Emotional Valence, Social Context, Personality Style, and Reference Data.
Intent
Defines the goal of the message.
- Vent frustration
- Bond
- Share information
- Seek empathy
- Show off
- Warn
- Deflect topic
- Joke or tease
Emotional Valence
Emotion influences tone, pacing, intensity, and word choice.
Derived from:
- Seed event mood
- NPC’s current mood
- Personality traits
Social Context
Context about the conversation to prevent conversations from drifting randomly and breaking.
Derived from:
- Relationship between speaker and listener
- Listener’s profession
- Relationship Hierarchy
- Affects if a character will joke to another or remain professional depending on the hierarchy of their relationship
Personality Style
Personality styles will modify sentences at the end of dialogue generation to add or modify words that correspond to the personality.
- Sarcastic
- Shy
- Stoic
- Dramatic
- Formal
- Blunt
- Wordy
Reference Data
Gathered from the seed event or from previous dialogue turns. The final line must reference these details meaningfully if they are to be added.
- Items involved
- Locations
- People
- Conditions
Sentence Structures
Sentence structures act as skeletons that describe the general shape of a sentence without dialogue added in.
Each conversation intent maps to a structure type as best as possible.
Complaint Structure
- state_issue
- emotional_color
- optional_detail
- softener_or_exaggeration
Brag Structure
- announce_accomplishment
- emphasize_skill
- link_to_future_gain
Advice Structure
- identify_condition
- suggest_action
- justify_suggestion
Gossip Structure
- introduce_subject
- share_detail
- express_opinion_or_reaction
Observation Structure
- describe_environment
- relate_to_self
- small_connection_to_listener
Vocabulary Pool
Each structure draws phrasing from selected word pools to structure the final dialogue line.
Emotion Vocabulary
Describes feelings at different intensities.
- Annoyed
- Irritated
- Burnt out
- Content
- Lively
- Worried
- etc.
Event Vocabulary
Event vocabulary is a pool of words specific to the seed event’s content. Instead of content filler being one constant string, sentence generation can pull from a variety of words meaning the same or relatively same thing.
- Supply/demand
- margin
- surplus
- demand
- needs
- inventory
- stock
- Character storage
- inventory
- trade bag
- haul
- stash
- Hot weather
- heatwave
- blistering heat
- toasty weather
- summer air
- Precipitation
- rainfall
- wet season
- tears o' Sa'kraan gods (lmao)
- rain
- Crafting
- gem polishing
- stone bundling
- carving
- jewelry weaving
- etc.
Regional Vocabulary Filters
NPCs that derive from a specific district (where they spawn) or profession may filter what words they pick for dialogue. This will either be done before or after grammar smoothing depending on which is easier to implement.
- The Outskirts
- technical, generalist vocabulary
- The Suburban Zone
- Relaxed, friendlier vocabulary
- The Public District
- Polite, formal vocabulary
- The Veyloris Precinct "The Stacks"
- Rougher, hostile vocabulary
Micro Templates
Each structure unit pulls a matching micro template from a micro template library. The structure determines which units appear, while the micro template library determines how each unit sounds.
structure units (such as state_issue) may include micro templates such as:
- “I keep running into {problem}”
- “{problem} again…”
- “ran straight into {problem}, lucky me”
- “got hit with {problem} earlier”
Different micro template sets exist for:
- Each intent
- Each region
- Each personality
- Each emotional intensity
The generator selects a micro template at random, weighted by:
- Emotional intensity
- Regional vocabulary profile
- Personality style
- NPC mood
Using Micro Templates
Each micro template contains semantic placeholders depending on the subject.
Each placeholder pulls from:
- Event vocabulary
- Emotion vocabulary
- Regional vocabulary filters
- Seed Event reference data
Example:
- Thought Bundle is generated
- Intent: Vent Frustration
- Subject: Construction Delays
- Mood: Annoyed
- Intensity: 0.6
- Event Tags: "infrastructure", "delays", "noise"
- Listener Relation: neutral
- Personality: Sarcastic
- Region: The Public District
- Knowledge: Self passed by subject 1 hour ago
- Thought Bundle intent weighs the selection of sentence structure
- Vent Frustration weighs the selection of sentence structure to Complaint Structure
- Complaint Structure
- state_issue
- emotional_color
- optional_detail
- softener_or_exaggeration
- state_issue unit selects a micro template from its table
- “I keep running into {problem}…”
- This process repeats until all sentence structures have been fulfilled.
- Full output
- I keep running into
- it’s honestly driving me {emotion_word}.
- the noise was unreal when I passed by earlier.
- you’d think they’d have it sorted by now.
- Full output
- Placeholders are swapped with words from corresponding vocabulary pools
-
- pool from infrastructure/delays/noise
- “that construction backlog”
- pool from infrastructure/delays/noise
-
- pool from annoyance
- "irritated"
- pool from annoyance
-
- Regional Vocabulary is applied to swap words from the micro template and placeholders.
- The Public District uses a Formal Regional Vocabulary pool.
- “unreal” becomes “ridiculous”
- “sorted” becomes “sorted out”
- The Public District uses a Formal Regional Vocabulary pool.
- Pre-personality output is rendered
- "I keep running into that construction backlog + it's honestly driving me irritated + the noise was ridiculous when I passed by earlier + you’d think they’d have it sorted out by now"
Personality Filters
After assembling the sentence, personality rules are applied to refine the sentence structure. This happens after the sentence is assembled so personalities strongly influence the final string.
Examples:
- Sarcastic
- Insert contrast phrases and exaggerate frustration
- “...as if that’d ever work...”
- Insert contrast phrases and exaggerate frustration
- Shy
- reduce confidence and add filler
- "...um..."
- "...I guess..."
- reduce confidence and add filler
- Blunt
- shorten phrasing and remove hedges
- Dramatic
- intensify adjectives
- "...absolutely unbearable..."
- "...ridiculously stupid..."
- intensify adjectives
- Formal
- remove slang and lengthen phrasing
Example:
- Personality is gathered from the Thought Bundle
- Personality: Sarcastic
- Add contrast markers
- Increase dry tone
- Add rhetorical phrases
- Slightly shorten or punch up wording choice
- Personality: Sarcastic
- Words are rephrased and lines are added / removed as needed
- I keep running into that construction backlog + lucky me
- It’s honestly driving me
irritated+ nuts + shocker.
- New sentence is generated
- "I keep running into that construction backlog lucky me it's honestly driving me nuts shocker the noise was ridiculous when I passed by earlier you’d think they’d have it sorted out by now"
Grammar Smoothing
A final grammar check is performed in order to ensure the corresponding sentence is readable and coherent. (I'll need to figure out how to handle this portion. It can either be a custom rule-based algorithm or local model, whichever is easier to implement)
Example:
- Grammar smoothing reads the generated line and looks for sections that need improvement.
- "...lucky me It's honestly driving me nuts shocker..."
- Sentence fragments needs punctuation to reduce sentence length
- "...nuts shocker..."
- Add filler and restructure to reduce word collision
- "...by earlier. You’d think they’d have it sorted out by now."
- Both segments can be conjoined to add texture via filler words.
- "...lucky me It's honestly driving me nuts shocker..."
- Grammar smoothing is applied and final dialogue string is created.
- "I keep running into that construction backlog... lucky me. It's honestly driving me nuts, which is quite the shocker. The noise was ridiculous when I passed by earlier, like come on, you’d think they’d have it sorted out by now."
Response Generation
When the next speaker takes over, they interpret the previous line, compare it to their own memory logs, perform emotional resonance checks, then generate their own thought bundles and generate their own responses.
The new speaker analyzes the previous dialogue line, then checks their own memory logs for related experiences.
Related experiences attempt to match the following:
- Same category
- Same location
- Same person
- Same emotion
- Same recent global event
If found, the following response is focused around that related experience.
If not found, the following response is a generic response based on interpretations of the previous line.
The speaker then modifies their response based on the following:
- Their own personality
- Their own current mood
- Their relationship with the speaker
- Their profession
Dialogue Layers
Unfocused Dialogue is assembled from the seed event based on the distance from the player. There are 3 layers of unfocused dialogue: Emoticon Dialogue, Snippet Dialogue, and Full Dialogue.
Emoticon Dialogue
Emoticon dialogue uses the Seed Event, Intent, Emotional Intensity, and Topic Tags to produce a simple 1–3 emoji string. This dialogue type does not use sentence construction, vocabulary pools, or personality filters.
NPCs use emoticons when:
- They’re far from the player (still inside of render distance)
- They’re not currently the focus of interaction
Each emoticon is chosen from:
- Mood (derived from Thought Bundle emotion)
- Topic (derived from Thought Bundle category)
- Tone Modifiers (derived from Thought Bundle intent + conversation progress)
Mood
Mood emotes break down what emotion the NPC is feeling for their subject.
Positive
- 🙂 calm / happy
- 😄 cheerful
- 😎 confident
- 😍 affectionate
- 🤩 impressed
- 😌 content / relaxed
Neutral
- 🤔 thinking / planning
- 😶 silent / reserved
- 😯 surprised
- 😐 indifferent
Negative
- 😡 angry
- 😢 sad
- 😓 stressed
- 😤 frustrated
- 😫 exhausted
- 😒 unimpressed
Topic
Topic emotes focus on what the dialogue parties are discussing.
Economy
- ⚖️ bartering
- 💰 gaining money
- 💸 losing money
- 📈 prices rising
- 📉 prices dropping
- 📦 goods / inventory
Trade Materials
- 🌿 natural
- ⛏️ industrial
- 🔧 crafted
- 🍴 foodstuffs
- ✨ unsorted
Town Life
- 🏘️ neighborhood
- 🎒 work
- 🏫 school
- 🧺 housework
- 🚧 construction
- 🛖 home repairs
Social / Personal
- 💬 general chat
- ❤️ romance
- 🫂 friendship
- 💔 conflict
- 👀 gossip
- 👋 greetings
- 🎉 celebration
Environment
- 🌤️ weather
- 🌧️ rain
- 🔆 heat
- ❄️ cold
- 🌙 night
- 🌄 dawn
Foraging
- 🪨 stones (any type)
- 🪵 wood (any type)
- 🪢 fibers (any type)
- 🦴 bones
- 🐚 shells
- 🧱 clay
- 💎 gemstones (any type)
Special Topics
- 📜 secrets
- 🧿 superstitions
- 🗝️ hidden location hints
- 🧩 puzzle hints
Tone Modifiers
Tone modifiers add nuance to a conversation to give context on how interesting or boring it may be. Tone is usually only generated after the 3rd string of conversation depending on how interesting or boring a conversation is.
Intensity
- ❗ excitement
- 💢 heated
- 💤 uninteresting / boring
Conversation Flow
- ➡️ one sided
- 🔄 back and forth
- 💬 casual exchange
- ⚔️ confrontation
Example:
- Emoticon Generation
- Seed Event: Barter attempt failed
- Intent: Vent frustration
- Emotional Valence: Negative, irritated
- Topic Tag: Economy / bartering
- Emoticon Output: 😤⚖️
The personality of the NPC can also impact what emoticons are picked. Even with the same seed event, a different personality impacts how they convey dialogue.
- Dramatic NPC: 😡💸
- Shy NPC: 😓📦
- Stoic NPC: 😐⚖️
Snippet Dialogue
Snippet dialogue is activated when the player interacts with an NPC when they are in an emoticon conversation. Noah will attempt to figure out what the conversation is about, and give a summary of what he thinks is going on.
Noah attempts to guess the conversation using:
- Seed Event category
- Intent
- Emotion Valence
- Topic tags
- Tone modifiers (if conversation progressed)
Example:
- Conversation snippet
- Seed Event: Barter failure
- Intent: Vent frustration
- Emotion: Annoyed
- Topic: Economy
- Tone: Heated
- Noah’s generated snippet
- “They seem irritated about a trade going wrong.”
- “Sounds like they’re arguing about prices.”
- “Looks like a deal didn’t go the way someone hoped.”
Full Dialogue
When the player stands very close or directly interacts, the system generates full dialogue lines.
A full dialogue line is generated using:
- Seed Event
- Thought Bundle
- Sentence structure
- Vocabulary pools
- Regional filters
- Personality filters
- Stored memory references
Dialogue is then generated normally.
Gossip Structure
- Thought Bundle
- Seed Event: Saw construction work delay
- Intent: Share information
- Emotion: Mild annoyance
- Region: The Suburban Zone
- Vocabulary: Casual
- Personality: Wordy
- Generated line
- “You catch that construction crew by Longford Road? They’ve been at the same pothole all day, poor things. Must be a nightmare.”
Bragging Structure
- Thought Bundle
- Seed Event: Found rare gemstone
- Intent: Show off
- Emotion: Proud
- Region: The Outskirts
- Vocabulary: Technical
- Personality: Dramatic
- Generated line
- “You should’ve seen the sheen on the gemstone I dug up. That thing practically glowed! I'm going to fetch a ridiculous trade price.”
Complaint Structure
- Thought Bundle
- Seed Event: Wasted time at festival
- Intent: Vent frustration
- Emotion: Irritated
- Region: The Suburban Zone
- Vocabulary: Casual
- Personality: Sarcastic
- Generated line
- “Kanyacci Night was an absolute masterpiece of disappointment. Should’ve just stared at my wall instead...”
Advice Structure
- Thought Bundle
- Seed Event: Heard metals are in demand
- Intent: Give advice
- Emotion: Neutral
- Region: Public District
- Vocabulary: Formal
- Personality: Stoic
- Generated line
- "If you intend to trade today, bring metal stock. The tailoring shop adjusted rates this morning."
Player to NPC Dialogue
Players can directly converse with NPCs using the same conversation structure that NPC to NPC dialogue uses.
When the player engages an NPC, both parties use their memory logs, thought bundles, and conversational intents, but the system produces several dialogue options for the player instead of fully automated responses.
Player Memory
Like NPCs, the player character maintains a memory log used to contextualize dialogue.
Player memory stores:
- Recent actions
- crafting, trading, assisting NPCs, using facilities
- Social interactions
- compliments given, favors completed, arguments
- Personal events
- discoveries, losses, successes, purchases
- Global context
- weather, festivals, market shifts
- NPC-specific memories
- relationship events
- past conversations
Thought Bundle Generation
When the player starts a conversation or when an NPC speaks to them, the system generates a Thought Bundle for the player character as if they were an NPC.
The Thought Bundle includes:
- Intent
- respond politely
- push topic forward
- deflect
- joke
- give advice
- react emotionally
- Emotional Valence
- based on the player's recent experiences
- plus any mood modifiers (e.g., exhausted, excited)
- Social Context
- relationship level with the NPC
- player’s reputation
- NPC’s role/profession
- Personality Style
Player personality develops over time as they interact with other NPCs- Sarcastic
- Friendly
- Stoic
- Curious
- Confident
- Reference Data
- recent activity with that NPC
- local events
- prior topic continuity
Dialogue Option Generation
Character response will generate 3 dialogue options rather than just 1. The generated dialogue options will all attempt to shift the conversation in different ways.
Each line addresses the same NPC line but will differ in:
- Intent
- Tone
- Depth
- Emotional stance
Direct / Topic Aligned Response
Direct responses will push the conversation forward naturally. They follow the NPC’s topic and references recent events.
Emotional / Personality Driven Response
Emotional responses lean into the player's personality traits and mood. These are best for filler dialogue and progressing conversations in a human-like way.
Alternative / Deflecting Response
Deflecting responses try to shift the topic or tone by asking a question or steering the conversation based on stored events.
Conversation Ender
Conversations will naturally end when an NPC gets bored or has nothing to talk about, but there will always be an option on the players' end to stop a conversation. The tone used to end a conversation depends both on how long the conversation has gone on for, and how bored the NPC is of a conversation.
Conversation enders begin as rude at the start of a conversation and eventually shift to nicer conversation enders the longer it goes.
Example:
- NPC line (NPC begins the conversation)
- “Construction by the market is delaying everyone’s commute today huh?”
- Thought Bundle:
- Seed Event
- Market construction delays
- Player Memory
- Waited in line at the bakery for 20 minutes this morning
- Helped a construction worker
- Player Mood
- Tired
- Player Personality
- Sarcastic
- Seed Event
- Generated Options
- Direct
- “Yeah it sure did. I hope they wrap it up soon.”
- Emotional
- “Oh, trust me, I noticed. I aged a full decade waiting to cross a street over there.”
- Alternative
- “Any idea what they’re even fixing over there?”
- Conversation ender (Created at line 1)
- “Sorry, I don't have time to chat."
- Conversation ender (Created if NPC line was line 3+)
- "I'd love to keep chatting, but I've got a busy schedule today. Lets talk later?"
- Direct
Player Influence on NPC Responses
NPCs react to the player’s chosen dialogue using the same pipeline as NPC dialogue.
- Interpret player line
- Match with memory logs
- Create NPC Thought Bundle
- Generate NPC response
Player dialogue will continue until the player ends the conversation, or the NPC gets bored or has nothing more to day and ends the conversation.