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 / Question about FPS / Sync

Author
Message
technomancer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location:
Posted: 27th Jan 2015 22:34
Hi! First post, please excuse the newbie questions.

When I use SetSyncRate() and Sync(), does the game immediately stop what it's doing and draw, or does it just update the draw buffer and seperately draw frame on a timer?

For instance, if I set the game to 2FPS and called sync() 50 times a second, would I end up with a 60FPS or 2FPS game?

Additionally, are there any good examples out there of games that run on a frame-based timer instead of elapsed time? (Is that even a reasonable thing to do?)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Jan 2015 23:57 Edited at: 27th Jan 2015 23:59
if u set a frame rate its waiting if the code before was fast enough.
max. frame rate belongs also the os target.
there exist also a SetVSync command.

Quote: "Sync or Update(), Render(), Swap() to manually sync. If you wish to have more control you can break this down further and replace Render with Render2DBack, ClearDepthBuffer, Render3D, ClearDepthBuffer, Render2DFront"



time based is easy
if u want turn 90 degree in 1 second the step is 90.0 / 60.0 FPS.
see ScreenFPS & GetFrameTime

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
technomancer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location:
Posted: 28th Jan 2015 00:14
Thanks!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 28th Jan 2015 11:38
Welcome to the boards Technomancer!

If you don't need strict frame rate control, but don't want to waste CPU drawing frames too quickly, use the SetVSync(1) command. This will limit the refresh rate to that of the device screen. Good if you are using time based movement. If you're on AGKV2, I highly recommend looking at all the tweening commands. They do all the time-based movement calculations for you.

V2 T1 (Mostly)
Uzmadesign

Login to post a reply

Server time is: 2024-11-25 18:05:16
Your offset time is: 2024-11-25 18:05:16