2 player journal and codex
forgejo-actions edited this page 2026-07-13 19:45:35 +00:00

Player Journal And Codex

What This System Is

The player journal is one discovery system with six categories: quests, NPCs, mobs, loot sources, recipes, and locations. PlayerCodexLedger stores only durable discovery facts. Catalog-backed PlayerCodexRecord values supply current titles, summaries, tags, and cross-links, so content edits do not require save migrations.

How Authors Use It

Gameplay systems call PlayerCodexUiState::discover when the local player accepts or observes a quest, talks to an NPC, encounters or defeats a mob, obtains an item, learns a recipe, or enters a location. Repeated observations update the last-seen time without creating duplicate entries or overwriting the first-discovery time.

Scene and story content can emit codex:<category>:<id> runtime events. Supported category tokens are quest, npc, mob, loot/loot_source, recipe, and location. The player UI consumes these events only for the local actor and routes every category into the same ledger.

The UI projection supports category filters, case-insensitive search, unread-only filtering, and discovery badges. Related links are revealed only when the target is also known. This lets an item entry show its discovered mob and location sources without leaking undiscovered content.

Rules And Invariants

Discovery facts are durable, but record copy, summaries, tags, and links should remain catalog-backed. Local UI should only consume discovery events for the local actor. Related links must not reveal undiscovered content.

Validation And Debugging

If a journal entry is missing, inspect the producing gameplay system, the codex:<category>:<id> event, and the local actor filter. If a link appears too early, check whether the target record was already discovered.

Examples

A quest accept can discover a quest record, talking to its offer NPC can discover the NPC record, and defeating a mob can reveal that mob as a loot source only after the player has observed it.

Quest journal rows are synchronized into the same ledger automatically. Other runtime domains use the same discovery API, which keeps discovery ownership with the event-producing system while the player sees one consistent journal.