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.

DarkBASIC Professional Discussion / SYNC RATE command

Author
Message
Jeffrey Morris
21
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 2nd Jul 2010 23:13
I thought that the SYNC RATE command forces a Dark BASIC Pro program to run at a specified frame rate. I created a part of Manhattan, New York. Without the SYNC RATE command, the frame rate increases as I drive a car from south end to north end and the car "speeds up". With SYNC RATE command, the frame rate stayed at the specified frame rate but as I'm near the north end of the city, the frame rate increases a bit. Any suggestions?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Jul 2010 23:17 Edited at: 2nd Jul 2010 23:20
Sync rate only slows the frame rate down when it gets too fast it doesn't speed it up.

I don't see how this is possible...?

EDIT: Unless it already is slowing it down and can only achieve the specified frame rate at that point...

Try using:


...to check whether you are achieving the frame rate you are expecting.

Jeffrey Morris
21
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 3rd Jul 2010 01:18
Using the code snippet, the FPS is 60 until the north end of Central Park and the FPS went up to 100. I modeled the part of Manhattan from 14th Street to 125th Street. I used simple boxes for buildings for now.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Jul 2010 01:56
What value were you using in the sync rate command?
Jeffrey Morris
21
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 4th Jul 2010 03:54
SYNC RATE 60

What about this command?

SET DISPLAY MODE Width, Height, Depth, VSyncOn
Dia
21
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 4th Jul 2010 06:12 Edited at: 4th Jul 2010 06:13
check out the help files!




This is not the Sig you are looking for....
Jeffrey Morris
21
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 4th Jul 2010 12:58
I tried "SET DISPLAY MODE Width, Height, Depth, VSyncOn" command and it gave me 59-60 FPS all the way from one end to other.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 4th Jul 2010 20:53
Now you need Timer Based Movement.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Jul 2010 13:37
Quote: "SYNC RATE 60"

If this is true your fps would never go over 60. Sync Rate caps it at 60. It might go way below that depending on how complex your loop is but if your machine is capable of running your loop faster than 60fps and you are using sync rate it will never get to 100fps...

Did you use "sync on" as well as "sync rate"? I haven't tried it but if you don't turn sync on maybe sync rate doesn't work...

Glad you found a solution though!

Quote: "Now you need Timer Based Movement"

@KISTech is the man to ask regarding TBM!! Didn't you write a thesis on it KIS? Or was it just the longest thread I ever read right through?

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 5th Jul 2010 21:58
Quote: "Or was it just the longest thread I ever read right through?"


Hmm. You must have missed the other 3 threads.

@Jeffrey, Timer based movement is what you will need to make sure your objects move at the same rate, no matter what the actual framerate is.

Alfa x
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 9th Jul 2010 18:23
on timer based movement there wansnt a command that access the processor clock and makes a correction?.
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 9th Jul 2010 18:47
Generally you should set the sync rate to zero, enable vsync, and use timer-based movement.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 12th Jul 2010 19:32
@baxslash,
Quote: "If this is true your fps would never go over 60. Sync Rate caps it at 60."

That's not entirely true. The FPS is calculated by using the time between frames. If you set your sync rate to 60 either by manually setting it or letting it default by vsync on, you will have some frames that are slower and some that are faster than 60. The number is an average. To get a true FPS you have to do the math yourself.



This will give you more accurate frame rate. Since the timer is in milliseconds, if your program took 1000 ms to do a cycle, you would get 1.0 fps. If your program took 16.66ms to do a cycle, it would give you 60.024.....fps.

This will also update each frame.

The fastest code is the code never written.

Login to post a reply

Server time is: 2026-07-25 03:25:31
Your offset time is: 2026-07-25 03:25:31