time synchronisation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hell_bird
Posts: 18
Joined: Mon Nov 03, 2003 12:30 pm

time synchronisation

Post by hell_bird »

if i dont use the, that are synchronized, but make my own funktions: is it possible to synchronize the movement etc. ?

if i use 1/FPS, there are bad things happening in the first second
Isometric God
Posts: 69
Joined: Sun Oct 12, 2003 3:42 pm
Location: Germany

Post by Isometric God »

Take the time when you start your game up ( you could usie the Irrlicht timer functions ) and measure the amout of time that passed until the last frame / beginning. Multiply this value with your movement vectors etc.. and your game should run more or less framerate-independent ... :wink:
hell_bird
Posts: 18
Joined: Mon Nov 03, 2003 12:30 pm

Post by hell_bird »

if i do so, the program isnt running smooth. i think the engine takes the average of one second.

@nico: How are the engines funktions implemented? which value is multiplied with the movement vectors?
Isometric God
Posts: 69
Joined: Sun Oct 12, 2003 3:42 pm
Location: Germany

Post by Isometric God »

This is my timer code :

Code: Select all

m_DeltaTime = g_pDevice->getTimer()->getTime() - m_Time;
m_Time += m_DeltaTime;
In my movement code I multiply the velocity with that value

Code: Select all

m_Pos += m_Vel * g_pTimer->GetTimeDelta();
Thats it
Post Reply