Chipmunk 4.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 4.0.0 released.

Post by slembcke »

Not a huge upgrade, but here it is:

http://files.slembcke.net/chipmunk/rele ... Latest.tgz

From the release notes:
  • Rational Versioning: Hopefully this will encourage me to make smaller, but more frequent releases.
  • Optimizations: Speed increases of 5-10% should be common.
  • Groove joint: Similar to a pivot joint, but one of the anchors is on a linear slide instead of being fixed.
  • Commenting/Refactoring: The code should be much easier to follow now.
  • Official build paths for Linux and Windows.
If there are any obvious issues right away let me know. I wasn't able to test the CMake files fully, or the MSVC project file. If there are still build hiccups I will try to fix those ASAP.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
lucas
Posts: 54
Joined: Wed Sep 26, 2007 2:34 am
Contact:

Re: Chipmunk 4.0.0 released.

Post by lucas »

*Dances*
Tangame - a tangram puzzle game with physics.
http://code.google.com/p/tangame/
joshcryer
Posts: 18
Joined: Wed Sep 26, 2007 8:19 pm
Contact:

Re: Chipmunk 4.0.0 released.

Post by joshcryer »

With MSVC2k5 using the default solution I get 9 errors.

Code: Select all

problem lines (last line is the error):

	int num = 5;
	cpVect verts[num];

error:

c:\programs\chipmunk-4.0.0\demo\demo3.c(69) : error C2057: expected constant expression
c:\programs\chipmunk-4.0.0\demo\demo3.c(69) : error C2466: cannot allocate an array of constant size 0
c:\programs\chipmunk-4.0.0\demo\demo3.c(69) : error C2133: 'verts' : unknown size

Code: Select all

problem lines (last line is the error):

cpMomentForPoly(cpFloat m, const int numVerts, cpVect *verts, cpVect offset)
{
	cpVect tVerts[numVerts];

c:\programs\chipmunk-4.0.0\src\chipmunk.c(48) : error C2057: expected constant expression
c:\programs\chipmunk-4.0.0\src\chipmunk.c(48) : error C2466: cannot allocate an array of constant size 0
c:\programs\chipmunk-4.0.0\src\chipmunk.c(48) : error C2133: 'tVerts' : unknown size

Code: Select all

problem line:

	cpFloat non_zero_dist = (dist ? dist : INFINITY);

c:\programs\chipmunk-4.0.0\src\cpcollision.c(45) : error C2177: constant too big

Code: Select all

problem line:

	jnt->n = cpvmult(delta, 1.0f/(dist ? dist : INFINITY));

c:\programs\chipmunk-4.0.0\src\cpjoint.c(57) : error C2177: constant too big

Code: Select all

problem line:

	jnt->n = cpvmult(delta, 1.0f/(dist ? dist : INFINITY));

c:\programs\chipmunk-4.0.0\src\cpjoint.c(170) : error C2177: constant too big
I don't know why it's complaining about "constant arrays" since at least with regards to the function cpMomentForPoly it is indeed being passed a const, it *shouldn't* be throwing that error *at all*. It's just very weird. Also, INFINITY is defined as '(1e1000)' which MSVC doesn't like.
X-0ut
Posts: 28
Joined: Tue Oct 02, 2007 5:02 am
Contact:

Re: Chipmunk 4.0.0 released.

Post by X-0ut »

They constants are not known at compile time.
Instead use new to allocate the array. (or malloc, whatever you prefer)

Check the other post on a windows build for the INFINITY macro problem.
joshcryer
Posts: 18
Joined: Wed Sep 26, 2007 8:19 pm
Contact:

Re: Chipmunk 4.0.0 released.

Post by joshcryer »

Ahah, thanks. I was looking at the MSVC version from that thread and they allocate it thusly: cpVect* tVerts = new cpVect[numVerts];

I'd been looking at another version of the code which is what confused me (I thought merely changing it to 'const cpVect numVerts' was the solution!).

edit: BTW X-Out, wanted to thank you for those fixes, I would've thanked you in the other thread but didn't want to throw out a needless bump. :)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 4.0.0 released.

Post by slembcke »

Crud. I thought I had merged the necessary changes into trunk. Looks like I'll have to check again.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 4.0.0 released.

Post by slembcke »

Ok. I think it should work now. (Crosses fingers)
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
joshcryer
Posts: 18
Joined: Wed Sep 26, 2007 8:19 pm
Contact:

Re: Chipmunk 4.0.0 released.

Post by joshcryer »

:shock:

I should probably leave the whole bug reporting/fixing issue to X-Out. :)

Doesn't quite work yet though. I'm going to stick to the older revision. Hopefully X-Out will be kind enough to report back the necessary changes.
X-0ut
Posts: 28
Joined: Tue Oct 02, 2007 5:02 am
Contact:

Re: Chipmunk 4.0.0 released.

Post by X-0ut »

And here it is
Was not much to alter really, just needed a cast from void* in cpMomentForPoly (I also threw in a free to deallocate the cpVect) and to comment out the timeofday calls.
joshcryer
Posts: 18
Joined: Wed Sep 26, 2007 8:19 pm
Contact:

Re: Chipmunk 4.0.0 released.

Post by joshcryer »

X-Out, nice! I actually was fiddling with it just now and just got it working (whew!), I did the calloc cast "(cpVect *) calloc ...", and the "always define windows.h before gl.h" thing (which is what made me sort of perplexed and not wanting to try 'fixing it' but when I googled the problem was really simple). Then I spent a stupid amount of time trying to find a gettimeofday substitute for Windows. Making a GetTickCount define for WIN32 might be a bit more elegant in the end. But yeah it's not as bad as I originally thought.

So many props to slembcke! Sorry for all the trouble, and the rambling. :)

BTW, I got it somewhat integrated into my crappy handmade collision detection (using a iterated distance to line formula that broke on certain cases) already, so yeah. Fun! :D

One last thing. It's probably a stupid thing but I went and got freeglut (which works out of the box) and am using it to do my builds. It was never any culprit in my attempts to compile it so it's just a suggestion since it's currently maintained and all and "just works."
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests