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.

Newcomers DBPro Corner / Limiting the FPS

Author
Message
HartGames
18
Years of Service
User Offline
Joined: 17th Nov 2005
Location: UK
Posted: 2nd May 2007 19:32
I've been experiencing some problems with my game, it runs fine on my computer but is very slow on others.

I found out that my computer runs it at 357 fps and on my dad's it runs 37.

Is there a way to set the maximum fps?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd May 2007 19:54
You can use Sync Rate X where X is the frame rate you want, but it's only a quick fix and isn't by any means accurate.

The better method is to use a timer and call procedures/functions and screen updates every so many milliseconds - rather than leaving it to the computer the program is run on to do it at it's own rate.

TDK_Man

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 2nd May 2007 20:00
TDK Im not positive but in my experience, altering visual effect values based on the sync rate, rather than calling commands every x amount of seconds, is a better method. It makes for a smoother effect. Eg; if your goal sync rate is 100, and the current sync rate is 50, and your player moves at 1 unit every loop, you'd now move it at 2 units (move speed * (goal rate / sync rate).

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd May 2007 20:05
I didn't think he wanted a specific fixed frame rate - just for his program to run at the same speed on all machines. Could be wrong though.

But your suggestion sounds better anyway...

TDK_Man

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 2nd May 2007 20:12
It depends, if you've got a tonne of effects going on like physics, object movement, animations, etc, it can get hard to remember to apply the delta calculation to every single effect, whereas just calling the effects every x seconds would only require a single if statement.

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 3rd May 2007 00:16
Quote: "I didn't think he wanted a specific fixed frame rate - just for his program to run at the same speed on all machines."

Calling functions based on the amount of time elapsed won't work if the computer can't keep up, thus adjusting the values of things based on time elapsed is a better solution.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 3rd May 2007 05:26
@ HartGames

Make sure you get your Dad a new computer (or maybe a top-notch graphics card) for Father's Day.

LB

Login to post a reply

Server time is: 2024-09-25 21:22:33
Your offset time is: 2024-09-25 21:22:33