Question regarding heartbeat and render stepped

image

What does it really mean if heartbeat fires after the physics simulation has completed?

image

This one is not really a question but rather clarification. Does render stepped fire every frame before the frame is even rendered? So I were to make a fps counter using delta time, am I better of using heartbeat instead of render stepped since it fires before the frame is even rendered while heartbeat fires every frame after physics simulation?

In my opinion, I would go for heartbeat since it fires after physics simulation.

What do you guys think, what would be better?

2 Likes

Yes, like it says.

Use Heartbeat since you aren’t manipulating the camera or input, though just using the parameter shouldn’t do much damage.

2 Likes

So basically both of them run at the framerate of the game, but renderstepped is ran before rendering, whereas heartbeat runs after rendering. So with this is mind, anything that involves how the game should be rendered camera, cframing, etc, that you want to call everytime the game is rendered, should be done with renderstepped. On the contrary, any thing that you want to run every frame but doesn’t involve rendering should be run with heartbeat. If what you are doing with these functions is minor then these don’t really matter all that much, but running a lot of code in renderstepped that doesn’t affect rendering can possibly cause lag. Hope this helps :).

2 Likes

.Heartbeat produces MUCH less lag then .RenderStepped

That’s true and that’s also a reason I should consider using heartbeat.

Though, render stepped will only lag if used in the wrong way.

if used in the wrong way.

Because running expensive code within callbacks bound to RenderStepped will delay frame rendering, and potentially lower FPS.

1 Like

Yes, I know that.

What would you use if you were to make an frame rate counter, RenderStepped or Heartbeat or Stepped ?

Framerate counter as in something that shows fps or that makes fps worse?

Alright, thanks for letting me know your choice on that.

Now, Stepped fires ON physics simulation. Would you choose that as a secondary option?

Anything that runs with enough speed and won’t potentially delay the rendering is good, there’s no reason to display the time every frame (unless you want, since that would be more accurate by small difference).

Here there’s no expensive operations running within so you could use either one, if you’re already running code on RenderStepped, just use the dt parameter.

1 Like