UE5 Understanding Pure Functions - Be a better game dev

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ค. 2024
  • In this episode of be a better game dev, we will be looking into the pure functions.
    Be a better game dev playlist: • Be a better game dev
    Join the Discord server here: / discord
    Support the work of LeafBranchGames on Patreon here: / leafbranchgames

ความคิดเห็น • 37

  • @danrius98
    @danrius98 2 หลายเดือนก่อน +1

    I encountered bugs because of pure functions so I had my suspicions, but you explained it well and now I have a better understanding, thank you!

    • @LeafBranchGames
      @LeafBranchGames  2 หลายเดือนก่อน

      That is exxcellent to hear!

  • @emirisik
    @emirisik 6 หลายเดือนก่อน +8

    I rarely say this - if you're new to the channel, subscribe for sure. There are so many valuable lessons you can take from Leaf's channel!

  • @rky115
    @rky115 6 หลายเดือนก่อน +3

    Im pretty new to UE. "studied" the last couple of weeks a ton of informations/tutorials. I love the way you explain stuff. Love the way you do all these examples to clarify it. Keep up the good work sir.

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน

      Thank you very much, appreciate it!

  • @fencingprincess6537
    @fencingprincess6537 6 หลายเดือนก่อน +5

    Thank you so much for taking the time to explain *why* things happen the way they do. This video cleared up some issues that I’d been having and seeing the examples helped a lot.

  • @vladimirkhadyko8304
    @vladimirkhadyko8304 5 หลายเดือนก่อน +2

    I felt a cold sweat running down my back after the timeline example:) Now I understand why timings were off in some cases...Thank you a lot!

    • @LeafBranchGames
      @LeafBranchGames  5 หลายเดือนก่อน +1

      Glad to hear it was informative. :)

  • @ntjahero
    @ntjahero 6 หลายเดือนก่อน +2

    Great video, and really good examples you have there. I almost filled my swear jar until I figured why my random calls don’t match as expected :)

  • @ate800
    @ate800 16 วันที่ผ่านมา +1

    Hello great video! At 12:30 you said Get Controller Pawn>Get Actor Location Node will change the vector value that's returned to the Lerp node because the actual character is moving and the Get Actor Location node is being called repeatedly everytime lerp is called. So Get Actor Location keeps being called and keeps getting the new location that the character has moved to. Pure functions get called when their output pin values are required. So as you said we don't need vector values of where the actor is at but just the original vector location. This is right? I think I get it XD! Thanks that last part took me an extra 10 mins lol :C

    • @LeafBranchGames
      @LeafBranchGames  16 วันที่ผ่านมา

      Sometimes things fall into place a bit slower, but they keep to be remembered more in the future when we use it. :)

  • @matka5130
    @matka5130 6 หลายเดือนก่อน +1

    Great, as always

  • @Agachack
    @Agachack 6 หลายเดือนก่อน +1

    Very interresting! I knew the random function, if you do not save the result, gives different numbers each time it is attached to a node, but I did not know if was the case for ALL and BECAUSE of the pure functions! Thanks.

  • @MIKELENZTIPS
    @MIKELENZTIPS 6 หลายเดือนก่อน +1

    Excellent content - 🙌

  • @primordial987
    @primordial987 6 หลายเดือนก่อน

    Pure, if u don't need cache i think.
    For example, random array elem node and shuffle array which not pure.

  • @gokuvinod2850
    @gokuvinod2850 6 หลายเดือนก่อน +4

    i did understand most of the things i'll make sure to check this thanks again sir

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน +1

      The most important thing is to be aware of that they can cause issues in your code if used carelessly. :)

    • @gokuvinod2850
      @gokuvinod2850 6 หลายเดือนก่อน

      @@LeafBranchGames yes I'll make sure it's right

  • @shubhamgangwar4165
    @shubhamgangwar4165 6 หลายเดือนก่อน +1

    Changed my view towards pure function 😅

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน +1

      More knowledge allows for better decisions. :)

  • @paveldinh1127
    @paveldinh1127 6 หลายเดือนก่อน

    Nice and straight forward explanation. Just one minor detail I'm wondering about Random func. Wouldn't it be simpler just to cache the class with the index into vars and pass it to the next function instead of having index/class to get the other var through get or find ? 9:19

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน +1

      Caching the information will lead to the same error since random is pure.

  • @MCA-GK
    @MCA-GK 6 หลายเดือนก่อน +1

    Oh 😱 man i was having this problems when learning blueprints but my code was strong and i was nowing this issue in blueprint of this type of logics but don't know how they works😊 and you opened my 🧠 like a 😲

  • @PixelsLaboratory
    @PixelsLaboratory 6 หลายเดือนก่อน +1

    Although I knew this all along about user-made functions, what you did at 05:30 completely blew me away, I could not understand why that was happening for a few minutes, until I realized that the comparison "node" is actually a pure function in itself, right?! Is my understanding correct? Now I'm wondering how many such standard BP math nodes behave like Pure functions. I'm already scared at what bugs I might be having now that I'm looking back at all the times I did something like this without knowing that ALL nodes without an Execution In/Out pin are actually Pure functions, not just user-made functions. Btw, at 11:00 I guess that's what you meant by a new "node", not any node, but one with an Exec line, right?

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน +3

      You are correct. Many nodes are in fact pure functions. So the behavior happens much more often than one might first expect.

  • @michaelgroler1336
    @michaelgroler1336 6 หลายเดือนก่อน

    Thank you! I got a question about a minor detail probably. When using random, getting the index first and then accessing the object via "get" should be faster than object first and "find"? I am not sure how "find" is implemented but probably best case scenario is O(log n) vs O(1) for "get"?

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน +1

      I am unsure, I have not looked under the hood to see the scalability of the search algorithm that is being used.
      But as a general expectation I believe it would be considerably faster to reach a value from an array using an index rather than making a comparison of the class/object/whatever you have in the array.

  • @alexey3203
    @alexey3203 6 หลายเดือนก่อน

    Thank you for the explanation. But is missing the advantages of pure functions or the examles where they can be used

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน

      It is mentioned in the video when applicable.