Why is my frame rate affecting speed of stamina drain? Using event tick and delta seconds

Hey all, my frame rate is drastically affecting how long I can sprint (I set up stamina and such). I thought I set it up correctly with delta seconds to keep that from happening, but I guess I don’t understand it. Here is what I have:


Stamina inside player tick:

Stamina drain function:

That is what “delta seconds” is for. You multiply your value with it , it should give you increase or decrease per second.

For eg. you want +10 units per second, in event tick you multiply that +10 by “delta seconds”,
If you call it every tick then after 1 second it should be 10 more there.
However i never tested it really.

Instead i created “pulse event” (and dispatcher), i call it every 0.2 seconds. Then everything is easier to manage, and as fps in depended as that delta seconds thing.
I did it without timers, just branch on one of my event ticks (in player controller), and i use “game time seconds”, this way that dispatcher is affected by player in game time.
Also for most gui things calling that pulse 5 times per second is fine (it is exactly on that edge where you start notice that gui updates are laggy).

Thanks! how did you create the pulse event?

A good way to do this is use a “Timer”. Get a set timer node and set it to your desired pulse rate. Initialize this when you want the timer to start (typically begin play but it varies). Then, create a custom event node with the same name as your timer and run your functionality from there. Tick is designed to be framerate dependent so it will always run at the FPS your hardware is currently utilizing. While they are more performance intensive timers are also more consistent and not framerate dependent, which makes them ideal for these situations.

Alternatively you can use Get Real Time Seconds during the tick if you’re looking for a way to have an analogue cool-down indicator.

The only thing I didnt follow was the part about naming the custom even the same as the name of your timer. How do you name a “get timer”?

There are plenty tutorials about timers…

thanks! checking them out now

Awesome. Got it working correctly. Thanks again.