NPC Memory

NPC memory in Wanderfolk is the system that stores every conversation as a vector embedding and retrieves relevant past interactions using semantic similarity. It works alongside promise tracking and mood systems to make each NPC a persistent character whose relationship with you evolves based on what you have actually said and done.

Conversation Memory

Every conversation you have with an NPC is summarized and stored as a vector embedding — a mathematical representation that captures the meaning and emotional tone of what was discussed. When you talk to an NPC again, the system retrieves the most relevant past conversations based on what you’re currently saying.

This means:

  • If you discussed mining with the blacksmith last week, they’ll reference that conversation when you bring up ore
  • If you promised to deliver goods and didn’t, they’ll bring it up
  • If you told the elder about a bandit sighting, they’ll remember the details

The retrieval is based on semantic similarity — the system finds past conversations that are topically related to the current discussion, not just keyword matches. This creates natural-feeling callbacks to previous interactions.

Mood System

Each NPC maintains a current mood that affects their tone and responsiveness:

MoodEffect
HappyMore talkative, offers better deals, shares gossip freely
NeutralStandard behavior
AngryShort responses, higher prices, less willing to help
SadQuieter, may share personal stories if trusted
SuspiciousGuards information, less trusting, questions your motives

Mood is influenced by recent events — your conversation tone, village events (raids, bad weather), and the NPC’s personal circumstances. A farmer who just lost crops to a storm will be in a worse mood than one enjoying a good harvest.

Personality Factors

NPC personality is shaped by three layers:

Culture

The village’s culture sets baseline personality traits. Meadowfolk NPCs are friendlier and more open. Cragborn NPCs are stoic and value directness. Tidefolk love humor and stories.

Role

An NPC’s role determines their knowledge domain and daily concerns. Blacksmiths talk about metal and tools. Farmers talk about crops and weather. Elders discuss village politics and history.

Individual Backstory

Each procedurally generated NPC has a unique backstory covering four dimensions: how they came to their role (a blacksmith who inherited the forge vs. one who fled a failing farm), their dreams (what they want from life), their fears (what keeps them awake), and defining life events (moments that shaped who they are). Two blacksmiths in the same village will have different life experiences and respond differently to the same questions.

Conversation Depth & Emotional Openness

A conversation depth tracker monitors your cumulative meaningful interactions with each NPC. As depth increases, the NPC progresses through emotional openness tiers:

TierDepthWhat They Share
GuardedLowRole-related dialogue, village gossip, surface-level chat
OpenMidPersonal opinions, mild complaints, preferences
VulnerableHighFears, dreams, backstory details, defining life events

The AI conversation system adapts tone, topics, and emotional register based on the current tier — responses literally feel different at depth 5 vs. depth 25. This works alongside reputation: high reputation makes an NPC willing to talk, but conversation depth makes them willing to share. A beloved stranger hears friendly greetings. A trusted friend hears the truth.

Voice and Speech Patterns

NPCs speak with distinct voices based on their role. The game uses six voice configurations with role-based pitch and tone:

  • Deep voices — warriors, warchiefs, blacksmiths
  • Warm voices — innkeepers, farmers, bakers
  • Sharp voices — scouts, guards, merchants
  • Gentle voices — herbalists, priests, healers
  • Bright voices — barmaids, performers, candlemakers
  • Grave voices — elders, archivists, scribes

These voice profiles affect the text-to-speech output, giving each role a distinctive sound during conversations.

Promise Tracking

When you make a commitment in conversation — “I’ll bring you iron ore” or “I’ll deal with those bandits” — the NPC tracks it. Fulfilling promises earns bonus reputation. Breaking them costs reputation and shifts the NPC’s mood toward suspicious.

The system distinguishes between:

  • Explicit promises — “I will do X” statements
  • Implied commitments — accepting a job or quest
  • Casual mentions — offhand remarks that aren’t tracked as promises

Environmental Awareness

NPCs aren’t just aware of their own lives — they know their surroundings. Every villager has knowledge of the biome they live in, including what borders their village in each direction.

What NPCs know:

  • The biome they’re standing in and its characteristics
  • Local wildlife — which creatures roam nearby during the day
  • Nighttime dangers — which monsters spawn in the area after dark
  • Plants and trees — what grows locally and where to find it
  • Nearby villages — names and rough directions to neighboring settlements

What NPCs don’t know:

  • Specific ore or resource node locations (you’ll need to explore for those)
  • Details about distant biomes they’ve never visited

Caravan traders have expanded geographic knowledge. They remember the villages along their trade routes and can tell you about biomes, directions, and distances between settlements. A conversation with a well-traveled caravan trader is one of the fastest ways to map the world.

Asking about surroundings is a great conversation starter with any NPC — it’s useful for the player and NPCs enjoy sharing what they know about their home.

Tips for Social Play

  • Be consistent — NPCs notice contradictions between what you say and do
  • Remember their interests — bringing up topics relevant to an NPC’s role leads to richer conversations
  • Respect their mood — pushing an angry NPC for information is less effective than waiting for them to calm down
  • Learn the culture — matching your speech to cultural values (formal with Cragborn, jovial with Tidefolk) improves responses