PureBasic Forum
https://www.purebasic.fr/english/

Interface to Chipmunk 7.0.1 [2D physics engine]
https://www.purebasic.fr/english/viewtopic.php?f=16&t=64161
Page 1 of 2

Author:  Lunasole [ Sun Nov 29, 2015 11:31 pm ]
Post subject:  Interface to Chipmunk 7.0.1 [2D physics engine]

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

Author:  Fred [ Mon Nov 30, 2015 8:13 am ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

May be you can post the include file directly on this forums as text, so it won't get lost

Author:  Lunasole [ Mon Nov 30, 2015 8:51 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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.

Author:  Lunasole [ Thu Dec 03, 2015 3:23 am ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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)

Author:  juankprada [ Thu Dec 03, 2015 4:04 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Maybe you can use something like GitHub or Bitbucket to share it?

Author:  Lunasole [ Thu Dec 03, 2015 10:50 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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.

Author:  Lunasole [ Tue Dec 08, 2015 1:46 am ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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

Author:  mpz [ Mon Dec 14, 2015 1:39 am ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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

Author:  Lunasole [ Mon Dec 14, 2015 6:04 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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.

Author:  Lunasole [ Tue Dec 15, 2015 3:23 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Updated to 0.38 after spotted some bugs today
Code:
- 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

Author:  mpz [ Wed Dec 16, 2015 1:29 am ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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

Author:  Lunasole [ Wed Dec 16, 2015 12:58 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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.

Author:  Lunasole [ Fri Dec 18, 2015 8:27 am ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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 ^^]

Author:  Lunasole [ Sun Dec 27, 2015 6:22 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

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]
Quote:
- a very minor but important update: removed structure align by 4 bytes, because of "KISS" :)

Author:  mpz [ Fri Jan 01, 2016 1:58 pm ]
Post subject:  Re: Interface to Chipmunk 7.0.1 [2D physics engine]

Hi Lunasole,

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

Greetings Michael

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/