Download

Delay Node per tick

Hi,

Within an actor’s blueprint, you can define a delay node. If I link a Event Tick to Delay node what is the timing? Delay node is specified in ms whist tick is per tick.

So if I set it as 0.5 ms delay, is it:
a) 0.5 ms of the current tick unless the current tick is shorter than 0.5 ms, then it carries over the remaining delay over to the next tick
b) 0.5 ms of every incoming tick (kind of doesn’t make sense this way since it might cause an infinite delay if tick < delay)
c) Something else.

Is the delay clock running async to tick so that it can continue counting after the current tick is over? If I include this delay inside a While loop, will it delay the current tick until While is satisfied? Or will it continue to tick with each tick going over the While loop?

I ask this because I have it implemented in a current project and it is working but I don’t quite understand the mechanics of why.
I impart a Z impulse to an actor and do a while loop whist the actor’s Z velocity > 0 (essentially catching the actor at the height of the imparted impulse). The while loop contains a delay of 0.1 ms to prevent a loop error. It works just fine but I don’t understand how the delay is ms within a while loop is running from a per tick node if delay is in ms and tick is per tick unless there was some async processing occurring.

If you set a delay after an event tick then you are effectively setting the tick function to run every delayAmountOfTime.

eg. put a print string(“tick”) after a delay of 1s after the event tick. You’ll notice that tick is printed every 1s or in other words, the tick function is run every second.

You basically can’t use delay with tick or loops, because it has no effect.

Tick is called every frame, in fact this:

justtick.JPG

and this:

will effectively do the same thing.

Same with a loop, because the loop doesn’t wait until the Loop pin has finished before calling the next iteration, it just goes piling in and all the delays have no effect.

If you want to move an actor in Z, the two most common ways would be timeline:

Or, if you really like tick:

The tick version might look simpler, but there are often hidden pitfalls assocated with tick. Two here being:

  1. You have no way of specifying speed or endpoint ( unless you add more code, and then it’s not so simple anymore ).

  2. It will run at different speed on different machines, and you have to cope with that.

Tick == time it takes to process, simulate, and render a frame.
e.g. client frame rate is 60FPS … client tick interval (time) is 16.667ms per frame/tick. 120FPS = 8.33ms tick interval

client frame rates (FPS) fluctuate, thus tick delta fluctuates.

As KeyC0de mentions … Adding a delay to a tick event will increase the tick time, thus the frame time (lower FPS).

**ClockworkOcean **notes that delays in loops are ignored and provides work arounds. Another option if you really need a delay in a loop is to create a macro loop with delay.

Blueprint Macro Library (Actor)