box2dweb-closure icon indicating copy to clipboard operation
box2dweb-closure copied to clipboard

Step frequency.

Open aholla opened this issue 11 years ago • 2 comments

Hi I thought I would give this ago and with a couple of tweeks had my game ported from the stock version of box2dweb to your google version.

Would there be any reason why if I change my step frequency it looks all jittery? I am using the easel framework and have set my frame rate to 25. This works fine with the original version, but with your version it looks like it is studerring.

Setting the frame-rate to 30 minimises this to some extent but not really enough, is there something your port does differently?

Thanks for the help.

aholla avatar Apr 22 '13 10:04 aholla

Generally speaking, this version should perform faster than stock box2dweb (at least the specific version this is based off of).

It is possible that the difference in performance between your original version and the box2dweb-closure version is enough to cause things to become out of sync with your video card's refresh rate.

If you are using setTimeout or setInterval, try using requestAnimationFrame instead: http://paulirish.com/2011/requestanimationframe-for-smart-animating/

If you can share the game code, then I would be willing to take a look (when I get time) and see if I can narrow down the cause.

illandril avatar Apr 23 '13 17:04 illandril

Hi thanks for getting back to me, I will try to build a test version of my code that I can share. I am currently used RequestAnimationFrame and as for performance, it looks like it is running slower due to the judderyness. Il post back when I have s test you could look at. Thanks.

aholla avatar Apr 23 '13 18:04 aholla