For AI agents: the complete documentation index is available at /npc-mentality/en/llms.txt, the full documentation bundle is available at /npc-mentality/en/llms-full.txt, and this page is available as Markdown at /npc-mentality/en/usage/rumor.md.

Rumor System

Information mutates as it travels between NPCs.

Overview

Player kills the boss
    ↓
NPC1: "I heard someone slew a dragon?"
    ↓
NPC2: "Actually, I heard it was a wizard."
    ↓
NPC3: "The demon king is dead, they say."

Component

RumorSystem — MonoBehaviour.

FieldTypeDefaultDescription
MutationChancefloat0.3fProbability of mutation (0~1)
MutationSuffixesList<string>4 defaultsSentences appended on mutation
ActiveRumorsList<RumorData>—Currently active rumors

API

SpreadRumor

void SpreadRumor(string fact, string sourceNpcId)
rumorSystem.SpreadRumor("Someone slew a dragon", sourceNpcId: "player");

PassRumor

RumorData PassRumor(RumorData rumor, string receivingNpcId)

Content mutates with MutationChance probability.

Events

event Action<RumorData> OnRumorSpread          // When rumor first created
event Action<RumorData, string> OnRumorPassed  // Each time rumor is passed

RumorData

public class RumorData
{
    public string OriginalFact;
    public string CurrentVersion;
    public int HopCount;
    public float SpreadAt;
    public string SourceNpcId;
}

Example

using NpcMentality;

public class RumorDemo : MonoBehaviour
{
    public RumorSystem rumorSystem;
    public string[] npcIds = { "blacksmith", "innkeeper", "farmer", "guard" };

    private void Start()
    {
        rumorSystem.OnRumorPassed += (r, npcId) =>
            Debug.Log($"[{npcId}] hop {r.HopCount}: \"{r.CurrentVersion}\"");
    }

    public void OnPlayerKillsDragon()
    {
        rumorSystem.SpreadRumor("Someone slew a dragon", "player");
        StartCoroutine(SpreadToVillage());
    }

    private System.Collections.IEnumerator SpreadToVillage()
    {
        var rumor = rumorSystem.ActiveRumors[^1];
        foreach (string npcId in npcIds)
        {
            yield return new WaitForSeconds(2f);
            rumorSystem.PassRumor(rumor, npcId);
        }
    }
}

Tips

  • MutationChance = 0f — facts spread without any mutation.
  • MutationChance = 1f — every pass guarantees a mutation.
  • Combine with RelationshipContagion to spread both content and emotion through the village simultaneously.
  • Use HopCount to implement "this rumor is unreliable" UI.