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!
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…
Can you please explain more?This is exactly my problem
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;
x = x + x_velocity * elapsed_time_since_last_update;
Just as an example.
This should apply to ALL game dynamics.
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++.
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
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?
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.