Kamujin's picture

[GameWindow] Make main loop interchangeable

Project:The Open Toolkit library
Category:bug report

The following attachments support the proposed interleaved scheduler as described in the forums.

The scheduler uses an interleaved pattern of sleep times to approximate sleep durations of greater precision then is support by the operating system.

The scheduler uses an adaptive logic to continuously tune the sleep interval pattern to match the target render frame rate and update frame rate.

Fiddler, do you want me to improve upon this to include things like Update/Render interval smoothing? bounding?
I've been trying to keep it simple so as not to over reach.

Although I do use this already internally, there are enhancements that I add to make it more consistent. As it stands, this scheduler assumes the consumer will do some pre-processing with the elapsed times to clean them up.

GameWindow.patch3.81 KB
InterleavedScheduler.cs8.1 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


Title:Proposed run loop scheduler» [GameWindow] Make main loop interchangeable
Version:all versions» 0.9.9-0
Category:feature request» bug report

It should be possible to create a custom game loop by overriding GameWindow.Run().

the Fiddler's picture


Version:0.9.9-0» 0.9.x-dev
Status:in progress» fixed

The game loop is now completely optional. You can inherit from NativeWindow to provide a completely custom game loop, or inherit from GameWindow and override the Run() method.

the Fiddler's picture


Version:0.9.x-dev» 1.0-beta-1
Status:fixed» closed

Closing issues fixed in 1.0 beta-1.