Jump to content
  • Advertisement
Sign in to follow this  
ms75214

fast frames

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

So, I have a game that runs at over 100 frames/sec:



Should I just let it run really fast like that? Or should I limit the rate to 60 or 70 frames a second?

Share this post


Link to post
Share on other sites
Advertisement
Everything that needs to be should be frame independent. You can do this by multiplying by delta time (i.e. the time elapsed between each frame)


float deltaTime = gameTime.GetElapsedTime( ); // elapsed time since last loop iteration in milliseconds/seconds or thereabouts.. I generally prefer it in 100ths of a second, i.e. ms * 100.0f
//..
player.position.x += player.velocity.x * deltaTime;
player.position.y += player.velocity.y * deltaTime;
//..
frame += frameSpeed * deltaTime;


you get the point, sorry i don't know the correct terminology for what exactly I'm showing you, maybe someone else can better explain.

Share this post


Link to post
Share on other sites
you have two options:
1. use a timer to lock your game to x frames every second(with methods ensuring critical input isn't loss).
2. use a time-step(per above posts), to lock your input every frame to only increment by a specefic amount, regardless of how your fps jumps/drops.

here's a good article on the subject of time-steps: http://gafferongames.com/game-physics/fix-your-timestep/.

Share this post


Link to post
Share on other sites
You got to do it frame independent as a general rule, because if you set it for 60 fps for example, it might run with 50 fps on some older machines(well, not this game I guess, but as a general rule), so you want to gather your input at fixed time steps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!