Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Getting FPS in .net?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Krisc
Knave

69 Posts

Posted - Nov 16 2004 :  12:42:41 PM  Show Profile  Visit Krisc's Homepage  Send Krisc an AOL message  Click to see Krisc's MSN Messenger address  Reply with Quote
Hey I am currently writing my game in .net...although I am using C# I do know VB...anyways, I was wondering how to get the current FPS...? (I have forgotten the algorithm...)

Thanks!



p.s. this is like my 20th time trying to finish this game and i finally drew out everything on a big poster-board and set a schedule with weekly checkpoints (roughly) that i have to make. it is keeping me interested so far and i haven't gotten confused. i'm ahead of schedule a little bit but whatever...

Eric Coleman
Gladiator

USA
811 Posts

Posted - Nov 16 2004 :  12:54:24 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Calculating the frames per second shouldn't be that difficult to figure out.

How do you think it should be calculated?

Go to Top of Page

Brykovian
Bryk the Cheese Slayer!

USA
58 Posts

Posted - Nov 16 2004 :  1:06:54 PM  Show Profile  Visit Brykovian's Homepage  Click to see Brykovian's MSN Messenger address  Reply with Quote
I had an physics prof back in my college days that liked to go on a soap-boxy rant every once in a while -- usually intending it as entertainment for his students. One time he went off on a student who was having problems figuring out how to work out the calculation for something. He went off on this long series of things like "I wonder how you figure out meters-per-second ... hmmm ... let's see, I know how many miles the thing went ... and I know how long it took to get there ... but I just can't seem to put it all together."

Sorry ... but Krisc's question gave me the old flash-back ...

So, we have FPS, which stands for frames-per-second ... if only I knew how many frames I was able to generate, over a known amount of time ... hmmmm ...

Or, in language-neutral terms ...
1> Count frames (FrameCount) for a specified period of time (T)
2> Do the math: FrameCount / T
3> Don't forget to reset your FrameCount to 0 for the next counting cycle

-Bryk

www.mwgames.com
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Nov 16 2004 :  2:56:18 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
I had a college professor that taught us how to do what he called "Fermi" problems, named after Enrico Fermi. I remember on one test he gave us the population of the state and asked how many dentists there are in the state. It pretty much amounts to dimensional analysis, which is the point of the problems.
Go to Top of Page

sdw
Warrior

USA
160 Posts

Posted - Nov 16 2004 :  3:16:12 PM  Show Profile  Visit sdw's Homepage  Click to see sdw's MSN Messenger address  Reply with Quote
Even though Eric wants you to figure it out on your own and Bryk told you how to do it in language neautral terms, I'm going to tell you in Esdeedoublian which is my own language:

Three static or global variables:

  • FPS 'Holds the number of frames counted since the last second

  • LastTime 'Holds the time when we last started the count

  • Count 'Holds the number of frames we've gone through since the last second



Next is the function we call each frame
  
Sub CountFPS()  
  If CurrentTime() - LastTime >= 1000 Then 'Has it been 1 second since we last counted?  
    FPS = Count  'Store the number of frames counted in the last second  
    Count = 1  'Reset the count.  This can be 0 or 1, depending one where in your game loop it's called.  
    LastTime = CurrentTime()  'Use this to determine when 1000 ms (1 second) has passed (like above)  
  Else 'It hasn't been 1 second yet, continue counting  
    Count = Count + 1 'Since this function is called each frame, this is increased by 1 each frame  
  End If
End Sub
  

Looking back now that actually looks like VB, not Esdeedoublian :\
Go to Top of Page

Lachlan87
Moderator

USA
160 Posts

Posted - Nov 16 2004 :  3:33:40 PM  Show Profile  Reply with Quote
You cheater! I wanted to learn some Esdeedoublian!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.