Interface to Chipmunk 7.0.1 [2D physics engine]

Advanced game related topics
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

First of all, thanks to all here who helped me with some import issues related to MSVC++ compiler.
Chipmunk is very nice open-source phys engine that can be used in complex 2D games for advanced collision handling or complete world physics simulation.
It is written in pure C and this makes a difference too (not for speed only), cause no wrapper needed to use it from PB, unlike other solutions like BOX2D with their damn POO classes.

So here are my bindings including simple helloworld example and .lib binaries: http://geocities.ws/lunasole


Some general documentation: https://chipmunk-physics.net/release/Ch ... test-Docs/

Also other info and and full engine sources here: https://chipmunk-physics.net/
(anyway you need to look on it's sources/official demos sources, cause using it without that might be hard way [even with sources sometimes it is :)])

*currently only Windows x86/x64 versions
Last edited by Lunasole on Wed Jun 22, 2016 3:58 am, edited 10 times in total.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Fred
Administrator
Administrator
Posts: 14430
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Fred »

May be you can post the include file directly on this forums as text, so it won't get lost
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

Fred wrote:May be you can post the include file directly on this forums as text, so it won't get lost
They are using customized version of Chipmunk lib (fixed for compatibility with PB without using wrappers) so without binaries includes are useless.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

Just updated files to new version.
- ported lot of cpv_ math functions (all or almost all of them)
- added some others
- included debug version of chipmunk lib (it should warn about doing something wrong, but seems It didn't warns, so maybe useless)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
juankprada
User
User
Posts: 62
Joined: Tue Mar 18, 2014 4:25 pm
Location: Bogotá, Colombia

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by juankprada »

Maybe you can use something like GitHub or Bitbucket to share it?
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

juankprada wrote:Maybe you can use something like GitHub or Bitbucket to share it?
I'm too lazy to reg on such sites 8) But should be good idea, ty.
After the work with it all will be more or less finished I'll post results to github or similar, currently just continue updating file here.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

Another update
- fixed bug with cpBool type (chipmunk was returning unsigned char byval and PB was unable to use it properly, changed type to int)
- some basic fix to cpMessage, very basic fix: it only writes single message to "_chipmunk_error.log" if chipmunk crashes. but that is enought for now
- added callback prototypes / fixed their params, and some other stuff

+ spotted another problem with 2 callback prototypes which have to return structures byval
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
mpz
Enthusiast
Enthusiast
Posts: 465
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by mpz »

Dear lunasole,

i am working on mp3d and use Chipmunk verion 5 as 2d Physic engine. Will you make a x64 version for this lib too? I am interresting on it to use your chipmunk 7 in my engine, but i use MP3D as x86 and x64 lib...

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

mpz wrote:Dear lunasole,

i am working on mp3d and use Chipmunk verion 5 as 2d Physic engine. Will you make a x64 version for this lib too? I am interresting on it to use your chipmunk 7 in my engine, but i use MP3D as x86 and x64 lib...

Greetings Michael
Hi.
I have compiled x64 lib after your msg, but there are problems with C int size and similar, leading to memory errors inside engine.
Unfortunately It all requires detailed review of chipmunk code and takes time to fix and test everything (I guess, several days), currently I'm working on my project with 32bit version and planning to adopt x64 only sometime later.
For now I can only give you the x64 .lib file itself and related imports list if that can help.
Or maybe IceSoft can help you, he is working with 7 version too.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

Updated to 0.38 after spotted some bugs today

Code: Select all

- fixed cpMomentForBox, cpBoxShapeInit, cpBoxShapeNew functions : earlier parser missed their cpBB byval params due to stupid bug
- fixed incorrect symbols in some functions [that was a parser mistake too]
- added common function to safe deletion of single body and some other small improvements
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
mpz
Enthusiast
Enthusiast
Posts: 465
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by mpz »

Dear lunasole,

i will test the 32bit lib in my engine in the next time and hope you may a x64 version of it. I think x64 is the future...

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

mpz wrote:Dear lunasole,

i will test the 32bit lib in my engine in the next time and hope you may a x64 version of it. I think x64 is the future...

Greetings Michael
If you find any bugs or improvements please post.
x64 surely has to be done but currently I can't tell when I will do everything with it, I'm mostly busy with all others things.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

Well, I have some good news 8)
Today I found some time to deal with x64 version and did it [instead of going to sleep, hah].
So there is version 0.39 in first post, it seems working [at least with helloword ^^]
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 984
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by Lunasole »

In total it all seems working fine, but I'm currently playing only with x86 version in my code.
Maybe later also remove those _pb extensions from some functions if make completely sure it all works as should [or find a more nice way to deal with those "structures by val" than modifying engine sources, currently have no much time to play with all this]
- a very minor but important update: removed structure align by 4 bytes, because of "KISS" :)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
mpz
Enthusiast
Enthusiast
Posts: 465
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Post by mpz »

Hi Lunasole,

Thanks for your work. I have time in the new year and will test it with my sprite engine.

Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
Post Reply