playMaker

Author Topic: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate  (Read 3210 times)

Digitom

  • Junior Playmaker
  • **
  • Posts: 61
Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« on: February 06, 2020, 01:11:39 PM »
Hello,

I updated the Next Frame Advance(d?) script so it has the option for fixed or late updates. Useful if you need these options for physics-based objects or fixed movement.




Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #1 on: February 25, 2020, 08:33:25 AM »
Awesome!
Available for Playmaker work

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #2 on: February 25, 2020, 11:43:42 AM »
Hi,

 I am not sure this is needed for LateUpdate which is in sync with the Update cycle.

what is your use case for the fixedUpdate? generally you want to use FixedUpdate to apply forces, torques and move, I am not sure why you need this, I am curious actually :)

Bye,


Digitom

  • Junior Playmaker
  • **
  • Posts: 61
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #3 on: February 25, 2020, 12:18:03 PM »
Hi Jean,

I was using this to do a very specific loop where I needed to predict velocity of a transform. When I used next frame the values would spaz out but were solid when I made this fixed next frame action.

I ended up just making that GetTransformVelocity action eventually though.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #4 on: February 26, 2020, 07:46:01 AM »
Hi,

 ok, odd.

Bye,

 Jean

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #5 on: March 08, 2020, 08:05:06 AM »
This action would be absolutely boss (wink wink) if it were a hybrid of the original Send Event action, all with its sending modes glory, and the frame type plus the frame based delay functions.

Digitom

  • Junior Playmaker
  • **
  • Posts: 61
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #6 on: March 09, 2020, 10:48:28 AM »
This action would be absolutely boss (wink wink) if it were a hybrid of the original Send Event action, all with its sending modes glory, and the frame type plus the frame based delay functions.

attached ;)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #7 on: March 10, 2020, 10:04:34 AM »
Fantastic! Thanks.

What I had in mind with this action is to preload some results, like some produce that a FSM is going to generate based on some numerous operations and calculations that can create spikes in CPU/GPU usage. Instead of eating up some 120 ms of calculations for example, it's possible to spread it over 4 frames that only eat 30 ms each.

So in CPU intensive loops that involve one or more FSMs that at some point validate phases with events, controlling the delay (by remote for example, notably through a Global int var) helps spread certain processes over several frames, this ahead of the moment the final "produce" (whatever the app does that's BIG).

If the device is weak (low entry smartphone) and/or if the FPS rate drops too much, the delay can be changed from 0 to 1 in certains FSMs so as to spread calculations over several frames, either exceptionally or continuously. This provides a dynamic way to manage the density of processes during x number of frames.
This special send event action needs to be placed at several key potential bottlenecks.

This is solely for optimization.

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #8 on: April 21, 2020, 06:13:35 PM »
Thanks for sharing this Digitom, I've actually found myself needing something quite like this to match my physics interaction when having lots of stacked states instead of all on one 💪

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Next Frame Event Advance (Updated) FixedUpdate / LateUpdate
« Reply #9 on: March 15, 2021, 08:16:24 AM »
In 1.9.1p4 the actual version of the action generated a Graph View bug and logged errors.
Be careful, this part of the code might need to be commented out:

Code: [Select]
#if UNITY_EDITOR
        public override string AutoName()
        {
            return "Next Frame Event: " + sendEvent.Name;
        }
#endif