Skip to main content
gamedev.net
🔒 Locked

Why need Timer?

Started by gamedream Jun 24, 2004 at 8:12 PM 8 replies 1.4k views
Original Post
gamedream
gamedream
As I saw many game demo, like microsoft or other resource. The program always have a XXXfps(Using Timer). What is the function of using timer? In the program, where do I need to place the timer?
lonesock
lonesock
I like to have "frames per second" information to see how various optimizations or algorithyms speed up or slow down my code. I grab timing info every frame that is drawn, then do some nifty averaging to smooth out the information.

There are a whole bunch of articles here on GameDev, like:
http://www.gamedev.net/reference/articles/article753.asp
Promit
Promit
I think he wants "how", not "why".

The easiest way on UNIX is gettimeofday(). If you're on Windows, the easiest way is GetTickCount(). There are more advanced functions, but this is a decent place to start.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
matvievski
matvievski
You must know that timer is used not only for counting FPS. It will be able to do you rendering independent from frame rate. I just want to say: refer you rendering not to frame rate but to system timer. Look through the Microsoft's samples from DX SDK.
matvievski
matvievski
I'm from Ukraine - I don't know english well, sorry. And what means your 'what?'
NLDEV
NLDEV
Quote:
Original post by Anonymous Poster
Quote:
Original post by matvievski
You must know that timer is used not only for counting FPS. It will be able to do you rendering independent from frame rate. I just want to say: refer you rendering not to frame rate but to system timer. Look through the Microsoft's samples from DX SDK.

What?


I think what matvievski is trying to say is that one can make frame-rate independent motion (etc.) by using a timer.
risko
risko
The function of timer is very simple. On faster computer the framerate is higher than on slower one. Try imagine a 3D person in 3D game. On slower computer it will move too slow but on fast computer it will move too fast. If you use timer, person will move exactly so fast on every computer.
Answer: You should use timer on any place where you need to have program exactly so fast on every computer.
alnite
alnite
In summary, timers are used for the following reasons:

  • Counting frames per second.
  • Animation.
  • Profiling.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.