Physics in Javascript Using Box2D
somethingcoded.net
Physics in Javascript Using Box2D
1–10 of 11 posts
Re: Physics in Javascript Using Box2D
#2Re: Physics in Javascript Using Box2D
#3Looks cool, but I couldn't get the page to load. I was once worked on a demo of a similar kind of game to help teach physics.
Re: Physics in Javascript Using Box2D
#4Looks cool, but I couldn't get the page to load. I was once worked on a demo of a similar kind of game to help teach physics.
(Sorry, this is totally off-topic, but...) It's surprisingly easy to make a segway-like balancing robot with perfect sensors. My plan is to add noise in the sensors and limited motor torque, etc. Ideally it would estimate its own kinematic parameters and do an A* search for approximate optimal control.
Re: Physics in Javascript Using Box2D
#5Looks cool, but I couldn't get the page to load. I was once worked on a demo of a similar kind of game to help teach physics.
I'm using box2d (there are at least three box2d javascript implementations; the most impressive is the emscripten port from the actual C++ code: https://github.com/kripken/box2d.js but I'm using an older one for this). I wanted to prototype a simple balancing robot controller, and I hacked this up on the bus to work earlier this week in fact: http://www.a1k0n.net/code/balance.html Click to drop junk. (Sorry, this is…
i don't think what you're saying is totally off topic. box2d is pretty awesome and it's surprisingly easy to get physics simulations up and running using the library.
Re: Physics in Javascript Using Box2D
#6Earlier quoted context omitted.
I'm using box2d (there are at least three box2d javascript implementations; the most impressive is the emscripten port from the actual C++ code: https://github.com/kripken/box2d.js but I'm using an older one for this). I wanted to prototype a simple balancing robot controller, and I hacked this up on the bus to work earlier this week in fact: http://www.a1k0n.net/code/balance.html Click to drop junk. (Sorry, this is…
hey a1k0n, we'll definitely have to take a look at the port you dropped in your post. we didn't do a ton of research before hand, but we were debating between box2djs and box2dweb. in the end we choose box2dweb since it's self contained within a single file and was supposed to be more up to date. i don't think what you're saying is totally off topic. box2d is pretty awesome and it's surprisingly easy to get physics s…
btw disasteroids is hilariously awesome. Great work.
Re: Physics in Javascript Using Box2D
#7Earlier quoted context omitted.
hey a1k0n, we'll definitely have to take a look at the port you dropped in your post. we didn't do a ton of research before hand, but we were debating between box2djs and box2dweb. in the end we choose box2dweb since it's self contained within a single file and was supposed to be more up to date. i don't think what you're saying is totally off topic. box2d is pretty awesome and it's surprisingly easy to get physics s…
The thing about the emscripten version is that their own demos seem to GC-pause constantly on Chrome. I'm assuming the emscripten-generated code is making tons of incidental garbage, but I haven't profiled it or anything; it's all Closure-compiled and impossible to read. I'm still using the old old old actionscript port of the old version, and wish I had seen box2dweb sooner. btw disasteroids is hilariously awesome.…
Either way, though, if you have a reproduction case for those pauses you should definitely file a bug about it on the appropriate tracker - emscripten's if something is wrong with the generated code, or chromium's.
Re: Physics in Javascript Using Box2D
#8Earlier quoted context omitted.
The thing about the emscripten version is that their own demos seem to GC-pause constantly on Chrome. I'm assuming the emscripten-generated code is making tons of incidental garbage, but I haven't profiled it or anything; it's all Closure-compiled and impossible to read. I'm still using the old old old actionscript port of the old version, and wish I had seen box2dweb sooner. btw disasteroids is hilariously awesome.…
Emscripten generally speaking does not produce garbage because it uses a virtual heap. If you profile the demos using a heap profiler like Chrome's you will be able to observe this. The pauses are likely due to bugs in V8 that cause it to recompile a page's JavaScript constantly (it has a lot of them). The cost of those bugs ends up being higher than that of equivalent bugs in Firefox's JS engine because of the way V…
I think you're right though. Once it's been running a while, it seems OK; so I think it was JIT compilation pauses.
Re: Physics in Javascript Using Box2D
#9Earlier quoted context omitted.
Emscripten generally speaking does not produce garbage because it uses a virtual heap. If you profile the demos using a heap profiler like Chrome's you will be able to observe this. The pauses are likely due to bugs in V8 that cause it to recompile a page's JavaScript constantly (it has a lot of them). The cost of those bugs ends up being higher than that of equivalent bugs in Firefox's JS engine because of the way V…
Yeah -- I knew about the virtual heap arrays, so the GC explanation didn't make sense. I'll dig into it; thanks for the pointers. I think you're right though. Once it's been running a while, it seems OK; so I think it was JIT compilation pauses.
It does indeed seem to be the JIT warming up. The good news is that Chrome Canary is significantly smoother, so 6-8 weeks until that hits stable.
Re: Physics in Javascript Using Box2D
#10Earlier quoted context omitted.
Yeah -- I knew about the virtual heap arrays, so the GC explanation didn't make sense. I'll dig into it; thanks for the pointers. I think you're right though. Once it's been running a while, it seems OK; so I think it was JIT compilation pauses.
We've been testing out ammo.js (Emscripten compiled Bullet) for 3D physics. In this demo http://apps.playcanvas.com/will/ammo/crates after the first couple of resets, it runs smoothly. It does indeed seem to be the JIT warming up. The good news is that Chrome Canary is significantly smoother, so 6-8 weeks until that hits stable.