Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9110767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:20:50+00:00 2026-06-17T03:20:50+00:00

I am making a platform game in the Libgdx framework. I want to implement

  • 0

I am making a platform game in the Libgdx framework. I want to implement the ability to jump for my character. I use the simply formula:

speed += acceleration * delta_time
r += speed * delta_time

It works well, but only for constant frames per second. The lower FPS is, the lower my character jumps. I have no idea what is the cause of this behavior, the height of jumps should be the same :/
There is a fragment of my code:

delta_time=Gdx.graphics.getDeltaTime();
if(input.getUpArrow()){
     if(is_in_air==false){
        is_in_air=true;
        speed_y=speed_y_0;
     }
  }

  if(is_in_air==true){
     speed_y-=acceleration*delta_time;
  }
  else{
     speed_y=0;
  }
  
  x+=speed_x*delta_time;
  y+=speed_y*delta_time;

And here is an illustration (black dots are character positions):
https://i.stack.imgur.com/VnNIK.jpg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:20:52+00:00Added an answer on June 17, 2026 at 3:20 am

    This is perfectly normal behaviour given the very simple and highly inaccurate integrator that you use. It is pretty easy to do the math and show that.

    Let’s take a single time span of 1/30 seconds. When the game runs at 30 FPS there would be only one update to speed_y and y, so after 1/30 s the new position y' would be:

    speed_y' = speed_y - a*dt
    y' = y + speed_y'*dt = y + speed_y*dt - a*dt^2
    

    Here dt is the time delta of 1/30 seconds.

    When the game runs at 60 FPS, in the same 1/30 seconds there would be two updates happening with twice as shorter time delta, dt/2:

    // First update
    speed_y' = speed_y - a*(dt/2)
    y' = y + speed_y'*(dt/2) = y + speed_y*(dt/2) - a*(dt/2)^2
    // Second update
    speed_y'' = speed_y' - a*(dt/2) = speed_y - a*dt
    y'' = y' + speed_y''*(dt/2) = y + speed_y*dt - 3*a*(dt/2)^2
    

    Now compare both updated y positions:

    • at 30 FPS it is: y + speed_y*dt - a*dt^2
    • at 60 FPS it is: y + speed_y*dt - a*(3/4)*dt^2

    Obviously at 60 FPS the new position of y would be higher than that at 30 FPS because the subtracted value is lower.

    This only affects the vertical motion. The horizontal speed is constant and it doesn’t matter if you update x once or twice with twice as short time delta, hence when your character jumps it always travels the same horizontal distance to the place where it hits the ground, no matter what the FPS.

    To solve this you have to take a closer look at the equation of motion under constant acceleration:

    y(t) = y(t=0) + v(t=0)*t - (1/2)*a*t^2
    

    The choice of t=0 is arbitrary since laws of physics are invariant under time shifts, so one may take t=0 to be the beginning of the update interval and then t=delta_time would give the position after the current update. The correct update algorithm as follows:

    x += speed_x*delta_time;
    if (is_in_air) {
       y += (speed_y - 0.5*acceleration*delta_time)*delta_time;
       speed_y -= acceleration*delta_time;
    }
    

    Note that speed_y should be updated after the vertical position as per the values found in the equation of motion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im making a platform type of game. I made my main character a rectangle
I am making a 2D game for the Android platform. The character is supposed
I am making a basic platform game for the iPhone and I have encountered
I'm making a game for the Android platform and I need to access some
I'm making a simple 2d game for the android platform, which works perfectly from
In a cross-platform (Windows, FreeBSD) C++ project I'm working on, I am making use
I am making a platform game, but i have a problem with my collision
I'm making App in Netbeans platform in Java Swing. I want to add and
I am making an app, a game, and I want the player to be
Can I use Corona http://www.coronalabs.com/products/corona-sdk/ for making non-game apps? I mean non-game application with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.