[ANN] JavaScript bindings for Chipmunk

Share your projects and Chipmunk enhancements.
Post Reply
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

[ANN] JavaScript bindings for Chipmunk

Post by riq »

Hi community,

I created JavaScript bindings for Chipmunk v6.1.1.

The generated JavaScript API is compatible with the Chipmunk-JS project ( https://github.com/josephg/chipmunk-js )

That means, that if you create a Chipmunk project using the JS API:
  • it can run on mobile devices / PCs at native speed (by using the Chipmunk JS bindings)
  • or it can run on the web (by using the Chipmunk-JS)
and without changing a single line of code.


Bugs / Features / Status:
Features:
- Currently it supports all the basic Chipmunk functionalities like, Space, Body, all types of shapes, all types of joints, collision detection callbacks.
- The API is 95% compatible with the Chipmunk-JS project. It still has some small incompatibilities which I will try to fix in the next days / weeks.
- The JS code is executed by the SpiderMonkey VM (bundled with the project).
- Supported Platforms: Although in theory should work (with little changes) on every Chipmunk supported platform it was tested only on OS X and iOS. Android version coming soon.
- For the moment there is no documentation, but the easiest way to start a Chipmunk + JS Bindings project is by downloading cocos2d-iphone (develop-v2 branch) ( https://github.com/cocos2d/cocos2d-iphone/ ), install the Xcode templates, and start a "cocos2d iOS with JavaScript" project (it includes the Chipmunk JS bindings as well).
- The bindings are automatically generated. So it should be easy to update them in case new features are added to the C Chipmunk library.
- Status: Alpha. Early adopters are welcome!

This project is part of a bigger project to create multiplatform games in JS using Chipmunk as the physics engine, and cocos2d as the game engine.
Info: https://github.com/cocos2d/cocos2d-ipho ... JavaScript

Sample game:
- From cocos2d-iphone (develop-v2)
https://github.com/cocos2d/cocos2d-ipho ... with_me.js
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by slembcke »

Looks like it's shaping up nicely.

I'll have to figure out what to do about adding bindings for Pro level features soon it looks like. :)
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by riq »

slembcke wrote:Looks like it's shaping up nicely.

I'll have to figure out what to do about adding bindings for Pro level features soon it looks like. :)

If you need help in adding JS bindings for Chipmunk Pro, let me know. I can help you with that.
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by riq »

Update:
  • I Fixed more compatibility issues with Chipmunk-JS.
  • I have just "ported" (it was simple copy & paste) the Chipmunk-JS tests to Chipmunk + JS Bindings. The physics code is 100% the same. No changes!!
Image
Image
Image
Image

Test's source code:
- https://github.com/cocos2d/cocos2d-ipho ... hipmunk.js

Todo:
- Add support for "dragging" objects in the tests.
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by riq »

Buoyancy tests ported :-)

Image
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by riq »

I have just released cocos2d v2.1-beta3: http://www.cocos2d-iphone.org/forum/topic/69175

It includes:
- @slembcke's Chipmunk additions: CCPhysicsDebugNode and CCPhysicsSprite
- JS Bindings for Chipmunk which are compatible with Chipmunk-JS
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by riq »

Update:

The Chipmunk's extensions for cocos2d (PhysicsSprite and PhysicsDebugNode) were also added in the cocos2d-html5 project.
That means that your cocos2d + chipmunk game can run on the web (using Chipmunk-JS and cocos2d-html5) and mobile (using cocos2d-iphone or cocos2d-x and chipmunk + JS bindings) without changing a single line of code!!

Demo (Select the Chipmunk Test):
http://www.cocos2d-iphone.org/t/js-tests/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by slembcke »

Huh, that's actually pretty cool. I wish I had more time to play around with it. :-\
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
riq
Posts: 37
Joined: Mon Jun 23, 2008 1:16 pm
Location: California, USA
Contact:

Re: [ANN] JavaScript bindings for Chipmunk

Post by riq »

We have just released a new version of cocos2d that features Chipmunk-JS, and includes new samples.
The release notes are here:
http://www.cocos2d-iphone.org/archives/2196

You can play Watermelon With Me (a Chipmunk + cocos2d game) online from here:
http://www.cocos2d-iphone.org/t/js-test ... lonWithMe/

Image
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests