Physics: falling down speed in different browsers

0 favourites
  • 4 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I have a project where two objects are falling down:

    • a Block with physics behaviour
    • a Bullet with bullet behavior (speed 400)

    Falling from top to bottom of the layout lasts:

    • In Chrome: 6.7s for Block and 0.8s for Bullet
    • In FF: 1.1s for Block and 0.8s for Bullet
    • In IE: the timers didn't update, but visually looked like in FF
    • In Opera: 5.4s for Block and 0.7s for Bullet

    As we can see, Bullet speed (400) was the same in all browsers. But Block speed (default physics) was completely different in IE+FF versus Chrome+Opera.

    Is there any good way to make the physical speed of falling down the same for all browsers? (the correct speed I think would be FF+IE)

    Unfortunately, I can't post a url to the project file on this forum.

  • When Box2D only uses a simple Fixed time step then code execution speed impacts the results. It's the reason I don't like Box2D much, the official box2d has never implemented cross platform and code speed execution handling. Now not all browsers are made the same. IE browser has slow JS execution speed though improved these days.

    But there are a few things to check out first.

    1. Go to your project properties.

    2. Check under physics engine. You have 3 optiosn. Webbrowser, ASM.js and CocoonJS. try out Web and asm options and see if helps at all.

    If that doesn't work. you can work on creating an improved manual timestep in C2 physics option. If the above doesn't work, this one will.

    gafferongames.com/game-physics/fix-your-timestep

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have no physics option in my project properties, to choose cocoon.js, asm etc.

    I added an action on the Block object to change the Physics world stepping mode to "frame independent" (there is a tutorial titled "Delta-time and framerate independence"). I also displayed the system dt variable.

    After doing this the speeds are more equal:

    • In Chrome: 1.58s for Block (dt=0.05)
    • In FF: 1.14s for Block (dt=0.03)
    • In IE: 1.13s for Block (dt=0.01)
    • In Opera: 2.75s for Block (dt=0.08)

    So the speed in Chrome is now more like FF+IE. In Opera it's still slow. I don't know, maybe the programmatic solution that you linked would further improve the speed in Opera - but I don't know where to put that code.

  • But on a different computer.... it's 3 times slower. omg :(

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)