Thread: Beta 11h
View Single Post
Old 05-22-2010, 10:47 PM   #3
Jim Sachs
Developer
 
Jim Sachs's Avatar
 
Join Date: Dec 2000

Location: Southern Oregon
Posts: 9,780
Yes, the variability of the frame rate illustrates my problem in trying to limit it. The way that the frame rate is controlled is by calling the Sleep() function with the number of milliseconds you would like to wait. There are two problems associated with this. First, the function only takes whole numbers. Sleep(20) might give a frame rate of 105, and Sleep(21) might give a framerate of 90. So, if you have set the Framerate Limit to 100, the system will be constantly switching between 20 and 21. (These numbers are just made up, and don't represent an actual machine.)

This first problem is the main reason why I was hesitant to restore the Limit Frame Rate feature, and had let the user control Sleep directly.

The second problem is that Sleep() gives up the remainder of that time-slice, and allows the next program in the multitasking queue to run. There's no guarantee when I'll get control back, if ever. This makes it very difficult to maintain a steady FPS.
Jim Sachs
Creator of SereneScreen Aquarium

Last edited by Jim Sachs; 05-23-2010 at 01:26 AM.
Jim Sachs is offline   Reply With Quote