You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we should have a global 'frame rate' enforced for iteration. At the moment a lot of issues stem from iteration running too fast e.g. see #3812
To me a MainLoop should look something like (pseudocode)
do{vardt=DateTime.Now();RunIteration();vartook=DateTime.Now()-dt
var sleepFor = TimeSpan.FromMilliseconds(200)-took;if(sleepFor>0)Task.Delay(sleepFor).Wait();}while(true)
This solves several problems including the kinda sketchy way that 'has events' somehow has to take responsibility for blocking until there are events - except when there are timers (that being a problem in itself) etc.
The iteration, drawing, event queue inspection etc should all happen as fast as possible. Then we just sleep for however long we want to enforce our frame/loop rate.
Thoughts?
See for example this thread:
Did you realized that the EventsPending method is always running overkilling the CPU usage with 13%, approximately? That why the Threading scenario it's working on Linux and Windows. It's needed to wait until it's necessary.
Via @tznind:
I think we should have a global 'frame rate' enforced for iteration. At the moment a lot of issues stem from iteration running too fast e.g. see #3812
To me a MainLoop should look something like (pseudocode)
This solves several problems including the kinda sketchy way that 'has events' somehow has to take responsibility for blocking until there are events - except when there are timers (that being a problem in itself) etc.
The iteration, drawing, event queue inspection etc should all happen as fast as possible. Then we just sleep for however long we want to enforce our frame/loop rate.
Thoughts?
See for example this thread:
#3791 (comment)
Originally posted by @tznind in #3813 (comment)
The text was updated successfully, but these errors were encountered: