Announcement

Collapse
No announcement yet.

Are there rules that determine when to choose Casting over Function over Event Dispatchers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Are there rules that determine when to choose Casting over Function over Event Dispatchers

    I understand how to use all of those BUT I still dont know WHEN to use WHICH :-)
    Are there any situational rules that you guys use to help you decide?
    Are Event Dispatchers faster than Casting for example?
    TY :-)

    #2
    Unlike 'don't run everything on Tick' or 'don't use a zillion tris for character meshes', there isn't really a rule for this (comms are just too critical to game dev). At least that's the conclusion I've taken from similar threads. Otherwise it would be known that Epic favors one particular method over another and therefore devs would know which to avoid.

    Overall the best choice which you haven't mentioned yet are Interfaces. You can treat them like global Custom Events (and even get return values back which Event Dispatchers can't do). Setting them up is a little more abstract at first. But give them a try, you may never look back!

    In general, casting clutters the BP graph. But you'd have to use an enormous amount on Tick to see a performance hit. BTW: You can massively reduce casting to help simplify your code. Casts are ok as filters to catch actors in certain events or for accessing UMG objects. But its often easier to just embed them in Global-Function-Libraries or simply use Direct Comms instead (actors set to a specific type at design time or one-time Casts @ BeginPlay).

    BTW: Whatever happened to World of Clouds?

    TLDR: Pick whatever your weapon of choice is.
    Last edited by EntrpriseCustomr; 07-05-2020, 10:16 PM.

    Comment


      #3
      Originally posted by EntrpriseCustomr View Post
      Unlike 'don't run everything on Tick' or 'don't use a zillion tris for character meshes', there isn't really a rule for this (comms are just too critical to game dev). At least that's the conclusion I've taken from similar threads. Otherwise it would be known that Epic favors one particular method over another and therefore devs would know which to avoid.

      Overall the best choice which you haven't mentioned yet are Interfaces. You can treat them like global Custom Events (and even get return values back which Event Dispatchers can't do). Setting them up is a little more abstract at first. But give them a try, you may never look back!

      In general, casting clutters the BP graph. But you'd have to use an enormous amount on Tick to see a performance hit. BTW: You can massively reduce casting to help simplify your code. Casts are ok as filters to catch actors in certain events or for accessing UMG objects. But its often easier to just embed them in Global-Function-Libraries or simply use Direct Comms instead (actors set to a specific type at design time or one-time Casts @ BeginPlay).

      BTW: Whatever happened to World of Clouds?

      TLDR: Pick whatever your weapon of choice is.
      Thank you.
      World of Clouds is there and I am developing stories / games set in it.
      Escape from Mill Station is paused until I finished up with WindQuest then I will pick up on that one again.
      Website is here thanks for asking :-) http://worldofclouds.com/
      and EfMS here: http://worldofclouds.com/escapefrommillstation.html
      Btw all the games I develop are set in the World of Clouds. :-)
      I just got really frustrated with how long EfMS was taking and that I couldn't get to a point where I could say I actually COMPLETED a game.
      So I decided to split off sideways for a bit and just make "little games" so at least I could get the feeling that I can actually finish a game :-)
      http://worldofclouds.com/dwnldpage.html
      Last edited by Etienne Andlau; 07-05-2020, 10:30 PM.

      Comment

      Working...
      X