Communicating between game objects with the observer pattern

  Рет қаралды 7,734

The Shaggy Dev

The Shaggy Dev

Күн бұрын

Пікірлер: 24
@JacobKinsley
@JacobKinsley Жыл бұрын
Somehow, the way Scratch does it is the best and most intuitive implementation of the observer pattern in any kind of programming language/tool. Like, it'll broadcast a string like "game start", and you'll just stick a block on top of your logic that says "on receive: game start". It was so intuitive when I was playing wind waker as a wee 5 year old I was noticing the observer pattern as I would play parts of the game, and this was when I didn't even really know what games were and I thought the whole world was fully simulated at all times and not a series of interconnected maps.
@Imjagpul
@Imjagpul 8 ай бұрын
Thanks so much for making this, TheShaggyDev! Great content. I love that you also included a text version alongside it. It makes the content much easier to follow, I really appreciate the extra effort.
@tumbleweb
@tumbleweb 2 жыл бұрын
I'm finding this incredibly important while developing prototypes in Godot 4 alpha. Things breaking is inevitable, so making things not-hardcoded will make it easy to port and fix problems as they come. Thank you for making exhaustive videos on these topics!
@ponderingpermanence8095
@ponderingpermanence8095 2 жыл бұрын
Really enjoy your videos, it fills a much needed space.
@TheShaggyDev
@TheShaggyDev 2 жыл бұрын
Thank you! Always nice to hear :)
@luphaestus
@luphaestus 2 жыл бұрын
I assumed this had around 100k views but only 200!!! Wow, your videos are so good
@TheShaggyDev
@TheShaggyDev 2 жыл бұрын
Thank you! Glad you like them :)
@BingrunJiang
@BingrunJiang 2 жыл бұрын
Hi, I'm new to game development by using Godot, and thank you for such an awesome quality videos, I am just watched the finite state machine tutorial series and enjoyed it very much. In this video, I imagine when the games grow, the event bus will handle more and more signals. I will have a huge signal list in just a single script and that might be hard to maintain. Is it a generic situation?
@TheShaggyDev
@TheShaggyDev 2 жыл бұрын
Thanks for watching! Glad you've been enjoying my videos 😁 And yeah, that's definitely something that can happen. There's three main ways to deal with a massive event bus: Just go with it. If you can internally organize your events emitter that makes sense then you can get away with a pretty big bus. Create multiple buses geared towards different purposes, such as one bus for UI events, one bus for big game events (win, lose, etc), and so on. The other option, which is more correct but also more challenging, is to not go overboard with event buses and instead use alternative methods for passing events and data around, such as using dependency injection to pass references to objects or functions directly, or using events locally and not throwing them into a global bus, as you ideally shouldn't need to go overboard with global signals.
@BingrunJiang
@BingrunJiang 2 жыл бұрын
@@TheShaggyDev Cool! Thanks for the detailed analysis, I will take a look into it and try that three :D
@kjmunson1
@kjmunson1 Жыл бұрын
Give this fellow tenure already.
@SaiponathGames
@SaiponathGames 2 жыл бұрын
Really cool bro! I have been making a game using Godot, and this observer event pattern is really great! Can you make a video on to debug the project efficiently and giving some tips to debug the Godot Project in a easy way?
@SaiponathGames
@SaiponathGames 2 жыл бұрын
I have been trying to debug a laggy project that seems to be caused by a Audio issue, but when I isolate the scene, it doesn't seem to lag.
@TheShaggyDev
@TheShaggyDev 2 жыл бұрын
@@SaiponathGames Hmm, have you taken a look at the profiler in the Debugging tab when running the game? That should let you see the exact bits of code that are running slowly and can hopefully figure it out from there. I've already got the next few videos in various stages of production, but it could be worth talking about this more in depth at some point...
@SaiponathGames
@SaiponathGames 2 жыл бұрын
@@TheShaggyDev I looked into it, what I found was that, the audio seems to be taking a lot of time.
@TheShaggyDev
@TheShaggyDev 2 жыл бұрын
@@SaiponathGames Hmm, hard to say without more info. Could try asking on the Godot forums or on the subreddit with some more details and see if anyone has some ideas?
@SaiponathGames
@SaiponathGames 2 жыл бұрын
@@TheShaggyDev I have a video about it in my personal channel. Here it iskzbin.info/www/bejne/oXvcdIiMed5gbdE
@ElonSamade
@ElonSamade 7 ай бұрын
The event bus is just another fancy way to say the Controller ? MVC.
@polygonalcube
@polygonalcube Жыл бұрын
Have you considered uploading your videos on Odysee in addition to KZbin?
@TheShaggyDev
@TheShaggyDev Жыл бұрын
I hadn't even heard of it before this comment, so nah, that's not something I'm really interested in at this point.
@polygonalcube
@polygonalcube Жыл бұрын
@@TheShaggyDev Fair enough. Just figured you might want to use it as a video backup site.
@TheShaggyDev
@TheShaggyDev Жыл бұрын
@@polygonalcube Sure, always worth taking a look at other options :)
@JacobKinsley
@JacobKinsley Жыл бұрын
Wow, did you make all these games?! Never mind I just saw elden ring lmao
@JacobKinsley
@JacobKinsley Жыл бұрын
Just my opinion, but the background is really damn distracting while I'm trying to understand what you're saying, I had to close my eyes and rewind the video
How to write more flexible game code
8:36
The Shaggy Dev
Рет қаралды 21 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 104 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 8 МЛН
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19
Delegates, Events, Actions and Funcs - The Observer Pattern (Unity & C#)
11:48
What You Need To Know About The COMMAND PATTERN
14:09
BMo
Рет қаралды 3,5 М.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 361 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 732 М.
A few common code smells to be aware of and how to fix them
6:32
The Shaggy Dev
Рет қаралды 15 М.
11 tips for writing cleaner code
7:19
The Shaggy Dev
Рет қаралды 10 М.
How to Program in Unity: Observer Pattern Explained
15:57
iHeartGameDev
Рет қаралды 116 М.
An introduction to graph rewriting for procedural content generation
7:31
NVIDIA’s New AI: Stunning Voice Generator!
6:21
Two Minute Papers
Рет қаралды 110 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 127 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 104 МЛН