Jump to content
  • Advertisement

Archived

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

vaneger

determine processor speed

This topic is 5331 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

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 ?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!