Files
UE5-Modular-Game-Framework/docs/developer/07-narrative-systems.md
Lefteris Notas b2b6e1e7c7 Add developer documentation for systems 11-16, including architecture overview and implementation patterns
- Created detailed documentation for systems 102-135 covering achievements, settings, polish, data assets, input management, and state management.
- Added INDEX.md for easy navigation of developer reference materials.
- Introduced architecture-overview.md to provide a high-level understanding of the framework's structure and communication methods.
- Compiled implementation-patterns.md to outline common UE5 Blueprint patterns for consistent development practices.
2026-05-19 14:13:51 +03:00

134 lines
8.9 KiB
Markdown

# 07 — Narrative, Dialogue & Objectives Systems (Systems 58-68)
**Category Purpose:** These 11 systems handle the entire story layer — narrative state tracking, objective/quest management, dialogue playback with choices, branching consequences, cutscene bridging, timed trial scenarios, lore/journal unlocks, narrative trigger volumes, and ending condition accumulation. The `BPC_NarrativeStateSystem` is the central narrative authority; all story beats flow through it.
---
## System Index
| # | System | Asset Type | Role |
|---|--------|-----------|------|
| 58 | `BPC_NarrativeStateSystem` | Component | Narrative state machine; flags, milestones, chapter progression |
| 59 | `BPC_ObjectiveSystem` | Component | Objective tracker; activate, complete, fail, branching objectives |
| 60 | `BPC_DialoguePlaybackSystem` | Component | Dialogue playback; line queue, VO, subtitles, auto-advance |
| 61 | `BPC_DialogueChoiceSystem` | Component | Dialogue choices; present, select, filter by flags, consequence |
| 62 | `BPC_BranchingConsequenceSystem` | Component | Narrative consequence execution; state changes, item grants |
| 63 | `BPC_TrialScenarioSystem` | Component | Timed trial/puzzle scenario; begin, evaluate, success/fail |
| 64 | `BPC_CutsceneBridge` | Component | Cutscene bridge; play, skip, milestone flags, camera transfer |
| 65 | `BPC_LoreUnlockSystem` | Component | Lore/journal entry unlock; trigger, categorize, notify |
| 66 | `DA_NarrativeDataAssets` | Data Asset | Narrative data: DialogueData, CutsceneData, ScenarioData |
| 67 | `BP_NarrativeTriggerVolume` | Actor | Narrative trigger volume; sets flags, starts dialogue/scene |
| 68 | `BPC_EndingAccumulator` | Component | Ending tracker; accumulates conditions, determines outcome |
---
## Category Data Flow
```
┌──────────────────────────────────────────────────────────────────┐
│ NARRATIVE PIPELINE │
│ │
│ BP_NarrativeTriggerVolume (world-placed) │
│ │ Player enters → triggers narrative event │
│ ├─► Sets narrative flags in BPC_NarrativeStateSystem │
│ ├─► Starts dialogue via BPC_DialoguePlaybackSystem │
│ └─► Activates objectives via BPC_ObjectiveSystem │
│ │
│ BPC_NarrativeStateSystem (state machine) │
│ │ Tracks: narrative flags, milestones, chapter phase │
│ │ Gating: checks flags before allowing story beats │
│ └─► Syncs to GS_CoreGameState for UI display │
│ │
│ BPC_ObjectiveSystem (quest tracker) │
│ │ Activate → Complete → (optional: Fail) │
│ │ Branching: objectives can split based on choices │
│ └─► Updates GS_CoreGameState.ActiveObjectiveTags │
│ │
│ BPC_DialoguePlaybackSystem │
│ │ Line queue: sequential or branching │
│ │ VO playback with subtitles │
│ └─► BPC_DialogueChoiceSystem (choice points) │
│ │
│ BPC_BranchingConsequenceSystem │
│ │ Executes consequences of dialogue choices │
│ │ State changes, item grants, NPC disposition │
│ └─► Feeds back to NarrativeStateSystem │
│ │
│ BPC_EndingAccumulator │
│ │ Accumulates ending conditions throughout the game │
│ └─► At end: determines which ending plays │
└──────────────────────────────────────────────────────────────────┘
```
---
## 58 — BPC_NarrativeStateSystem: Narrative State Machine
**What It Does:** The central narrative authority. Tracks all story flags, milestones, and chapter progression. Every narrative system queries this component to determine what content is available. Uses GameplayTags for all state — no booleans or strings.
**How It Works Internally:**
- Maintains a map of narrative flags (GameplayTag → current value)
- Tracks completed milestones (chapters, key story beats)
- Gates content: dialogue options, objective availability, trigger volume activation all check narrative flags
- Syncs with `GS_CoreGameState` for session-wide narrative state
- Chapter phase tracking: sub-chapter progression within acts
- Implements `I_Persistable` for save/load of story progress
---
## 59 — BPC_ObjectiveSystem: Objective/Quest Tracker
**What It Does:** Manages all active, completed, and failed objectives. Supports branching objectives (choice A leads to objective X, choice B to objective Y), sequential objectives, and hidden objectives that reveal on discovery.
**How It Works Internally:**
- Activates objectives from `DA_ObjectiveData` Data Assets
- Tracks progress per objective (counters, location checks, item possession)
- Branching: objective completion can spawn child objectives based on player choices
- Hidden objectives: exist in background, reveal when conditions met
- Updates `GS_CoreGameState.ActiveObjectiveTags` → UI updates automatically
- Fires dispatchers: `OnObjectiveActivated`, `OnObjectiveCompleted`, `OnObjectiveFailed`
---
## 60-61: Dialogue Systems
**BPC_DialoguePlaybackSystem:**
- Manages a line queue: sequential dialogue lines with configurable auto-advance or manual continue
- VO (voice-over) playback with subtitle display
- Supports speaker identification (NPC name, portrait)
- Animation triggers on key lines (gestures, expressions)
- Skip functionality for individual lines or entire conversations
**BPC_DialogueChoiceSystem:**
- Presents dialogue choices at branching points
- Filters available choices by narrative flags (choices only appear if conditions met)
- Each choice has consequences executed by `BPC_BranchingConsequenceSystem`
- Supports timed choices (auto-select default if timer expires)
- Tracks choice history for later reference
---
## 62-68: Supporting Narrative Systems
- **62 BPC_BranchingConsequenceSystem:** Executes narrative consequences: sets narrative flags, grants/removes items, changes NPC disposition, unlocks objectives, triggers cutscenes.
- **63 BPC_TrialScenarioSystem:** Timed challenges: puzzle solved within time? stealth section without detection? combat encounter with specific constraints? Evaluates success/fail conditions.
- **64 BPC_CutsceneBridge:** Manages cutscene playback: transfers camera to sequencer, blocks input, plays cutscene, restores control. Supports skip (with milestone flag set), pause, and post-cutscene state restoration.
- **65 BPC_LoreUnlockSystem:** Unlocks journal/lore entries on triggers (finding a document, reaching a location, completing an objective). Categorizes entries and notifies UI.
- **66 DA_NarrativeDataAssets:** Data Assets for DialogueData (lines, speakers, VO references), CutsceneData (sequencer references, skip flags), ScenarioData (trial parameters).
- **67 BP_NarrativeTriggerVolume:** World-placed trigger volume. On player overlap: sets narrative flags, starts dialogue, activates objectives. One-shot or repeatable.
- **68 BPC_EndingAccumulator:** Tracks ending conditions throughout the game (which key choices were made? which NPCs survived? which objectives completed?). At end-game trigger, evaluates all conditions and determines which ending sequence plays.
---
## Common Implementation Patterns in This Category
1. **Flag-Based Gating:** Every narrative decision sets a GameplayTag flag. Content (dialogue, objectives, endings) checks these flags to determine availability.
2. **Data-Driven Content:** Dialogue lines, objective descriptions, choice text — all in `DA_NarrativeDataAssets`. Writers never touch Blueprint logic.
3. **Choice → Consequence Pipeline:** Dialogue choice → executed by ConsequenceSystem → sets flags → future content gated by those flags.
4. **Accumulator Pattern:** Ending system doesn't decide at each moment — it accumulates evidence throughout the game and evaluates at the end.
5. **Trigger Volume Pattern:** World-placed triggers handle most narrative beats — no level blueprint spaghetti.
---
*Developer Reference v1.0 — 07 Narrative Systems. Companion to docs/blueprints/07-narrative/ specs.*