determine processor speed

Started by
2 comments, last by vaneger 20 years, 1 month ago
how can i determine the processor speed so that i can slow my game down to the right time for what ever system it runs on ?
Advertisement
don''t determin the processor speed... instead use the frame rate
You don''t have to do that.

Personally, I just calculate the time spent between 2 frames and multiply it with whatever I want to move.

Exemple:
int timeFrame;int timeLastFrame;bool MyFrame(){ // timeGetTime() is a window function, it returns current // time in milliseconds timeFrame = timeGetTime()-timeLastFrame; timeLastFrame = timeGetTime(); //Do a lot of stuff here //Draw graphics //Player sound //Get input //etc.. //Move player if he press left arrow if( getKey(LEFT_ARROW)==true ) //Left arrow pressed   PlayerX += 10*timeFrame;}


if the user has a good processor and timeFrame is equal to 2 ( 2 milliseconds )
PlayerX will have increased of 20 ( 10*2 ) overs 2 milliseconds
20/2 = 10, player is moving of 10 units per milliseconds

if the user has a bad processor and timeFrame is equal to 10 ( 10 milliseconds )
PlayerX will have incresed of 100 ( 10*10 ) over 10 milliseconds
100/10 = 10, player is moving of 10 units per milliseconds

So they are both moving at the same speed
Yeah, there''s a lot more to game speed than what speed the processor is running at. Memory latency and bandwidth, GPU performance, multitasking, etc... you don''t get a good measure of how fast your app will be running except by timing it.

"Sneftel is correct, if rather vulgar." --Flarelocke

This topic is closed to new replies.

Advertisement