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 7174821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:08:30+00:00 2026-05-28T16:08:30+00:00

So I just changed my game update function to update alle movements depending on

  • 0

So I just changed my game update function to update alle movements depending on the difference between the actual FPS and the fixed game FPS.

For example I set my game to a fixed 60 FPS.
If the actual FPS is 20 I calculate the difference like that:

((20 * 100) / 60) / 100 which would result in 0.333
So the difference of 1 game loop would be 1 - 0.333 = 0.677

Thus all game movements wouldn’t be updated based on a normal game loop:

x += speedX * 1 but width an increased value: x += speedX * 1.677

So now my game runs at the same speed on every system, just with less pictures, but thats not the problem.

I’m not entirely sure if that causes the collisoin detection to fail, but I guess as the game speed gets increased to match the current fps, the collision detection isn’t able to track all events anymore because positions get skipped. It will only check for collision around the player.

How do I manage this problem ?

Edit:

Here is an example of the collision detection:

var xi = this._game.level.getField(this.x);
var yi = this._game.level.getField(this.y);

var left = this._game.level.levelData["col"][(xi-1) + "," + yi] ? (xi-1) * 32 : null;
var right = this._game.level.levelData["col"][(xi+1) + "," + yi] ? (xi+1) * 32 : null;
var top = this._game.level.levelData["col"][xi + "," + (yi-1)] ? (yi-1) * 32 : null;
var bottom = this._game.level.levelData["col"][xi + "," + (yi+1)] ? (yi+1) * 32 : null;

// Will hit ground ?
if (this.y + this.height >= bottom && bottom != null) {
    this.ground = true;
    if (!this.jumping) this.y = bottom - this.height;
}

// Left
if (this.x <= left + 32 && left != null) {
    this.x = left + 32;
}

// Right
if (this.x + this.width >= right && right != null) {
    this.x = right - this.width;
}

this is the player.
and left/right are the collision tile positions on the grid.
Each tile is 32×32 and the player is 25×25.

Here is the full game: [removed]

Edit: The problem is actually somewhere else since bottom is not null.
When I put the player at bottom - (this.height + 1) instead of bottom - this.height (1 pixel higher), he doesn’t allways fall through.

  • 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-05-28T16:08:31+00:00Added an answer on May 28, 2026 at 4:08 pm

    Im on my phone right now so I can’t check out your sample. So if I am reading your collision detection stuff right, then you update the players position and then check for a collision. This, if the frame rate is low enough or the object is moving fast enough, means that an object can “phase” right through a barrier. Being entirely on one side of it before the frame update and being entirely on the opposite side of it after the frame update.

    There are a couple ways to address this problem, the most direct is to not only test where the object is now, but where it’s been as well while it moved. Implement a collision detection algorithm that detects all the zones that a player or object has to pass through to get from a to b and base your collision on that.

    Also checkout gamedev.stackexchange.com. It’s usually a good place to ask game specific questions.

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

Sidebar

Related Questions

Hi I am using Mysql 5.0.x I have just changed a lot of the
I want to workaround the Webpage has expired issue. First, I just changed a
I just recently changed out all my hard drives and in the process of
I have just installed a new ssl certificate on GlassFish 3. I also changed
I just finished a couple of activities in my game and now I was
I am making a game in Python with Pyglet. I have just finished the
i just got into game development and XNA and was following a tutorial and
I hav an app that i just did an update on and uploaded, everything
I just enabled Failed Request Tracing for a site and I get a URL_CHANGED
I figured the easiest thing to do was to just change the port number

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.