Which more expensive: Broadcast or Conditional?



  • @Kamdroid I was kind of hoping they just read these forums as a matter of course. It's not like there's much in here ;)

    Except for my dribbles and rants.

    I'm not so sure about the listeners actively listening. This might be just a metaphor being used. They're probably sitting in an array or dictionary that's messaged only when a "broadcast" is sent, meaning highly efficient. Possibly more so than conditionals.

    boring story approaching: A friend of mine, a few years ago, spent a huge amount of time teaching me to not use ifs because he'd found them to be a bit of a drag in high frequency stuff. We were doing lots of particles, where the volume of activity was enormous, but we always wanted more. More particles = good! It was all C++ and he had some pretty tight stats on it all. Made me a believer, even if I didn't fully understand where he was headed with it all.

    The bottom line was polymorphism being used correctly, I'd dare say. He is a bright guy. I'm just a designer, but it fascinated me that he'd figure how to remove ifs like they were parasites.


  • Admin

    Broadcasts are really fast. They are much faster than using collisions or something like that. @Deeeds it works like you think it is.



  • @Hamed BEST NEWS TODAY! I can and will base most of what I'm doing around them, then. And use them like function/method calls all over the place. I thought this might have been one of the ways you were making them useful.

    THANK YOU!!! Way to go!


  • Admin

    @Deeeds The only thing i would suggest doing is leaving little comments for your self otherwise you will have a bunch of broadcasts and receives that you don't remember what they're for.



  • @Hamed Yeah, I have a Notes file with that sort of gunk. I've been meaning to request picking Event Keys operate like Behaviour On/Off where there's a long list of all possible ones, by alphabetical order, by object/original origin.



  • @Hamed Are broadcasts expensive at all? For example, in my 3D project the faces of a shape have to conform to 3 points, I’ve done this (messily) by colliding with those 3 points (they’re in a tag) and then basically getting the position on a timer of the object it collided with. Is this at all more efficient that constantly broadcasting dynamic messages?



  • @Aidan-Oxley I would think broadcast would be better. Because otherwise you have objects with collisions, but you wouldn’t need that if you didn’t use collide.


  • Admin

    The only expense is having a lot of logic in the receive message side. Physics engine is much slower to do those kind of tasks.



  • @Hamed The collision happens once. The face collided with one point, the turns off that collision and moves to another point. It does this 3 times with 3 separate collision behaviours. Once it’s done, it waits until everything else has finished loading, then runs a timer on the behaviours underneath the collisions so that it can get information on those 3 objects. So this is more efficient than broadcasting a message on a timer containing an objects position right?


  • Admin

    No broadcasting is still much faster. You can avoid timers and delays and collision take multiple time steps