This function can be used to set the timing method to be used for rendering your game. The method can be one of the following constants:

Constant Description
tm_sleep Use the sleep margin value as the main timing method
tm_countvsyncs Use vsync timing as the main timing method (default for all supported platforms)

The vsync timing method uses the target platforms support for vertical synchronisation to provide an anchor for the games render timing calculations, while setting the mode to sleep margin will just try to ensure that each frame lasts for the correct amount of time (say 1/30th or 1/60th of a second) by waiting or sleeping. In general the default vsync timing will give the smoothest results, but note that when using the vsync method, the sleep margin values are still relevant, although it will have a reduced impact and we recommend keeping it at its default value when using this method.

By default on all platforms except PS4, Ubuntu and HTML5, GameMaker Studio 2 will use the vsync timing method, while on the unsupported platforms, only sleep margin timing can be used.

If you wish to set the sleep margin you can do so using the function display_set_sleep_margin() and you can find which timing method is currently being used with the function display_get_timing_method().



Argument Description
method The timing method to use (see the list of constants, above)




if display_get_timing_method() != tm_sleep
if display_get_sleep_margin() != 20

The above code will check the timing method and then if it's not set to tm_sleep it will be set to that and the sleep argin set to 20.