Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Timer in Arcadegame


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Zleik   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 December 1999 - 10:44 AM

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....


Sponsor:

#2 Enix   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 December 1999 - 10:44 AM

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 set


CurrentTime=GetTicksCount()// win32 function returning miliseconds


UpdateScreen((CurrentTime-LastTime)/1000);//convert time from miliseconds to seconds

LastTime=CurrentTime;

return TRUE;
}


void UpdateScreen(float Time){// time in seconds since last call


ShipX+=(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).]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS