Hi,
I would like to know if I can make an observer pattern without event dispatcher. My problem is that I want to trigger Events and I want to be able to make the listener “listen” to the event without needing the reference of the actor that fired the event to bind it previously.
I’m sorry if it doesn’t sound clear, for exemple, in unity I used to make a class name “Event Channel” where I was making public static events that any class of my game could fire or even add a listener by delegating a method that listen to the event. I would like to do the same in unreal engine in blueprint or in C++.
INTERFACES are what you need (or can probably help you out here). Although in full-disclosure / disclaimer… Didn’t spend a whole lot of time thinking about your question. Seeing the word Unity brought back all the horrors of that game engine (esp the horrific DRM). So will be suffering Unity Engine PTSD for the rest of the evening, thanks a lot!
you can create a “Event Manager” component/actor/subsystem which will be super lightweight and modular to reference otherwise as GameMaker said you can use interfaces but depending on your situation you suffer a big performance hit (compared to dispatchers)
or if you use C++ you can create an interface that returns an Event for the best of both worlds
Interfaces doesn’t allow you to trigger events without passing the actor that have the interface in parameter. Or you can’t just delegate an event from a specific interface without having one reference attached.
I already made a World Sub System class, its really usefull. But in my case I would like to makes static function where I can bind event. Such as “Set Timer By Event” for exemple where you can delegate an event from this node. I would like to be able to do the same and if possible, bind event that takes specific parameter.
All of this in c++ of course I don’t think that blueprint is enough for this kind of advanced system.
Thanks for your response anyway, same for game_maker, thanks for trying to help me
you’re right you’d need some ‘Object’ as reference but that can be anything. I’m sure even in Unity the EventChannel is just some sort of premade Singleton.
Other than that what you mention is definitely possible in C++ and since you already have easy access Singletons like the GameState to use there really is no problem.
With source installed, right-click on BP nodes like Set-Timer-By / Create-Event to see Epic’s implementation… Blueprinters have been using hacks like Set-Timer loose-coupling for years. Sounds like you need robust code, but it might offer some quick pointers.
This is exactly what I was looking for, this plugin is so “underground”, I don’t know how you get all your knowledge but you deserve your title of “Community Hero”.
I couldn’t manage to implement the the GameplayMessageSystem with the Lyra system.
And I don’t have the plugin in the the “Plugins explorer” in my project, is there any way to fix that ?