With variable_dt
turned off the engine will set the GL swap interval to 60 / update_frequency
(OpenGL set swap interval) and will only call script update()
at each display refresh, with dt set to 1/update_frequency
With variable_dt
turned on the engine does not care about vsync at all (vsync can be enabled/disabled in GPU drivers settings which we have no way of controlling) and will just update as fast as possible (calling script update()
each time) with dt being calculated using platform timing functions . This might result in screen tearing (screen tearing) and big variations in dt if for example a fast frame is followed by a frame doing lots of heavy computations.
Defold does not have any decoupling between an engine update and calling script update()
and we don’t skip frames to compensate for mismatching refresh rates, we rely entirely on hardware vsync (e.g. the combination of the set swap interval and the driver vsync-settings). A caveat; you can use set_vsync message to achieve software vsync in defold.
Perhaps the documentation around this should be improved. Questions about, variable_dt and vsync etc. pop up every now and then here on the forums. I’ll make a note of it!
Correct me if I’m wrong or missed anything @sven @Mathias_Westerdahl @Andreas_Tadic.