View Full Version : Mainaining same look with different speeds

05-20-2005, 10:15 AM

Could anyone point me in the direction of some reading material on the topic of maintaining the same look for different processor speeds?

How does one make an animation look the same, or have game mechanics work the same from a 1g processor to a 3g processor?

I would think there'd be an obvious FPS difference, and I'm assuming there's some trick or core knowledge I am ignorant to on the subject.

Thanks for any info you can provide!


05-20-2005, 10:37 AM
The simplest way is NOT to make you updates Frame based

Make it time based so you simply get the Time delta each frame and use that to calculate animations. motion models etc....

Ehsan Kamrani
05-20-2005, 11:14 AM
Can you please explain more?This is exactly my problem

05-20-2005, 11:24 AM
You measure the elapsed time. You then update all object positions and game dynamics based on the elapsed time.

So instead using saying

x= x + increment;

you use

x = x + x_velocity * elapsed_time_since_last_update;

Just as an example.

This should apply to ALL game dynamics.

Ehsan Kamrani
05-20-2005, 12:18 PM
Thank you Angus.
I have forgotten that which function is used to return the elapsed time?
I'm using from the Win32 application projects in VC++.

05-20-2005, 12:43 PM
double m_timeNow = 0.0;
double m_elapsedTime = 0.0;
double m_previousTime = 0.0;

Each frame you get the time elasped along the lines of.... See your Compiler API /SDK docs for timer functions offered

m_timeNow = getTimeFunction(); // Hi-resolution clock

m_elapsedTime = m_timeNow - m_previousTime;

m_previousTime = m_timeNow;

Then you use the m_elapsedTime in your update calculations

Ehsan Kamrani
05-20-2005, 01:07 PM
Thank you. But i can't use from the function getTimeFunction() in the win32 application.Should i add a header file?Or should i use from another function?

05-20-2005, 02:01 PM
See your Compiler API/SDK docs for timer functions offeredgetTimeFunction(); is used by way of an example

Ehsan Kamrani
05-20-2005, 02:30 PM
Well. I found that.For win32 application, we should use from the GetTickCount() function:

The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer.