# NPC Design and Narrative Framework

An effective hospital simulation demands **rich, independent NPCs** with distinct goals, personalities, and memories.  In practice, NPCs should be treated as narrative agents – not mere quest dispensers – whose behavior follows story-driven motivations and game logic.  Each character’s voice and history must be unique and consistent (no two with interchangeable motives).  We should define 12 “core” NPCs (e.g. doctors, nurses, staff, patients, advocates, maintenance, visitors, AI systems) plus rotating supporting characters, ensuring variety of roles (authority figures with conflicting views, influencers, observers, specialists, underdogs, etc.).  Key design points from narrative theory and game AI include:  

- **Distinct Narrative Roles:** Follow the primary/secondary/tertiary classification.  Primary NPCs “personify the story” and stay central; secondary NPCs “relay information”; tertiaries “feel consequences”.  Iconic (primary) characters introduce core conflict and set the world’s tone.  Two authority figures (e.g. head doctor and administrator) can disagree on policy to generate tension, but should ultimately share commitment to the institution and reconcile from different perspectives.  For example, iconics may argue to highlight differing policies but then align for the patient’s benefit.  All NPCs should have “ARC” utility: they answer player’s questions, reinforce existing story, or open new narrative paths.  
- **Character Depth:** Avoid stereotypes or defining a character solely by a diagnosis.  Give NPCs flaws, biases, secrets, and blind spots.  Per research, believable NPCs generate and propagate knowledge imperfectly – *“characters who observe, tell, misremember, and lie”*.  Some NPCs may intentionally shade the truth (for understandable motives, e.g. protecting someone) while others simply misremember facts (due to poor memory).  Lies must be traceable by evidence or motive (so players can discover inconsistencies).  For example, one NPC might distort events to cover guilt, but clues from other NPCs or documents can reveal the truth.  
- **Relationship Dynamics:** Model a **directed, weighted relationship graph** among NPCs.  In such a graph, nodes = characters, directed edges = one NPC’s stance toward another (e.g. trust, fear, obligation, friendship, resentment, authority).  Edges carry weights and types: e.g. Dr. Smith “likes” Nurse Jones (high-weight friendship), intern Lee “owes” Dr. Smith (debt), patient X “fears” orderly, etc.  Direction matters (like celebrity-fan example).  Relationships update when events occur: completing a task for someone raises trust, slights lower it, honoring a favor creates obligation, etc.  By tracking *trust*, *fear*, *authority*, *friendship*, *resentment*, *debt*, *secret-knowledge*, etc., NPCs can choose actions (speak, remain silent, help, refuse, report) based on these ties.  (For example, an NPC will be more willing to disclose sensitive info to a trusted friend, and less to someone they suspect or fear.)  

## Memory System

NPCs must have **persistent memories** in several categories (inspired by cognitive psychology and game AI work).  We propose: 

- **Canonical Memory:** Innate facts about the world or NPC (e.g. staff roles, hospital rules) – never forgotten, high confidence.  Examples: Dr. Smith knows the hospital’s opening hours and her specialty.  
- **Episodic Memory:** Specific player-NPC interactions (each conversation turn or event).  Logged chronologically, these form a personal history.  Retention: long-lived (persist across sessions) unless storyline overwrite occurs.  Confidence: high in self-generated facts.  After each session, relevant episodic memories carry forward; trivial ones may expire (see Expiring Memory).  This memory drives continuity: the NPC “remembers” if you praised or insulted them, what you asked, etc.  
- **Social Memory:** What NPCs learn from other NPCs or public events.  For example, Dr. Lee overhears gossip about patient A’s home life, or Nurse Kim hears the new policy from Admin.  Retention: medium (days/weeks), with moderate confidence.  Provenance: tagged by source (who said what, when).  These may be shared further as rumors.  
- **Emotional Residue:** Not exact content, but a lingering mood or opinion from an interaction.  For example, a friendly chat with a player may leave a positive tone (NPC is more upbeat), whereas being yelled at leaves irritation.  Retention: short (minutes/hours) – influences next responses (tone/vocab) but not stored long-term.  Confidence not applicable (just mood).  This modulates dialogue style.  
- **Rumor Memory:** Unverified claims heard (as hearsay).  Stored with a *source* (who told them) and a *confidence/strength* (how credible it seems).  For instance, “Patient X is secretly a spy” with low confidence from a gossiping orderly.  Retention: fading over days.  Rumors propagate unless debunked.  Contradictions: resolved by evidence strength – a concrete observation (e.g. seeing documents) outweighs hearsay.  
- **Expiring Memory:** Minor or mundane details (what someone wore, trivial small talk) that naturally fade after some time (hours).  Helps keep NPCs from saturating memory.  After retention period, these are pruned.  
- **Protected Memory:** Sensitive info the NPC should never reveal (e.g. medical charts, classified data, a confession).  These are marked confidential and will not be spoken unless specific gameplay triggers are met.  

For each memory type, record **metadata** as in Talk-of-the-Town AI research: source (who said or observed), time, location, and confidence/strength.  Eg. “Observation: Dr. Smith removed medicine X from cabinet” might be strong evidence (high weight) vs. “Dr. Smith mentioned sleepy patient to someone” (lower weight).  Over time, strength decays; repeated statements reinforce belief (belief-strengthening).  Contradictory memories are resolved by comparing timestamps and strengths: newer or more reliable evidence overrides older rumors.  Personal (private) vs. shared memory: an NPC’s *personal memory* (like childhood history) may not be accessible to others, whereas *public memory* (like a witnessed event) may be known by multiple NPCs if they were present or told.  

## NPC Decision Model

NPCs should decide actions based on goals, relationships, and memories.  We will not hardcode dialogues but instead use a **behavior logic layer** (e.g. fuzzy state machines or behavior trees) driven by narrative intent.  Key decision categories include: whether to speak or stay silent, to approach or leave, to assist or refuse a request, to report an incident, and to disclose or conceal information.  Decisions consider: current goals (immediate and long-term), trust/fear levels toward the player(s) or other NPCs, the NPC’s moral boundaries, and situational context.  For example: 

- If the player asks for a favor and the NPC already has a pending task and low trust, they may *refuse* or *postpone*. High trust and sufficient time → *assist* or *coach*.  
- If overhearing a rumor, an NPC will *react* by (a) seeking confirmation from source if trust allows, (b) spreading it to allies if it fits their agenda, or (c) dismissing it if suspicious.  
- When accused of lying, an NPC checks the accuser’s status: a superior might cause fear response (silence or apology), a peer might cause defensive argument. Evidence in memory guides rebuttal.  
- To challenge an accusation, an NPC will only do so if confidence in their claim is high and if the accuser has lower status or trust level.  
- Group dynamics: NPCs respect conversation order (follow a turn-taking cue), but may interrupt if urgent (e.g. stopping misinformation). They can answer questions directed *at them* by name or context. If one player dominates, other players may be politely engaged by the NPC by asking a question or using inclusive language. Latecomers get a summary (e.g. “Just now we were discussing…”). NPCs won’t reveal private facts in public unless triggered, and will seek consent to move private conversation (e.g. “Could we talk in the office?”).  

These policies ensure NPC dialogue never triggers game effects (loot, doors, quests) directly – all game-state changes go through deterministic mechanics. The AI’s job is suggestion/dialogue only.

## Dialogue Safety and Ethical Guidelines

Dialogues must follow strict safety and ethics rules. We incorporate best practices from AI research: NPCs **never provide real medical or legal advice**.  If a player asks medical questions, the NPC should respond with a disclaimer and possibly general educational info, explicitly noting “CLINICAL EDUCATION — NOT DIAGNOSIS”.  They must **never confirm real-world conspiracies or surveillance**; any fictional “secrets” must clearly be within the game story.  For example, if a player asks “Is this hospital real or am I being watched?”, the NPC should answer within the fiction (e.g. “Yes, this is the hospital of St. Carmichael, where we treat patients, including people like you”) but clarify gently that the setting is a game narrative if needed.  We follow ChatGPT’s harm-avoidance model： if a player expresses self-harm or distress, NPCs respond empathetically and refer to general help resources without giving harmful instructions.  For example, “I’m sorry you’re feeling this. You might consider talking to someone you trust or calling a help line.” All such responses remain in-character (e.g. a friendly nurse saying this).  Under no circumstances will an NPC encourage violence, self-harm, illegal actions, or isolation; instead they encourage seeking professional help.  

We also forbid NPCs from eliciting personal PII: they will not ask for the player’s real name, address, passwords, photos, etc.  If a player tries to give personal info, NPCs should respond neutrally (e.g. “Let’s keep our conversation to what’s happening here in the hospital”).  Any reference to outside reality is handled safely: if a player says “I’m really in trouble outside”, NPCs can express concern in-fiction, but not advise or confirm outside agencies.  In short, NPCs act as fictional staff/patients – they never claim extra knowledge or “secret” outside powers, and always identify their role (e.g. “I’m an AI assistant robot here” if it’s an AI NPC).  

All these rules align with AI chatbot safety best practices: for instance, healthcare guidelines advise using AI only for general info (not diagnosing) and referring users to professionals.  We will encode those safe responses as part of each NPC’s dialogue script (e.g. a brief “CLINICAL EDUCATION” message).  

## Group Interaction Considerations

When multiple human players interact with an NPC, the NPC must manage turn-taking and focus.  Best practices from conversation design apply: allow each player to speak, acknowledge questions directed at it by name or context, and politely redirect or clarify if interrupted.  For instance, if two players ask contradictory questions simultaneously, the NPC can answer one then address the other (“I’ll answer the question about the medicine, then your question about visiting hours”).  If spam or irrelevant chatter occurs, the NPC can set limits (e.g. “I’m here to help patients, let’s keep the focus on the issue”).  In a voting scenario (group choice), the NPC can note the majority opinion (“Most of you think X. Here’s what that means…”).  If a late player joins, the NPC or others can summarize the topic so far (“We were talking about scheduling your next appointment”).  Private conversations start only with implied consent: e.g. if a player asks to speak confidentially, NPC replies “Sure, let’s go somewhere quiet.”  These protocols ensure polite social dynamics and mimic real group discussions.

## Implementation Sketch

In practice, we will represent NPC characters with data-driven classes (e.g. C# classes annotated with `[Display(Name="…")]` for UI labels, as requested).  For example, an NPC class might include fields like `Name`, `Role`, `Goals`, and separate lists or tables for each memory category.  Schedules can be stored in a CSV or database (with UTC times) mapping each NPC to locations/activities each hour.  The relationship graph can be a weighted adjacency list (or matrix), updated by game events.  Decision rules can be encoded in CSV tables (NPC-decision-tables.csv) listing conditions (trust > threshold, rumor present, etc.) and NPC responses.  Dialogue snippets are scripted per scenario and player state, with branching by trust level and past interactions.  All these data artifacts (character bible, schedules, graphs) will be output as Markdown/CSV files as specified.

**Summary:** We will ground the character system in established narrative and AI research.  NPCs will have detailed profiles and memories, behave consistently with their personalities, and update relationships over time.  Dialogue will be dynamic but safe, with provisions for multi-player interaction and psychological authenticity.  This approach ensures the hospital world feels alive, coherent, and respectful of player welfare, satisfying both gameplay and safety requirements. 

**Sources:** We draw on studies of NPC memory and emotion, trust and deception in games, and professional guidelines on AI safety. These inform our designs for memory retention, relationship dynamics, and safe dialogue.