So I was just watching this video: Blueprint Communications | Live Training | Unreal Engine - YouTube and this 4 minutes into the video where he is going over a simple primer it’s mentioned that UE4 has no way to globally broadcast something (like an event) and that this used to be the case back in UE2 but is no longer the case because it’s inefficient. My question is why is this considered inefficient? In a global event system, you can simply have subscribers to different events (which can easily be stored in an array) and then anytime an object publishes an event, all the subscribers to this specific event are notified. This doesn’t seem inefficient at all and it completely decouples all the objects in the game which in my view is a very good thing because you avoid spaghetti kinds of relationships between objects. In fact an entire game can be set up with this structure. Why is this considered a bad practice? Thank you!
It’s very possible to broadcast.
you can simply have subscribers to
different events
By doing exactly that. Objects can register and become listeners. Example:
which in my view is a very good thing
because you avoid spaghetti kinds of
relationships between objects. In fact
an entire game can be set up with this
structure. Why is this considered a
bad practice?
Preach! It’s great practice, imho. In my current project I have (almost) completely eliminated direct references to widgets and rely on delegates exclusively.
There is an upfront cost of it being harder to understand and wire up initially - perhaps that’s why it’s not a part of a primer video. You reap the rewards of having your code despaghettised later on, though.
Link is dead. By any chance have another example to share?
Fixed. There are still so many broken links everywhere…
Thank you!
I’m looking for any type of messaging subsystem until I make the time to check out what Lyra has to offer: GameplayMessageSystem | Unreal Engine Community Wiki.
A messaging subsystem of broadcasters sending structs using gameplay tags as channels.
No delegates, you say? Intriguing. Got it, I hope. What a mouthful! It seems to trivialise what most poeple struggle with - comms.