top of page

Unreal Blueprints - Event Dispatcher to the Rescue.

  • Writer: Dihlon Luther
    Dihlon Luther
  • Jul 31
  • 2 min read

The Problem: Our game required the use of a system--which the player and multiple actors in the scene needed to reference--that activated abilities and spawned events, traps, etc.


In this game, the player is "possessed" by an evil spirit. A progress bar displays how "possessed" they are, and if that bar reaches 100%, they die.


However, the bar also provides abilities granted by the spirit's power (such as telekinesis) and causes environment elements to change (a wall blocks your path at a certain level of possession)


The Solution:


Unreal Engine 4 offers a system known as the Blueprint Interface.  Essentially, use of Blueprint Interfaces allows multiple objects to reference a set of core functions.


This creates not only a streamlined reference system, but also a basis for the introduction of our real hero, the event dispatcher. 


ree


As displayed in the photo above, each time the possession value changes, it notifies all the objects that need to know, without creating any unnecessary dependencies.


In a less streamlined system, one might utilize a series of "Cast To..."'s or repeat code via the Tick Event. These can be extremely taxing on the system and a cause a dangerous fragility, as the whole structure could topple over if just one thing needs to be changed.


Using Event Dispatchers and Interfaces as overseers reduces excess communication between actors. It allows other objects to sign up for a sort of anonymous "mailing list" of information (in fact, notice above that Event Dispatchers are even displayed as envelopes within Unreal!).

ree

Note that the event dispatcher itself needs no excess code. (See image on the right)


All it needs to do is send a notification to its "mailing list" that gives the go-ahead for any marked objects to perform their desired tasks.


For example, this disappearing wall -- whose effect I also made (below) -- reacts when the the progress bar crosses the X symbol, and reappears when possession dips below the X symbol.


ree


This is the work of the event dispatcher, who the wall "signs up" for a single time when the level begins (see blueprint below) and is notified by when a relevant change occurs.


ree

The player, too, can follow a similar blueprint to tie abilities to certain milestones to this system, and any other objects need only alter the latter half of the code to tailor to their functions.




Thanks for reading!


Check out this link to the developer's blog for Middlewalker.


-Dihlon

 
 
 

Comments


  • LinkedIn

©2025 by Dihlon Luther

bottom of page