Chipmunk 6.0.0 Released.

Official forum for the Chipmunk2D Physics Library.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Chipmunk 6.0.0 Released.

Post by slembcke »

So I wasn't too sure if I'd get this done before going camping this weekend, but I did. \o/
http://chipmunk-physics.net/release/ChipmunkLatest.tgz

I just released 5.3.5 so I won't add a lot of fanfare to this. I've spent a ton of time working on this for the last 6+ months to get the new spatial index working well and all the changes to the contact graph and sleeping algorithms. While most of the work was cleaning up and optimizing the internals, there are a good number of new features as well.

Keep in mind that Chipmunk 6.x's API is not quite 100% compatible with 5.x. Make sure you read the list of changes carefully.
Also, keep in mind that this is a x.0.0 release and that it's likely there are still some bugs I don't know about yet. If you are near the end of a project, or bundling it with another library, I might hold off for a few weeks. For new projects, jump right in! I've spent a lot of effort rewritting the collision detection, sleeping, and contact graph algorithms that have required large changes and cleanup to the 5.x codebase. I've ironed out all the bugs that I know of, and the beta test went well. So it's finally time for 6!

Next up is creating a ton of new example material. From what I gather from feedback, one of the biggest problems with Chipmunk is that there isn't enough example material. I'm going to create new demos that actually show off more interesting things that you can do, popup inline examples in the docs for a lot of the sections, and a number of new tutorials.

CHANGES SINCE 5.x:
  • API: Chipmunk now has hard runtime assertions that aren't disabled in release mode for many error conditions. Most people have been using release builds of Chipmunk during development and were missing out on very important error checking.
  • API: Access to the private API has been disabled by default now and much of the private API has changed. I've added official APIs for all the uses of the private API I knew of.
  • API: Added accessor functions for every property on every type. As Chipmunk's complexity has grown, it's become more difficult to ignore accessors. You are encouraged to use them, but are not required to.
  • API: Added cpSpaceEachBody() and cpSpaceEachShape() to iterate bodies/shapes in a space.
  • API: Added cpSpaceReindexShapesForBody() to reindex all the shapes attached to a particular body.
  • API: Added a 'data' pointer to spaces now too.
  • API: cpSpace.staticBody is a pointer to the static body instead of a static reference.
  • API: The globals cp_bias_coef, cp_collision_slop, cp_contact_persistence have been moved to properties of a space. (collisionBias, collisionSlop, collisionPersistence respectively)
  • API: Added cpBodyActivateStatic() to wake up bodies touching a static body with an optional shape filter parameter.
  • API: Added cpBodyEachShape() and cpBodyEachConstraint() iterators to iterate the active shapes/constraints attached to a body.
  • API: Added cpBodyEeachArbiter() to iterate the collision pairs a body is involved in. This makes it easy to perform grounding checks or find how much collision force is being applied to an object.
  • API: The error correction applied by the collision bias and joint bias is now timestep independent and the units have completely changed.
  • FIX: Units of damping for springs are correct regardless of the number of iterations. Previously they were only correct if you had 1 or 2 iterations.
  • MISC: Numerous changes to help make Chipmunk work better with variable timesteps. Use of constant timesteps is still highly recommended, but it is now easier to change the time scale without introducing artifacts.
  • MISC: Performance! Chipmunk 6 should be way faster than Chipmunk 5 for almost any game.
  • MISC: Chipmunk supports multiple spatial indexes and uses a bounding box tree similar to the one found in the Bullet physics library by default. This should provide much better performance for scenes with objects of differening size and works without any tuning for any scale.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Android_X
Posts: 18
Joined: Wed Oct 31, 2007 7:55 pm
Contact:

Re: Chipmunk 6.0.0 Released.

Post by Android_X »

Nice! You've added some cool features since I last used Chipmunk. I'm looking foward to using this in the near future. :D

One thing I noticed in the "Get it, Compile it" documentation section was the "Debug or Release?" paragraph says:
Release mode might be slightly slower, but will include a lot of error checking assertions that can...
I'm thinking it should say:
Debug mode might be slightly slower, but will include a lot of error checking assertions that can...
Thanks for all the effort you put into Chipmunk. Really appreciate it!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0.0 Released.

