• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

## 1 post in this topic

I try to use a high-resoloution timer in my 2d-arcade-game: I get the frame time of the last frame and then move my ships by Movement_per_Second * frametime but the result is, that the ships are really shaking, because the frametime is changing extremly (nearly everything between 30-60 btw: someone has told me that the Fps can only be numbers like 30, 45, 60 and never something like 33 is this correct ? why ?)

So, has anyone a idea how I can stabilize this ? At the moment I am checking the Frametime at the beginning of the game during an graphical effect, calculating the average of 200 Frames and using this number for the rest of the game, but I am still wondering why the above doesn't work and why the frametime is changing that much....

0

##### Share on other sites
First of all, the fps is not restricted to to 30, 45, and 60. thats absurd.

Second, why time your game into the frame time so much???
instead pass each object in the game the ammount of time that has passed since it was last called.

code:
BOOL SomeFunct(){DWORD LastTime, CurrentTime;// last time is allready setCurrentTime=GetTicksCount()// win32 function returning milisecondsUpdateScreen((CurrentTime-LastTime)/1000);//convert time from miliseconds to secondsLastTime=CurrentTime;return TRUE;}void UpdateScreen(float Time){// time in seconds since last callShipX+=(Time*MOVEMENT_PER_SEC);//move the ship}

Its not the most perfect code ever, but i think it conveys the general idea.

[This message has been edited by Enix (edited December 14, 1999).]

[This message has been edited by Enix (edited December 14, 1999).]

0

• 10
• 11
• 20
• 11
• 28