Physics: falling down speed in different browsers

Discussion and feedback on Construct 2

Post » Fri Jan 10, 2014 3:37 pm

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.greentea2014-01-10 15:41:13
B
3
Posts: 4
Reputation: 183

Post » Fri Jan 10, 2014 3:49 pm

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.
http://gafferongames.com/game-physics/fix-your-timestep/
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Fri Jan 10, 2014 5:54 pm

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.
B
3
Posts: 4
Reputation: 183

Post » Fri Jan 10, 2014 8:00 pm

But on a different computer.... it's 3 times slower. omg :(
B
3
Posts: 4
Reputation: 183


Return to Construct 2 General

Who is online

Users browsing this forum: The Mnk and 36 guests