Announcement

Collapse
No announcement yet.

Pure node evaluation

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

    [LEARNING RESOURCES] Pure node evaluation

    In the documentation (https://docs.unrealengine.com/en-US/...#purevs.impure) it states the following: "This means that a Pure Function will be called one time for each node it is connected to". However, according to my tests, it's not how it works. Given the following example:

    Click image for larger version

Name:	example.png
Views:	71
Size:	38.9 KB
ID:	1780761

    `GetExpensiveValue` is only run once. It might have been worked once as it's stated in the docs, but at least in 4.22+ it does not seem to be the case.
    Game Programmer at Zen Studios and founder of Rapax Softworks
    LinkedIn, Engine Contributions, Marketplace
    Polars (WIP), Game Jam Projects

    #2
    E.g. with the "RandomInRange"-nodes this is unfortunately true and caused some hard to find bugs in my project. Do they mean with "node" the nodes with a white pin?

    Comment


      #3
      Originally posted by KristofMorva View Post
      `GetExpensiveValue` is only run once. It might have been worked once as it's stated in the docs, but at least in 4.22+ it does not seem to be the case.
      The long running joke with Pure nodes, is that they're not very PURE at all.
      In that they'll happily reevaluate once again for every connected wire... But.....

      Are you saying GetExpensiveValue is now evaluating consistently in 4.22?
      Same as if it was just called once or same as if it was assigned to a variable...

      If so, maybe Epic reworked this after feedback. As it was filled with gotchas!
      Whereas, you want a different unique value passed to Multiply / Addition etc?
      (Either way, don't trust the unloved docs - opt for empirical testing or nothing)...
      Last edited by EntrpriseCustomr; 06-25-2020, 07:50 PM.

      Comment


        #4
        Originally posted by ThiloN1987 View Post
        E.g. with the "RandomInRange"-nodes this is unfortunately true and caused some hard to find bugs in my project. Do they mean with "node" the nodes with a white pin?
        That's what I thought but I think both types are called "nodes". Maybe it says it correctly, just needs a different wording to be clear.

        Originally posted by EntrpriseCustomr View Post
        Are you saying GetExpensiveValue is now evaluating consistently in 4.22?
        Same as if it was just called once or same as if it was assigned to a variable...
        My memory might trick me, but if I remember right, around the 4.19 era it worked as stated, nodes were evaluated 2 times for the example. Now they are only evaluated one time. (Which makes a huge difference, and as ThiloN1987 mentioned, can lead to very hard to find bugs.)

        Originally posted by EntrpriseCustomr View Post
        Whereas, you want a different unique value passed to Multiply / Addition etc?
        (Either way, don't trust the unloved docs - opt for empirical testing or nothing)...
        I don't mind how it works as long as it's known - personally, I'd prefer no docs compared to a misleading one. I generally got to this issue after I wrote a blog post about it (https://medium.com/advanced-blueprin...s-516367cff14f), and in one of the comments they wrote that I stated it wrong, because the official docs says otherwise. I followed up on it, and now I believe the documentation might be the wrong (or misleading) one here.
        Last edited by KristofMorva; 06-26-2020, 02:37 PM.
        Game Programmer at Zen Studios and founder of Rapax Softworks
        LinkedIn, Engine Contributions, Marketplace
        Polars (WIP), Game Jam Projects

        Comment


        • echo_four commented
          Editing a comment
          Hey KristofMorva! Thanks for digging into this and passing along your feedback. I've made a ticket to take a deeper look, and pinged a colleague who's a bit more versed in the realm of blueprints. We'll take a look and see what we can do to make things clearer/more accurate. I'll ping you with an update once I know more!

        #5
        KristofMorva

        Epic hired someone a few months ago: a contractor (so its not clear if this is just a temporary thing).
        But they're the only one responding to docs issues on the forums right now. So maybe they can help....

        echo_four

        Comment

        Working...
        X