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:

Each log contains:

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:

Seed Events are then categorized into the following topics:
Gossip

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.

Emotional Valence

Emotion influences tone, pacing, intensity, and word choice.

Derived from:

Social Context

Context about the conversation to prevent conversations from drifting randomly and breaking.

Derived from:

Personality Style

Personality styles will modify sentences at the end of dialogue generation to add or modify words that correspond to the personality.

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.

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

Brag Structure

Advice Structure

Gossip Structure

Observation Structure

Vocabulary Pool

Each structure draws phrasing from selected word pools to structure the final dialogue line.

Emotion Vocabulary

Describes feelings at different intensities.

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.

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.

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:

Different micro template sets exist for:

The generator selects a micro template at random, weighted by:

Using Micro Templates

Each micro template contains semantic placeholders depending on the subject.

Each placeholder pulls from:

Example:

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:

Example:

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:

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:

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:

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:

Each emoticon is chosen from:

Mood

Mood emotes break down what emotion the NPC is feeling for their subject.

Positive

Neutral

Negative

Topic

Topic emotes focus on what the dialogue parties are discussing.

Economy

Trade Materials

Town Life

Social / Personal

Environment

Foraging

Special Topics

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

Conversation Flow

Example:

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.

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:

Example:

Full Dialogue

When the player stands very close or directly interacts, the system generates full dialogue lines.

A full dialogue line is generated using:

Dialogue is then generated normally.

Gossip Structure

Bragging Structure

Complaint Structure

Advice Structure

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:

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:

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:

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:

Player Influence on NPC Responses

NPCs react to the player’s chosen dialogue using the same pipeline as NPC dialogue.

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.