Skip to content
Pablo Rodriguez

Character Integration Communication

Creating clean communication between UI widgets and game systems using interfaces and object references.

Interface Creation: Interface_HUD_Coursera

Widget Getter Functions (Widget category):

  • Get_Widget_Player_Health_Bar → Object output
  • Get_Widget_Player_Mana_Bar → Object output
  • Get_Widget_Player_Stamina_Bar → Object output

Root Widget Management:

  • Create Widget node → promote return value to Widget_Root variable
  • Add interface to Class Settings
  • Implement interface functions to navigate widget hierarchy:
Get Widget Root → Get Resources Widget → Get Progress Bar Template (Health/Mana/Stamina)

This creates a clean chain from HUD → Root → Resources → Individual progress bars without hard references.

Statistics Variables (Float, Statistics category):

  • Health: Health_Current, Health_Minimum, Health_Maximum
  • Mana: Mana_Current, Mana_Minimum, Mana_Maximum
  • Stamina: Stamina_Current, Stamina_Minimum, Stamina_Maximum

Variable Organization: Use categories to organize blueprint variables:

  • Statistics: Health, mana, stamina values
  • Input: Control-related variables
  • Mobility: Movement abilities
  • Animation: Stance variables
  • Appearance: Mesh-related variables
Organization Tip

Clean Code Practice: Game development blueprint variables become extremely messy quickly - always take time to organize work with proper categories.

Interface Creation: Interface_Character_Coursera_Master

Math Enumeration: Enumeration_Math

  • Add
  • Subtract

Statistic Modification Functions (Statistics category):

  • Interface_Health_Modify (Value: Float, Math: Enumeration)
  • Interface_Mana_Modify (Value: Float, Math: Enumeration)
  • Interface_Stamina_Modify (Value: Float, Math: Enumeration)

Master Character Implementation:

For each statistic interface:

  1. Switch Node based on Math enumeration
  2. Add Branch: Current + Value → Clamp (Min/Max) → Set Current
  3. Subtract Branch: Current - Absolute(Value) → Clamp (Min/Max) → Set Current
  4. Call Override Function: F_Health_Modify, F_Mana_Modify, F_Stamina_Modify

Override Functions:

  • Created as empty functions in Master Character
  • Child classes override these for specific behavior
  • Allows different UI update patterns for Player vs AI characters

FWidget_Setup Function: Create object references to UI widgets through HUD interface:

Get Player Controller → Get HUD → Get Widget Player Health Bar → Store as Widget_Player_Health_Bar (Object)

Progress Bar Interface Communication: For each widget reference:

  1. Set Min/Max: Use Interface_ProgressBar_Set_MinMax with character statistics
  2. Set Current: Use Interface_ProgressBar_Update_Current with current values
  3. Update Character Variables: Set current values to maximum (full health on start)

Player Character Overrides:

  • Override F_Health_Modify, F_Mana_Modify, F_Stamina_Modify
  • Each function uses stored widget reference + Interface_ProgressBar_Update_Current
  • Updates UI immediately when statistics change

Event Begin Play Integration:

  • Add Call to Parent Function for master character initialization
  • Call FWidget_Setup to establish UI connections
  • Use delay (0.2 seconds) if needed for widget initialization timing

Class Defaults Setup:

  • Health Max: 1000
  • Mana Max: 100
  • Stamina Max: 100
  • Leave minimums at 0

Testing Verification:

  • Resource bars show proper values (not 50% default)
  • Switch progress bar display to “Numbers” to verify communication
  • Values update in real-time when statistics change

This architecture creates a clean separation between game data (stored in characters) and UI display (widgets), with interfaces providing controlled communication channels that prevent circular dependencies and maintain performance.