GDQuest / meta

A repository to talk about GDQuest at large, guidelines, etc. all in one place. This is where public discussions that don't belong to a specific repository go.
GNU General Public License v3.0
13 stars 3 forks source link

GDscript guidelines: Event bus pattern #5

Closed NathanLovato closed 5 years ago

NathanLovato commented 5 years ago

See the corresponding section in the gdscript guidelines

razcore-rad commented 5 years ago

OK, so I've been thinking of how to visually show this for a bit now. I came up with a simple example: eventbus

I need your feedback/suggestions on how to go about this. I initially planned on making a secondary abstract view on the bottom of the screen, like a panel that shows how the events are triggered and linked to objects, but the example is too simple for that. There's just two events: attacked from Player & damaged from Dummy and it goes like Player - attacked -> Dummy damaged -> update Player EXP UI.

The thing is signal management can be pretty complex if not thought through, could even lead to circular dependencies so any thoughts on how we could show (perhaps non-linearly) how this is in practice (a network of nodes & connections that blink when signals are emitted/received?) or something like that.

Or is the example above enough you think?

So as topics to be expanded upon I have:

  1. code vs editor UI
  2. limitations of UI and using the Events singleton "pattern" in code to manage complex systems
  3. simple signals (emit - receive - STOP)
  4. complex signals that could lead to circular dependencies (emit - receive - emit - receive - etc.)

I'm thinking of having the same simple example from above made with:

cc @NathanLovato

NathanLovato commented 5 years ago

The example above is enough, along with your explanations and showing some of the code. You don't want to spend too much time on such a video that targets experienced developers, but also as it's not going to get a ton of views. Considering our code will keep getting better, that our use of the pattern might change as we develop more games, and that future Godot updates may improve signals so that this pattern isn't as useful anymore, I prefer that we keep moving forward at a good pace.

razcore-rad commented 5 years ago

Alright, I've thought about this and I think I got it to a level I'm happy with. I'll be recording the vid tomorrow morning.

eventbus_02

NathanLovato commented 5 years ago

The video: https://youtu.be/S6PbC4Vqim4