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 / Better FPS counter

Author
Message
spike 132000
17
Years of Service
User Offline
Joined: 7th Nov 2007
Location: Nottingham, UK
Posted: 22nd Jan 2014 13:48 Edited at: 22nd Jan 2014 13:50
Hello all, it's been a while but i've recently decided to purchase DBPro

I was wandering, is there a better fps counter or fucntion around that can update the current FPS every frame instead of every second (like screen fps()), I am making a rhythm game but because of the FPS only updating once a second, it's difficult to get the sync up with the frame rate as accurate as possible, I feel this can be done using milliseconds somehow, but wanted to find out if there was already an existing function.

Thanks for your help!

Richard

http://feedit.me - Live feed platform, useful for events and shows!
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 22nd Jan 2014 15:36
I don't think there's another function in DBP.. possibly in some 3rd user plugin.

You could of course just do something like this:



(The basic formular being 1000/timedif_in_ms)

Or maybe something a little more advanced keeping track of the frame count during the last second at each point in time (as opposed to just once a second, as the DBP function does). Depending on what you really need for your game.

Rudolpho
19
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 22nd Jan 2014 18:44
Taking the average FPS over a longer span of time (such as a second) will give you a more reliable number since (unless it is locked to a certain sync rate) it will fluctuate quite wildly under normal circumstances. Also you can measure greater framerates than 1000 Hz in that way - you can still do this by using the perftimer function however.


"Why do programmers get Halloween and Christmas mixed up?"
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 22nd Jan 2014 18:56 Edited at: 22nd Jan 2014 19:05
Quote: "update the current FPS every frame instead of every second"

update the current Frames Per Second every frame instead of every second *flat nonsense*

I believe you want a better FPS counter that would show you a greater FPS value? *joking*

Quote: "I feel this can be done using milliseconds somehow, but wanted to find out if there was already an existing function. "

By Fallout:

You can use it with any sync rate to get something done twice per cycle or once per two cycles etc.

Login to post a reply

Server time is: 2025-05-15 23:13:52
Your offset time is: 2025-05-15 23:13:52