Open finscn opened 6 years ago
Not sure why, but it looks like tick() & render() is called twice in your p2.js example (unless I'm reading this wrong):
Whereas with box2d and other libs it is only called once:
I didn't see anything in the code that would cause two calls, so not sure what I'm seeing here.
@englercj , in my test , it's once .
Maybe your chrome's bug ?
these test cases use the same tick-system (in the same file common.js) , there are only some differences in the functions about init-world , render-world & world-step.
For me tick
is called 3 times, sometimes 4:
The slower the machine I try it on, the more ticks I get. The faster the machine, the less ticks. On my desktop gaming PC I get 1 tick solidly. On my laptop, 3 ticks (as above).
So the worse the machine, the more work p2 is being asked to do. Probably as a result of the fixed timestep values it's being fed?
I think because P2.js is slow , it takes multi-tick , not because multi-tick , so slow.
I've update the tick(). Please test again.
Whatever how many times the tick()
be called , the p2.js is always slower than box2d .
I found the performance of p2.js is worse than box2d.js (only 50%)
There is a test I created:
http://fatidol.com/phy-benchmark/
There are many different box2d.js projects , I chose https://github.com/flyover/box2d.js , Because it includes Google's LiquidFun , I like this feature.