Post by slembcke »

Ah, thanks. Fixed that.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
otibom
Posts: 8
Joined: Sat Mar 26, 2011 7:45 am
Contact:

Re: Chipmunk 6.0.0 Released.

Post by otibom »

Great job ! How was your camping week-end ? :)

I just have two questions.
1/ Do we still need to call cpInitChipmunk() ? The source code says it's deprecated.
2/ Is there an official way of knowing the type of a shape ? If not, would it be possible to have something like cpShapeIsCircle, cpShapeIsSegment and cpShapeIsPoly ? That would be great.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0.0 Released.

Post by slembcke »

Pretty good. We went tubing down a river and had an independence day party yesterday.

Anyway.
1) Nope. cpInitChipmunk() is a no-op now. It does nothing now and is just a no-op. I suppose I should just completely remove the function. There really isn't a good reason to have the stub for it even.
2) Not in the public API no. I always use Chipmunk from an OO wrapper so I've never needed to do this. If you are comfortable using the private API and understand that it's not officially supported you can use shape->CP_PRIVATE(klass)->type to get the type.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
otibom
Posts: 8
Joined: Sat Mar 26, 2011 7:45 am
Contact:

Re: Chipmunk 6.0.0 Released.

Post by otibom »

Hi again,

There's an error when building as C++ with the files cpBBTree.c, cpSpaceHash.c and cpSweep1D.c

For example :

Code: Select all

cpSweep1D.cpp:252: error: redefinition of ‘cpSpatialIndexClass klass’
cpSweep1D.cpp:35: error: ‘cpSpatialIndexClass klass’ previously declared here
I'm not an expert on static and extern variables, but from what I've found :

Code: Select all

static int i;
// later ...
static int i = 0;
Isn't valid C++ (at least for g++).

I tried to modify the code to be like so :

Code: Select all

extern int i;
// later ... 
int i = 0;
by adding some #ifdef __cplusplus at the right places.
( cpBBTree.c line 27 and 696,
cpSpaceHash.c line 174 and 594,
cpSweep1D.c line 27 and 252 )

This compiles fine but doesn't link.

Code: Select all

ld: duplicate symbol _klass in CMakeFiles/chipmunk.dir/cpSpaceHash.cpp.o and CMakeFiles/chipmunk.dir/cpBBTree.cpp.o
Because _klass is then defined twice and 'externed'.

I've tried, but I don't see how to make it work without renaming one of the two _klass.

I see you're doing a (more or less) similar thing for MVSC. Does it not whine when linking ?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0.0 Released.

Post by slembcke »

Hmm. Yeah it's very possible that it's not valid C++. It worked in MSVC and I thought I tested it in either GCC or Clang compiled as C++. It's been a few weeks though so I don't quite remember.

Anyway, the simple fix is just to make a getter function.
static inline cpSpatialIndexClass *Klass(){return &klass;}

Throw a prototype for it at the top of the file and let the linker do the rest. I committed a change for this to the 6.x branch. I still haven't gotten around to moving trunk to be the 6.x branch yet. >_>

edit: Haha, I just saw the comment at the top of cpBBTree.c. I must have been pretty grumpy that day. heh
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
otibom
Posts: 8
Joined: Sat Mar 26, 2011 7:45 am
Contact:

Re: Chipmunk 6.0.0 Released.

Post by otibom »

Awesome !
Same thing for cpSpaceHash.c (line 174) and cpSweep1D.c (line 27) though. :D

edit : here's a svn patch : http://pastie.org/pastes/2198288/text
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0.0 Released.

Post by slembcke »

Hah. Figures. I probably should have checked that right away...

Thanks a bunch.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
TomorrowPlusX
Posts: 28
Joined: Tue Jul 12, 2011 6:31 am
Contact:

Re: Chipmunk 6.0.0 Released.

Post by TomorrowPlusX »

I'm having a build issue, using Xcode 4.0 & LLVM

Line 130 of cpSpace.c
space->staticBody = space->_staticBody;

cpSpace.c: error: Semantic Issue: Assigning to 'cpBody *' (aka 'struct cpBody *') from incompatible type 'cpBody' (aka 'struct cpBody')

Obviously, easily fixed by assigning to the address. But I wanted to let you know.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests