Interface to Chipmunk 7.0.1 [2D physics engine]

Advanced game related topics
User avatar
Lunasole
Addict
Addict
Posts: 1091
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: Thanks for your work. I have time in the new year and will test it with my sprite engine.
Good luck to you.
I having no much experience playing with things like bindings/interfaces, so please write If you have any ideas/found bugs/etc about anything related to this stuff, or just can advice something to make it looking better or being more usable 8)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

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

Post by Lunasole »

At last I came to some tests of 64 bit version. It works fine with my current project, however I'm still not sure that all C types defined correctly for x64.

Also now I'm finding those my bindings made crude enough :D
Maybe I should split all the functions to separated interfaces, one per every category, i.e. space, constrains, shapes and so on, that can made code more ordered and clear.
Also, would be nice to create separated binaries with SSE/SSE2 support.
And also I think should try DLL instead of LIB, this will resolve POLINK conflict with MS VC++ compiler if optimizations are enabled.
And there should be better solution for procedures returning and taking structures byval, than rewriting them to pointers with adding "_pb" extension as I did before (that was stupid work, but better than to waste time trying to find other options).

But well, thats all secondary, I can say it works and thats enough for now, it even doesn't need SSE2 optimizations to be enabled, as engine is already good coded and very-very fast with lot objects (like tile-based world in Terraria style) even on oldest hardware.
Rather I should make build for linux, but don't know how soon.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Octavius
User
User
Posts: 15
Joined: Tue May 20, 2008 11:17 am
Location: France

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

Post by Octavius »

Hi,

I am interested in using 2D physics, I downloaded your chipmunk library. But then where should I begin? Is there any tuto? Or at least an example with a little game? What is the list of the new commands and how do they work? Thank you.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

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

Post by Lunasole »

Octavius wrote:Hi,

I am interested in using 2D physics, I downloaded your chipmunk library. But then where should I begin? Is there any tuto? Or at least an example with a little game? What is the list of the new commands and how do they work? Thank you.
The way how I learned it: readed its sources, readed docs, and experimenting with interesting functions trying to do something.
There are examples with some demos, but I was too lazy to port them to PB (lot of code and I didn't see enoughs reasons to port it), just ported simple helloworld to check engine and later ported some more to use in my code, but this is not complete demo to post it (it is binded to my game renderer and other systems).

So generally you should start by downloading sources, learn main engine principles, read C code of official demos and write something based on them.
Also here is a link with general docs: https://chipmunk-physics.net/release/Ch ... test-Docs/
And the Chipmunk forum itself should have some more examples and useful info.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Octavius
User
User
Posts: 15
Joined: Tue May 20, 2008 11:17 am
Location: France

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

Post by Octavius »

Well, OK. Thank you.

Unfortunately I can't read C code, but your link is very helpful.
The helloworld demo does not show any graphical output, only printed coordinates, so I guess my first step will be to modify that demo to understand how it works.

I am not an experimented programmer, but if I happen to be able to make some working demos I will post them on the forum.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

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

Post by Lunasole »

Octavius wrote: Unfortunately I can't read C code, but your link is very helpful.
I am not an experimented programmer, but if I happen to be able to make some working demos I will post them on the forum.
I highly recommend you to start learn C anyway (at least learn it to the level which allows you to translate its code to Purebasic), as C is "immortal classic" language and there are most serious things made on it or languages with similar syntax.
Octavius wrote: The helloworld demo does not show any graphical output, only printed coordinates, so I guess my first step will be to modify that demo to understand how it works.
Yes that simplest demo probably can be nicely visualised and extended with more interesting stuff than falling ball 8)
Good luck with your attempts and ask if you get some problems or questions about engine
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

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

Post by Lunasole »

Btw, I just updated binaries with this small change

Code: Select all

- redefined CP_EXPORT from "__declspec(dllexport)" to ""; with previous define the resulting EXE had export table with all chipmunk functions
I don't know who made msvc project originally, but that thing when your final executable (game) provides export table of included .lib was dirty and annoying ^^ Should fix it months ago, but as always was too lazy before.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

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

Post by Lunasole »

Update because of this

Code: Select all

http://geocities.ws/lunasole/
No more 30-days links, at last I've created some home page to host random stuff.... that should be done 8 or 12 years ago ^^
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
ShaunRW
New User
New User
Posts: 1
Joined: Sun Sep 18, 2016 8:58 am

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

Post by ShaunRW »

I am a noob to PureBasic. How would I go about using the Chipmunk physics engine on Mac OSX?
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

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

Post by IceSoft »

This is windows only compilied
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

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

Post by IceSoft »

You can also use the Chipmunk4PB_7.01 :
http://www.purebasic.fr/english/viewtop ... 14&t=44068

Biggest news:
As UserLib written in full C++
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Post Reply