Jump to content
  • Advertisement

Archived

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

MtK

Adjustment of game speed...

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

I''m programming a little Game in C++ (under DOS) and now have a little Question about how to adjust the game speed to processor speed. I''ve already implemented my own way to do so and now I just wanted to ask if that''s the right one. -First I count the FPS and then take the average of the last 5 values as average FPS (AFPS) -With this value i initialise the counter that decrements by one every frame and catches the keyboard input when it''s 0. { counter = AFPS/28; //don''t ask for the 28} -The next thing to control by AFPS is the spritemovement. I also have a counter that decrements by a certain value depending on AFSP.{ movesprite[no_sprite] -= (SPEED/AFPS)+1; //SPEED is a constant value (320) } I know that this is a little bit messed up but it works quite well (the game runs good on a 486/66 Mhz as well as an Duron 800 Mhz) only the timing of the Spritemovement is a bit different... Can I leave it that way ?

Share this post


Link to post
Share on other sites
Advertisement
I suggest you run a set of cycles, possibly a counted loop, and find the difference using the computer''s timer. Then, assume that is the speed for whatever operation you have to perform. I think you should get a standard speed, and then use that as a constant to make a ratio. For example, get the game to work as you like it to work under a 66mhz, map it to 1, and then use that constant which you calculated to determine speed relative to 1... I think.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!