[Plugin] Global Event System

Hey Devs!
Made a new open source (MIT) plugin that adds a global event system to the Unreal engine.

What is it?
A loosely coupled internal global event system (GES) plugin for the Unreal Engine. Aims to solve cross-map and cross-blueprint communication for reliable and inferable event flow.

Because the events are emitted to a dynamic map of listeners you can loosely link parts of your project without needing to redo boilerplate when you change parts of the code, dynamically change environments, delete actors or e.g. load a different submap. Fire something away, and if something is interested in that information, they can do something with it; optional.

Where can I get it?
Documentation and Repo - GitHub - getnamo/global-event-system-ue4: Loosely coupled internal event system plugin for the unreal engine.
Releases - https://github.com/getnamo/global-ev…m-ue4/releases

How do I use it?
There are globally available functions that you can use to emit and bind events. At this time there are two variants for emitting (no parameters and one wildcard parameter) and one for binding events to your local functions. Each event has a domain which means you can ensure that your messages do not clash with other emitters with the same name but used for a different purpose.

Each emit is a multi-cast to all valid bound receivers. If the parameters don’t match you’ll be warned in the log with fairly verbose messages while emitting to all other valid targets.

Emits also support pinning which means you can post some state to optional listeners that join after it has been emitted (can’t miss the event).

Emit Side

Receive Side

Example Pinned Event

Imagine that you need to be notified about some actor being spawned and you can’t control when that will occur. If you pin the emit on the actor when emitted, late binds will still be notified about that event. This use case is largely to replace the ‘get all actors’ type of polling we often do (with maybe even a delay to ensure everything has settled before we poll…).

There are plenty of other use cases I’m keen on using this for, but I’m curious how this could be useful to all of you.

If you try it, let me know what you think.

4 Likes

Hi getnamo!
Thank you so much for this awesome plugin!
It’s just what I was looking for! Thankfully I can now decouple my gameplay systems nicely.
I really wonder why there’s not such a system already contained in the engine.
If you just have the engine event systems (event dispatchers, interfaces etc.) everything is so closely coupled always.

Please keep it up updating with new engine versions.
If I can help you with development, I’d happily help out!

So thanks again!

Best regards

Nairam

Cheers Nairam,
I’m not sure why Epic doesn’t have this built in, in some ways a decoupled system is opinionated and may cause organization issues later on if it’s used everywhere. That said this is one approach that should be simple to use. Some notes: I do recommend you unbind events on endplay/destruction for each area where you add them as the auto-unbind isn’t 100% atm from tests I’ve done in real projects. In terms of development, some wrapper API like a generic component we can subclass and specialize as a listener we can quickly add to an actor would be useful if you feel up to trying to add something :slight_smile:

1 Like

I don’t get how this hasn’t blown up. The premise is fantastic! Though if time allows it a simple little example game would be nice and help spread the plugin even more. I’m curious, did you mention the plugin on the unreal subreddit and Unreal Slackers Discord channel already? If not, I’ll definitely be doing that after I’ve tinkered enough with it myself.

3 Likes

Surprised this has so little recognition, will be definitely using this

Thankyou very much for your awesome plugin.
But I found an issue when implement this plugin to my project.
When I play game in UE editor, if I press stop (red square) button to stop my game. Some time the listeners in EventMap is not cleared, and when I replay the game, if the emit called it will check the old listener and make editor crash.
Reproduce steps:

  • Try start game, listen to and event and stop game.
  • Repeat about steps time many and when you emit event, the editor will crash it line 485 file GESHandler.cpp if (!Listener.ReceiverWCO->IsValidLowLevelFast()).

When show debug, I can see the event map have about 10 listeners of that event but I only have 2 object bind to that event. All other listeners is from previous sessions.

I tried call GESUnbind in object’s EndPlay and Destoryed events, but the issue is not fixed.

For now, I avoid the issue by I added a Reset function to clear GES’s EventMap in GameInstance::Shutdown event and it work for my project.

Hope you have time to fix the issue permanently.
Thank you a lot.