1. #1

    Question Regarding Math Operation Chain's Updating

    While working on my map Ducky Dojo I ran into some lag issues while doing extensive "Copying". By "Copying" I mean I was using Set Values to copy the result of a Math operation chain to a temporary "Hold" Variable Data Source, in order to update the Ducky AI only when needed. In hindsight, I see ways I could of made it better, but I also think some of my issues came from performing these "Copy" operations when I really didn't need too, and so it cost me CPU performance. I set up two examples in this Google Doc demonstrating the two methods I used for updating. If anyone thinks they knows which way is better, feel free too post below!

    Link --> https://docs.google.com/drawings/d/1...it?usp=sharing

    Edit: My true concern is when exactly do Math operation chains update, when it is called by a Set Value, or when the input values to the chain update? Also, if the Math chain is updating when input changes, does that mean that the chain in the example updates twice, once when "Holdx" is updated, and once when "Holdy" is updated?

    Share this post

  2. #2
    mutetus's Avatar Trials Developer
    Join Date
    Dec 2013
    Location
    The land of fin.
    Posts
    859
    Definitely it should be updated so that you sample the source values for the operations when needed, especially when the data is constantly changing value such as object position.
    Share this post

  3. #3

    Okay, thanks a bunch Mutetus! I appreciate it

    Also, with that example, since the two "Hold" data Sources are updated by two separate Set Value Events, does that mean the Math operation chain is recalculated twice, once for each update? If this is true, can I get around it by using a single two-size vector?
    Share this post

  4. #4
    mutetus's Avatar Trials Developer
    Join Date
    Dec 2013
    Location
    The land of fin.
    Posts
    859
    Well yes in this example it doesn't help since the updates are for the same chain. Also when changing value in one data source all the other chains will be recalculated as well if one of their values change later, so the efficiency of the optimizations have to be carefully weighed, i.e. there's not much advantage if the calculations are done just once every tick. The best practical use for this is leaving large vectors without any operators and get vectors connected straight to them and copying required chunks in and out when needed. Interpolated data sources require constant updates too, so they're best left without complex operations connections as well or use custom interpolations.
    Share this post

  5. #5
    Okay, thanks Mutetus! I think I get it now, time to go apply this knowledge.
    Share this post

  6. #6
    Just_Shogun's Avatar Community Developer
    Join Date
    Jan 2010
    Location
    Helsinki
    Posts
    665
    Share this post

  7. #7
    Just_Shogun's Avatar Community Developer
    Join Date
    Jan 2010
    Location
    Helsinki
    Posts
    665
    Share this post

  8. #8
    I tried to find a gif to respond to that Shogun, but I'm too lazy to look for one. So I'll make this for you instead....

    ░░░░░░░░░░░░░░
    ░░█████░█████░
    ░░░█▒░░░░█▒░░░
    ░█░░░░░░░░░░░░
    ░▒████████░░░░
    ░░░░░░░░░░░░░░


    Mwahahahahahahahahaha
    Share this post

  9. #9
    BlueBadger400's Avatar Trials Community Specialist
    Join Date
    Nov 2013
    Location
    Winland
    Posts
    592
    Share this post

  10. #10
    mutetus's Avatar Trials Developer
    Join Date
    Dec 2013
    Location
    The land of fin.
    Posts
    859
    Share this post