Communicating between game objects with the observer pattern

Published: 02 June 2022
on channel: The Shaggy Dev
7,768
502

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: https://shaggydev.com/2022/06/01/obse...

More info on the observer pattern: https://gameprogrammingpatterns.com/o...

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


Watch video Communicating between game objects with the observer pattern online without registration, duration hours minute second in high quality. This video was added by user The Shaggy Dev 02 June 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7,768 once and liked it 502 people.