Hi,
Apologies for resurrecting such an old thread --
I'm back from a long summer vacation and just
catching up with my unread forum posts.
Anyway, I have a few notes to make about these
frame rate and vsync issues in AGK.
Basically, you'll find answers to all of the
questions posted on this thread, just by searching
the forum (and doing some investigative reading).
Below is a summary of my findings, with only the
significant parts of the result threads quoted.
THREAD:
http://forum.thegamecreators.com/?m=forum_view&t=204786&b=41&msg=2448870#m2448870
Paul Johnston wrote 15th Apr 2013 18:50:
Quote: " We use a new method of frame rate limiting on Windows Vista
and above that uses what's called the Desktop Window Manager to
sync the refresh rate to the screen. Using SetSyncRate(60,0) or
SetVSyncOn(1) turns this on so if you wanted to force it off
you could use SetSyncRate(59,0)
"
Ian Rees wrote 15th Apr 2013 19:09:
Quote: " Great - that has sorted it. Is there a downside to using that
though? Should you check if the FPS drops down to say 40 on
Windows and then call that command?
"
Paul Johnston wrote 15th Apr 2013 20:13:
Quote: " Only downside may be some screen tearing when VSync is forced
off, if the screen is only refreshing at 30 fps you might want
to keep that and use timer based movement where possible.
"
THREAD:
http://forum.thegamecreators.com/?m=forum_view&t=202929&b=41&msg=2434895#m2434895
Paul Johnston wrote 14th Feb 2013 19:48:
Quote: " SetSyncRate and SetVSync are mutually exclusive, they will
overwrite the settings of the other. The following applies to
108 and beyond."
"Using SetSyncRate with a value of a value other than 60 will
turn VSync off and use your chosen value, using a value of 60
will turn VSync on as it should be a smoother method of
achieving 60 fps."
"Using SetVSync with a value of 1 will let the system handle
the frame rate (usually 60fps) and set a manual sync rate of
70 as a backup, just in case the system does not support
VSync.
"
THREAD:
http://forum.thegamecreators.com/?m=forum_view&t=204374&b=41&msg=2443259#m2443259
Paul Johnston wrote 23rd Mar 2013 23:37:
Quote: " SetSyncRate(60,0) is now a special case on Windows that
attempts to use VSync instead of the normal AppGameKit timing as this
results in a smoother experience, but I don't know why it would
be using up CPU. A quick test on Windows 7 has low CPU usage
with SetSyncRate(60,0).
"
The above are some pretty useful tidbits of information.
Nz0 wrote:
Quote: " Be even better if I can work out a way to reliably detect
which mode to use.
"
Agreed. We need some way to get information about the currently
selected vsync mode; eg. does the hardware support vsync, is
vsync handled by the DWM or not, are we in 70Mhz fallback mode
or using explicit frame rate, and is vsync currently ON or OFF.
Cheers,
AgentSam