Hello.
I want to use publish/subscribe pattern to implement communication between game engine parts. But the problem is that I cannot find any articles about how it must be implemented in games. Can you, please, give me some useful hints and links on this topic
The abstract pattern is called the Observer pattern. There are tons of ways to implement it and it's always relative to several properties you want it to provide.
It's also often called "event system" or event something.
You will find tons of examples and explorative implementations (in C++ at least) by using "observer pattern" in your google research.
It's the same idea, one focused on observing one entity's event, the other on observing specific event types occurences.
Whatever way you got, there are also other concerns : does it have to be direct notifications? do they have to be buffered? thread-safe? etc.
Klaim wrote:It's the same idea, one focused on observing one entity's event, the other on observing specific event types occurences.
Mostly, you are correct. But the difference is: the publishers are unknown to the listeners, and the listeners only subscribe to a class of publishers, without knowledge of what they may actually be. They are more loosely coupled than the Observer pattern.
If you want to make an apple pie from scratch, you must first create the universe. ~Carl Sagan