Communicating between game objects with the observer pattern @TheShaggyDev
Communicating between game objects with the observer pattern  @TheShaggyDev
Uploaded June 2022 | Updated November 2026, 3 hours ago
One of the most common issues you'll run into in your game development journey is how to let two unrelated objects communicate with one another in a way that doesn't completely ruin the organization and flexibility of your code. The observer pattern is one potential solution to this problem, and makes it easy to let different game objects communicate with one another without coupling your entire application together. With native support in most languages and game engines, it really is something you should keep in your toolbox. We can also expand upon this concept further and introduce the event bus, a way of letting more distant objects connect to one another while still keeping the flexibility of your code intact.

Text version of this video: shaggydev.com/2022/06/01/observer-pattern

More info on the observer pattern: gameprogrammingpatterns.com/observer.html

Background and motivation: 00:00
The observer pattern: 01:34
Observables in practice: 02:52
Global access via an event bus: 05:02
The event bus in practice: 05:31
Final thoughts and further reading: 06:04
Communicating between game objects with the observer patternSetter and getter functions in Godot 3 with setgetHow unit selection works in my tactical strategy gameCreating volume sliders in Godot 4Advanced state machine techniques in Godot 410 small ways to make your life easier in GDScriptFree Loopable Game MusicManaging unit data in my turn-based strategy gameThe easiest way to monitor anything in Godot 411 tips for writing cleaner codeGodot 4 beta + channel updateCallbacks and function references in Godot 3 using FuncRefs
The Shaggy Dev |

Communicating between game objects with the observer pattern

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER