playMaker

Author Topic: Is 'Broadcast All' too heavy?  (Read 2007 times)

Slowboy71

  • Playmaker Newbie
  • *
  • Posts: 7
Is 'Broadcast All' too heavy?
« on: March 02, 2014, 08:44:05 PM »
Hi All, new here, first post, been reading a lot though, so thanks for helping me already!

My question is this - should I avoid Broadcast All?? The name suggests it would be intensive and unnecessary, and I should try to broadcast to specific objects where possible. Is this the case?

It's just that I have a prefab that I cannot broadcast to a specific game object (upon collision), because it's a prefab, yeah? So, I could reverse the process and have the collide object make the broadcast to the specific object when it is hit by the prefab.

Should I take the time to reverse the process, because Broadcast All is too heavy, or do you think I would be safe to leave it as is and have the prefab Broadcast All?

Thanks for listening!

Wayne

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Is 'Broadcast All' too heavy?
« Reply #1 on: March 03, 2014, 07:39:54 AM »
If you don't notice a performance hit then there's probably no reason to worry about it.

Generally though, you want to identify targets explicitly because sending a message to every object just because you didn't want to explicitly define the target is bad practice. Usually I try to set things up in such a manner that the FSM creating the prefab instance will fill in the blanks that the instance needs or the prefab will be setup to get the information at runtime when it is spawned.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is 'Broadcast All' too heavy?
« Reply #2 on: March 03, 2014, 11:54:49 PM »
Hi,

 I use broadcast all a lot. you should rely on PlayMaker doing a good job at keeping track of what Fsm should respond and everything. over the years, I never had a performance issues with this.

 typically, I actually would promote using broadcast all, it's really a very direct way of having different part of your ame interacting without having to keep references of each other. It's very powerful and you should embrace it.

As Lane says. It's also good that you don't broadcast to all when you know exactly who should receive it, and also, if you start having to filter these events and do nothing upon receiving them, then you have a design problem. Broadcasting to all should be a case where everyone interested will do something when receiving that event.

 Bye,

 Jean

Slowboy71

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Is 'Broadcast All' too heavy?
« Reply #3 on: March 05, 2014, 04:14:06 PM »
Thanks guys! With great responses like that, don't expect this to be my last question!  ;D
Cheers
Wayne