Higher than 60 update rate

Is there a technical reason why higher than 60 is not allowed?

Not sure. @Andreas_Tadic?

1 Like

We currently rely on OpenGL to set the frame rate by setting the interval to “each frame” which we assume is 60 Hz. The OpenGL API for that tells how often OpenGL should make a switch from back to front;
1 = every vblank = 60 Hz
2 = every other vblank = 60/2 = 30 Hz
3 = every third vblank = 60/3 = 20 Hz

And so on…

To support higher frame rates we need to do some work on the engine side.

2 Likes

We also have an experimental jobs API in a branch and I think that runs on a separate thread, or at least decoupled from the normal update loop. I wonder if that system could be of help here? @sven knows more.

1 Like

I’m OOO until Thursday and isn’t able to check this for you right now, but check the documentation for the system message set_vsync, which has the option swap_interval which you can set to 0 to disable the swap interval.
Then, with variable_dt setting in game.project enabled it will (should) make the update run att max frequency. With variable_dt disabled, it should target the update frequency set in game.project

Hope this helps, let me know how that works out for you.
As a side-note, you also got the message set_update_frequency which allows you to change the setting in run-time as opposed to a global, static setting.

1 Like

I tested

msg.post("@system:", "set_vsync", { swap_interval = 0 } )

With varible dt enabled
And this is the sample output for print dt * 1000

So some frames are still 16.66666 ms?

If I set update rate to 30 it doubles the longer frames

I guess it’s still waiting for the next frame to be ready based on update frequency?

OpenGL glSwapBuffers will block if the command queue is full / driver (though this is driver dependent) which could explain this. It’s clearly not waiting for the frame (correct), but then gets blocked next for some other reason (glSwapBuffer blocking?).
We will need to investigate further into this. Decoupled rendering itself would of course solve this, but that is not anything that will be available shortly.

2 Likes

It could also be that vsync is force-enabled by the gpu driver settings on your system. If that is the case, setting Defolds’s swap interval to 0 will not have any effect.

2 Likes

Yes, to emphasise what I mean by driver dependent. Some drivers have this as an option in the control panel, some simply force-enables it in which case it’s not user controllable.

2 Likes