Jump to content
  • Advertisement
Sign in to follow this  
Seer

Libgdx Framerate

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

In Libgdx, we're given the option to update movement speed by delta time, like this:

position.x += speed * Gdx.graphics.getDeltaTime();

Is this all that's needed to ensure a smooth framerate on multiple devices, in place of a time regulated update loop?

Share this post


Link to post
Share on other sites
Advertisement

Is this all that's needed to ensure a smooth framerate on multiple devices

 

It won't produce a smooth framerate (it won't alter the framerate at all) but it will give the appearance of smooth motion regardless of fluctuations of the framerate.

And yes it should work across multiple platforms.

 

Personally I tick my physics/update code using a fixed delta (1/60th of a second) for a stable and repeatable simulation. Not all games need that, but it's worth keeping in mind. It's the classic "fix-your-timestep" solution.

Share this post


Link to post
Share on other sites

For a 2D RPG where the most advanced 'physics' is rectangle bounds collision handling, would using delta time to update movement and limiting the FPS with 

config.foregroundFPS = 60;

be enough to make sure the gameplay stays consistent across devices with varying frame rates?

Share this post


Link to post
Share on other sites

It depends what you mean by 'consistent'. It will look smooth and generally work well on devices that can deliver 60fps or more. But even with that I expect the deltaTime will still vary frame to frame so it still can't be quite as stable or repeatable when compared to an absolutely fixed delta.

 

Probably you need not worry about it, just go with what you have and make a fantastic game!

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.

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!