playMaker

Author Topic: Advice about Send Event (Broadcast All)  (Read 913 times)

Yagolov

  • Playmaker Newbie
  • *
  • Posts: 9
Advice about Send Event (Broadcast All)
« on: August 10, 2020, 12:22:14 PM »
Hello!

I have created a game for mobile which almost 90% of the game it is UI related.
Already have a prototype of the game which works and now I am ready to start making it from scratch again and start working with the real visuals and clean up my FSMs and variables etc.

I tried to keep the FSMs short and concise (using the advice of making it like "parts of human body". Because of this, I am using LOTS of interactions between FSMs.

My question is;
When I use Send Event by Name, I can drag and name the FSMs that I want to target, but I really prefer to use Broadcast All (since this doesnt create any conflict).
Broadcasting All, it is a "bad practice"?
I mean, does it requires more "power" to do so and I should specify the FSM?

Maybe this seems a bit of a dumb question, but since I am about to start the definitive version of the game, I would like to make it as efficient as possible.

Would be awesome if you could advice me!
Thank you in advance!

Yago


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Advice about Send Event (Broadcast All)
« Reply #1 on: August 10, 2020, 12:37:35 PM »
Hi.
Broadcast will send to every object/fsm.
So it is slower, but not noticeable with few fsms.
But it is indeed a bad practice if you only need to send it to 1 object/fsm.

But its also risky if you use the same event name for something in a fsm that is not supposed the receive the event you can get issues.

But you can set events as Global, which makes it easier to select them.

Also you can use / to group.

for example :
Player/Jump
Player/Shoot
This will then set in a group 'Player'

This works for variables as well.

Yagolov

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Advice about Send Event (Broadcast All)
« Reply #2 on: August 10, 2020, 01:55:05 PM »
Hello Djaydino,

Since it will have lots of Fsms, I think I will just send directly to the one that I want instead of broadcasting All.

Thanks a lot!