3 ms·
Planck.js developer here! I have posted this to reddit before, so I'm just going to include it here too: I have ported/rewritten Box2D physics engine to JavaSc
by shakiba 9y ago
Planck.js developer here! I have posted this to reddit before, so I'm just going to include it here too:
I have ported/rewritten Box2D physics engine to JavaScript, for cross-platform HTML5 game development. Planck.js includes entire Box2D algorithms, a simple HTML5 Testbed, more than 50 examples and some new game prototypes. The project is pre-released and there may still be minor issues, which I'm working to fix. So far I have spent more than 400 hours for developing this project and it consists of around 20k lines of code.
https://github.com/shakiba/planck.js https://github.com/shakiba/planck.js
My main motivations for working on this project are:
- Taking advantage of Box2D's efforts, achievements and community knowledge
- Developing readable and maintainable JavaScript code
- Optimizing the library for web and mobile platforms
- Providing a JavaScrip-friendly API
Your feedback is highly appreciated, and I hope you use Planck.js to make some awesome games soon!
- plopz 9y agoHow does this compare to other 2d physics libraries like p2.js?
- shakiba 9y agoP2.js was a great effort and is a nice project. It is also inspired by Box2D and its API is very similar, however Box2D algorithm and architecture are more sophisticated and stable, and is already used in many popular games (such as AngryBirds) and game dev libraries (such as Apple's SpriteKit) so I decided to rewrite Box2D to make it available to JS/HTML5 game developers as well.
- Edmond 9y agoThe more things change the more they stay the same...I did a manual port of http://www.box2dflash.org/ http://www.box2dflash.org/ to JS a few years back to make educational simulations: http://schoolnotez.com/ http://schoolnotez.com/ http://appynote.com/app-store/ http://appynote.com/app-store/ (see the pendulum example.) good job.
- HalcyonicStorm 9y agoI remember using your site to learn and play around with Box2d. Thank you for your effort
- shakiba 9y agoGreat work! I decided to directly rewrite Planck.js from Box2D C++ code, so that I can keep it updated (as far as I remember that flash port was few years old).
- lr4444lr 9y agoWish this was around back when the only other option was Box2DJS, which was a Flash conversion, maybe even nothing more than a trans-pile. I haven't had a use for it in years, but I will definitely keep it on hand. A commendable contribution! I thank you 100 times over!
- tiglionabbit 9y agoI used that version just fine in my projects.
- deleted 9y ago[deleted]
- tiglionabbit 9y agoHow does this compare to Box2DJS, the automatic conversion of the ActionScript version of Box2D? http://box2d-js.sourceforge.net/ http://box2d-js.sourceforge.net/
- shakiba 9y agoBox2DJS is based on an old Flash port and as far as I remember it didn't work well when I tested it (for example second example on the website doesn't work currently, right click to switch to next example). I decided to directly port from C++ so that I can keep it updated.
- CyberDildonics 9y agoWhy not just compile to asm.js?
- zaf 9y agoReally great work, gives me some ideas. Thank you.