Anybody can give some idea about chipmunk and box2d,which is better.
1. performance
2. learning curve
3. usability
I create game,but I don't know which one is better choose.
A fast, easy to use, free, and community supported 2D game engine
Anybody can give some idea about chipmunk and box2d,which is better.
1. performance
2. learning curve
3. usability
I create game,but I don't know which one is better choose.
One of the main attractions of Box2D for me is that it is written in C++ versus Chipmunk which is written in C. That is just a personal choice as I'm much more comfortable with C++ and have a lot of other code in C++.
I think other people are interested in Box2D because they are familiar with it from one of the ports, such as the Flash/AS3 version.
I think there are a lot more examples of using Chipmunk with cocos2d, you can even get the source code for some games to have a look at to see how things are done. So the learning curve for using Chipmunk with cocos2d is probably less.
I've been working a lot with Box2D lately, and I'm considering spending the many hours necessary to migrate StickWars from chipmunk to use Box2D. I absolutely love Box2D so far...here is why:
It's a much more mature framework, with a lot of documentation and forum posts out there dealing with common issues. I've also researched around and found that it seems to run faster than Chipmunk, while having a more powerful feature set. I'm not exactly sure why this is the case. For one thing, objects in Box2D that aren't actively moving can 'sleep' and not use CPU cycles until something else impacts then, but even without sleeping objects Box2D seems to be as good or better than chipmunk.
As far as learning curve, I'd truthfully say it is slightly more difficult to use, but is because the API offers greater flexibility which you need to understand as you start to use it. However, the documentation is comprehensive and will help you with this.
The better API design leads to certain issues being far easier to implement in Box2D than in chipmunk. Remember all the posts about people asking about how when they remove objects in chipmunk callbacks, they get a crashes? Well with Box2D it returns objects that can be cached and processed after all the collisions in the physics step are completed, allowing each object to safely flag itself as 'dead' inside a collision. With Chipmunk, I had to 'hack' in a timer for each one of these steps, and it led to many errors along the way.
Here is a quick post that has some code I used to make Box2D work with my Cocos2d project. http://johnehartzog.com/2009/07/using-box2d-physics-engine-with-cocos2d-iphone/
To be honest, I didn't find the example in the cocos library by the time I had written most of this, but this solves a few nice issues, such as the contact-callback removal issue.
To conclude:
1) Box2D had slightly better performance in terms of FPS, especially if you have dynamic objects that are sometimes not moving (and can use Box2D's sleep feature).
2) The learning curve is slightly higher, but there is more documentation to make up for it.
3) The usability is a far higher, as Box2D includes many more features (including bullet collision detection) that aren't in chipmunk.
I'm using the latest chipmunk version 5.0 (still in beta) and it's got SO MUCH awesome stuff. I really wouldn't go for Box2D if i were you.
What i did to overcome that chipmunk is coded in C is simply to make my own wrapper objective-c classes that completely encapsulate chipmunk so i end up working with pure objects and never even notice i'm using chipmunk.
I did the same for chipmunk, and posted some code about how I did it http://johnehartzog.com/2009/04/integrating-chipmunk-into-objective-c/. Box2D still needed it's own 'wrapper' that I included, but through doing so it gave me some extra functionality, such as being able to remove objects from the world in collision callbacks.
However, I've found that Box2D offers a better simulation (objects bounce correctly, for one) with the same or better performance (allows sleeping objects!) while including the ability for bullet-collision detection if necessary.
However, I haven't tried out any version of chipmunk that wasn't included w/ Cocos2d, so I can't vouch for the beta versions.
I just started working with cocos2d about two weeks ago working in my part time. I have found Box2D to be very simple to use and I am brand new to iphone programming. I can't speak for chipmunk. I don't think you would be making a wrong choice with either seeing as most people seem split on the decision and games have been written with both.
Well what's really awesome with chipmunk 5.0 is that all joints are now breakable, and joints changed and now making a spring is completely straightforward like a pinjoint.
There's also magnetism, and you can put gravity in objects so you can have a little planet where things are attracted to it.
Lots of improvements and new features really, gears, motors, etc etc.
As a note it sounds like the author of chipmunk has incorporated the core collision algorithm to greatly speed up chipmunk. Just FYI to consider when making your choice.
Also is anyone using version 5.0 with cocos?
We are using chipmunk trunk. But I have not compared it to Box2D. I would like to do so, but I do not have the time for this right now.
Zombie - Castle Defense redefined: ZombieSmash! http://ZombieSmash.gamedrs.com"
Can you remove objects in the collision callback with Chipmunk 5? Not being able to in previous versions is enough to make me switch to box2d on my next game. But if you can now, I'll reconsider.
I quick note, using the version of Box2D currently in Cocos2d, it does not allow removal in callbacks (though I heard the beta supports it). The difference is that Box2D is based of C++ so it returns callback information in objects that you can easily cache and process when the collision solving is finished.
yeah i'm using chipmunk 5.0 with cocos 0.8
since i'm starting a new game i decided to go with 5.0 since the way joints work changed so you'll need to do some refactoring on your sourcecode if you want to go from 4.1 to 5.0
I heard you can remove objects from the space in a collision callback, but you cannot free them there.
I do not need this, so no problems for here. Only performance would be a reason for me. Plain C is not that bad.
Zombie - ZombieSmash! http://ZombieSmash.gamedrs.com
Hi,
I read in the Chipmunks forums that Scott Lembke (the creator) did some fixes regarding allowing removing objects in the callback (also freeing them), but for what I read some weeks ago they don't work in every situation.
Anyhow you can create a garbage (or removed object) collection method for hadling this: I have done and works great.
For me plain C is quite good, I don't see the point for moving this to C++
It's easy if you are starting from scratch, if you have a game using chipmunk already it won't be that simple since you'll have to go through all your old joints and change them to the new constraint system.
If you have joints :)
@Carpy,
I downloaded the latest chipmunk. Do I need to just replace the chipmunk folder with my previous version of chipmonk from the cocos xcode project? The reason I ask is the folder stuctures look different and I am curious if there is a iphone specific version or something else I need to do.
Thanks,
Jim
Just replace the chipmunk files and add .c files to the chipmunk target. Remember to add the change in the cpvect.h made by cocos2d to the new file. This sets cpVect equal to CGPoint.
Zombie - ZombieSmash! http://ZombieSmash.gamedrs.com
Our musician will be revealed tonight! (the last hint: Tu..., R-..., Gr..., Sh...)
Is there a good example of using Box2D with cocos2d for moving objects with a mouse? I've been searching and thinking about it, but don't have a solution as yet.
MouseJoint, or can use body->SetXForm(...
Thanks Johnny,
I had somehow missed SetXForm. That works, but boy is it laggy and kills the FPS all by itself. Though being new at this I blame the loose nut behind the keyboard.
Thanks again,
Steve
Hi, could someone give me the link to download chipmunk 5.0 ? I don't find it on Slembcke's website.
Thanks
(I just found it..... :D )
I ported cocos2d-x’s “chipmunk” & “BOX2D” to the Android Apps as to work.
Prease also see this site of "github" below.
https://github.com/hirokazuono/Chipmunk_and_BOX2D_of_cocos2dx_ported_to_Android
kanrinin_kanmasato(hirokazu_ono)
cocos2d-xの"chipmunk"と"BOX2D"をアンドロイドアプリにしてみました。
githubでダウンロードなどもおこなえますのでそちらもどうぞごらんください。
管理人菅理人(かんまさと、こと 小野博和。東京都港区)
Movie -> http://youtu.be/fEVbocT8BtE
or -> http://www.firstpost.com/topic/product/android-cocos2dx-cocos2d-xbox2dchipmunk-to-video-fEVbocT8BtE-53093-1.html
--------------
(Sorry, the urls below are in case of the posted urls above that can't cliclable.)
site
You must log in to post.