Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Timer in Arcadegame

4: Adsense

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   

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


#2 Enix   Members   

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.