Is there a minimum value for Delay?

Is there a minimum value for Delay?

I created a custom loop (using a Branch node) where the last node is a Delay. In my loop, I increment a float by 1. I set the float to show on the screen, so I can check its value. I break out from the loop when the float reaches a certain value. Setting the time in the Delay node allows me to set how fast I want the number to increase.

My problem is, however, that it seems, if I enter a smaller delay value than 0.01, it doesn’t make an effect, the delay would still be 0.01 seconds.

This number seems small, but considering I can only increment the float 100 times a second this way it isn’t that small anymore.

My question is, obviously if there is a minimum value for the delay you can set and if there is, what workarounds would be possible?

Thanks

Hey Kontur,

If I remember correctly, the limitation would be on tick. Each tick the system would check the delay and fire if it has = > the given time. So 60 fps will give you 60 checks.

I’m not sure (without delving into c++) if there is an alternative through blueprints for delays specifically, unless you use timers (which would probebly have the same limitation as delays) However depending on your use case, an alternative would be to decrease/increase the number you are multiplying/adding to your float so that the that the timer would no longer be an issue and you will still see the decrease/ increase in time you are after.

Hi Prototype6143, and thank you for your answer!

Yes, I was afraid that it is related to ticks. I have already considered the solution you suggested, however that wouldn’t do what I need. I will specify my issue then and hope that someone can help me.

Basically when the Player gains let’s say 500 XP, I don’t want to simply give the amount to him, I want him to get +1 XP until all the 500 was given. I want to do this because I am displaying the amount of XP the Player has on the screen, and I want the number to go up one by one rather than just instantly add it.

My problem is that using the delay in the loop which increments the XP by 1 until reaches the amount of XP we actually want to give will only increment the number as many times as many frames you see, which is pretty slow and inefficent for adding like 5000 XP to the Player.

Any help regarding this would be appreciated.

[EDIT]

Okay, now I kinda realised that changing the XP between frames wouldn’t make a difference anyway, since the Player would still only see the value at screen refresh, achieving the same result as if we added more than 1 XP every time the loop runs.

Thanks for the help again!

I would think a simpler/less issue-prone approach would be to not restrict the rate of granting, but the rate of displaying. This way you can trust the real amount at all times but can interpolate the UI value.

This is a great idea, thank you, I will probably use this methold.

Would it be possible to ‘fake’ the effect of adding the XP one by one with some kind of animation on the numbers without actually altering the amount of XP? This question also applies to a progress bar I have, which shows the XP amount. One of the reasons I wanted to implement this add +1 XP methold was to make the progress bar load smoothly, not just skip to the next value.

If animating the XP display number and the progress bar somehow is possible, how should I approach?

Sure, interpolation methods are available with blueprints, via the various interp nodes and timelines. For example you cast to get the new XP int from wherever it is stored into your widget, then make a timeline that increments the widget’s own counter to the new int value on every update.

Awesome, I will look into it!

Thanks!