Archived

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

determine processor speed

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites