Skip to content
Pablo Rodriguez

Narrative System

Create structured narrative system for dialogue and story delivery:

  • Narrative Text: Story content for display
  • Simple Structure: Single text field for straightforward implementation

Enhance NPC characters with cinematic narrative presentation:

Modify bp_character_npc with camera components:

  • Camera Boom: Target arm length -150, Z location 70
  • Follow Camera: Z rotation 180°, Y rotation -12.5°
  • Cinematic Angle: Creates engaging conversation view

Create immersive dialogue interface:

  • Size Box: 800x250 for substantial text display
  • Background Image: Black background, 90% alpha for readability
  • Text Block: 770x190 text area with 16pt font
  • Auto Wrap Text: Enable for proper line breaking
  • Button Controls: Next and Close buttons
  • Background Treatment: Dark overlay for text readability
  • Text Positioning: 15-pixel margins for comfortable reading
  • Button Placement: Next button bottom-right, Close button top-right

Create communication system between NPCs and narrative UI:

// Narrative Interface Functions
Interface_Widget_Narrative_Toggle() {
// Show/hide narrative widget
if (Widget.IsVisible()) {
Widget.SetVisibility(Hidden);
} else {
Widget.SetVisibility(Visible);
}
}
Interface_Widget_Narrative_Load(DataTable) {
current_narrative_table = DataTable;
narrative_index = 0; // Reset to first entry
DisplayCurrentNarrativeEntry();
}

Create cinematic dialogue experience:

  • Interface_Load_Narrative: Receive narrative data from NPCs
  • Interface_Reset_View_Blend: Return camera control to player
// Narrative Camera Control
OnLoadNarrative(NarrativeDataTable) {
// Switch camera to NPC for cinematic dialogue
player_controller = GetPlayerController();
player_controller.SetViewTargetWithBlend(NPC_Character, 0.5);
// Hide player character during dialogue
SetActorHiddenInGame(true);
// Load narrative content
Widget_Narrative.Interface_Load_Narrative(NarrativeDataTable);
Widget_Narrative.Interface_Toggle();
}

Enable sequential dialogue progression:

// Narrative Progression Logic
OnNextButtonPressed() {
narrative_index++;
if (narrative_index < narrative_row_names.Num()) {
// More dialogue entries available
DisplayNarrativeEntry(narrative_index);
} else {
// Narrative complete - return to gameplay
CompleteNarrative();
}
}
CompleteNarrative() {
// Return camera to player
Interface_Reset_View_Blend();
// Hide narrative widget
Interface_Toggle();
}

Allow players to exit narrative early:

  • Immediate Exit: Close button immediately returns to gameplay
  • Camera Reset: Restore player camera control
  • UI Cleanup: Hide narrative interface

Structure narrative data for easy management:

  • Database/Narrative/: Dedicated folder for story content
  • DT_Narrative_Example: Template narrative structure
  • Row Names: Automatic numbering (NewRow, NewRow_0, NewRow_1…)
  • Multiple Entries: Each row represents one dialogue segment
  • Sequential Text: Each data table row contains one dialogue segment
  • Flexible Length: Support short exchanges or long monologues
  • NPC Assignment: Each NPC can have unique narrative data table

Connect narrative system to player controls:

// Return Camera Control to Player
Interface_Reset_View_Blend() {
player_controller = GetPlayerController();
player_controller.SetViewTargetWithBlend(Self, 0.5);
// Show player character again
SetActorHiddenInGame(false);
Widget_Narrative.Interface_Toggle(); // Hide narrative UI
}
  • Root Widget: Add narrative widget to main UI
  • Positioning: Bottom middle for subtitle-like presentation
  • Default Hidden: Only visible during narrative sequences
  • HUD Integration: Follow standard widget integration pattern
  • Smooth Transitions: 0.5-second camera blends for cinematic feel
  • Clear Controls: Obvious Next and Close buttons
  • Readable Text: Appropriate sizing and contrast for text readability
  • Player Agency: Allow early exit from narrative sequences
  • Quest Integration: Narrative can trigger quest assignment
  • World State: Stories can respond to player progress
  • Character Development: NPCs can have different narratives based on game state

The narrative system creates immersive storytelling experiences while maintaining player agency and integrating smoothly with existing game systems for cohesive gameplay flow.