Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | NoobOfTheDay |
I’m still learning Godot, so please forgive me, if my questions sound stupid. It’s not on purpose, it’s just me in this case.
As far as I read about it, it seems to me that the signaling system is implemented only half way when it comes to decoupling nodes.
While it is fantastic that every node can emit signals (build-in and custom) at any time, it is a bit odd to me, that the receiving node has to know exactly(!) which node emits a certain signal in order to receive it. (If I understood the mechanism correctly.)
That is not, what I would call “loose coupling”.
In my opinion the receiving node should only register itself for a certain signal at a central object in the system, let’ call it SignalHUB, and receive information no matter who emitted the signal. That would really decouple it from the emitter and would probably work across the whole application.
I’m sure one could implement such a central SignalHUB quite easily with GDScript and place it near the root of the project. But I’m wondering some things:
- Does Godot maybe already have such a central signal distributor that could be used for such an approach?
- Would you recommend the use of this pattern as it creates a possible bottle neck at the central SignalHUB node?
- Would you encourage the use of signals in general to control ALL (inter)actions in a middle to large application? (Or should the use of signals be limited to a number of usecases?)
Edit: corrected typo