Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [possible bug]SetSyncRate and SetVSync does not work as the docs explain

Author
Message
TomToad
6
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 7th Aug 2019 09:25
There seems to be a bug with the way SetSyncRate() and SetVSync() works, or at least the documentation is wrong. This doesn't affect performance per se, but can explain why some have frame rates that don't match the monitor refresh rate and why there may be tearing with vSync on.

According to the docs, when SetVSync is set to 0, then the frame rate will match what is used for SetSyncRate. When SetVSync is set to 1, then SetSyncRate is overridden and the refresh rate matches the vertical blank of the monitor.

With 7-12-2018, it seems to work that way. If I set the sync rate to 75 and vSync to 0, the frame rate is ~75 fps. If I set the vSync to 1, then the frame rate drops to 60 (my monitor's refresh rate). If I set the sync rate to 30, then I get 30fps and 60fps respectively. However, if I set vSync to 1, then back to 0 while the program is running, it will go full speed instead of the value set in SetSyncRate. Apparently, the sync rate isn't just overridden, but completely disabled and must be reset when you set vSync from 1 to 0.

Now it seems that 6-11-2019, 8-1-2019 and studio behave differently. If I set the sync rate to 75 and vSync to 0, then it runs at 75fps. Set vSync to 1 then it goes to 60fps. However, when I go back to 0 within the program, it goes back to 75, which makes it seem that the sync rate is actually being overridden and not just disabled. A plus for later versions of AppGameKit, but the real problem comes when I set the sync rate to 30. When I set vSync to 1, the fps remains at 30! It is not being overridden. In order to match the monitor's refresh, I need to manually set the sync rate to 0. So if you have a monitor with a 75Hz refresh rate, but the app has a sync rate of 60 (which is default if no sync rate is set), then you will get tearing as the app's rate is not matching your monitor.

It seems that SetSyncRate sets the maximum fps and only is disabled when the monitor rate is lower or matches the sync rate.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Aug 2019 00:25
It looks like some related bugs have been fixed for the next version (see paul's description here: https://forum.thegamecreators.com/thread/224808?page=2#msg2647275).
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 8th Aug 2019 06:35
i think "overridden" is the keyword
Worldwide optimal state system - ISBN 9783748157748
Weltweit optimales Staatssystem - ISBN 9783748159476

Login to post a reply

Server time is: 2024-11-22 15:48:15
Your offset time is: 2024-11-22 15:48:15