Chipmunk 6.x Physics Translation

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Chipmunk 6.x Physics Translation

Post by Oz »

Image
Oz wrote:HUGE BUG/INCONVENIENCE!
It seems that I did a bit of bad translation of the inline functions found in the headers. Currently, they are just regular subs and functions, which is fine if we have a one-module/sourcefile, but as soon as we have multiple, you will get a pile of duplicate definition errors for all of those inline functions. If ANYONE wants to help translate all of these from sub/functions to #DEFINEs, please submit patches either on this thread, on the google page, or via email!
Thanks,
-Oz
01-17-2012
Hi - I'm currently maintaining the chipmunk physics headers for freebasic.

You can find all the information on the https://github.com/mrozbarry/Chipmunk-Physics/ (or the old tutorials and code on the google code page).
To get the latest archives, you can download them from this page.
To get the latest updates, visit the update page.

Update: Chipmunk version 6.x has been released!
  • Grab the win32 library here here
Update: To grab a copy from the git
git clone git://github.com/mrozbarry/Chipmunk-Physics.git
In the chipmunk download, you get the following:
  • The latest headers (from the chipmunk svn, converted using fbfrog and some corrections by hand)
  • A bunch of demos (who doesn't like these?)
  • Some more practical examples (a little more comprehensive than the demos)
  • A chipmunk wrapper that I made called easyChipmunk - check it out!
You can find my unofficial tutorial here

From the tutorial pages, you find these handy tricks:
  • Move objects with the mouse and constraints
  • Iterate over all the shapes in a space for easy drawing
  • Make consistent simulations across any computer with and without threads
  • And More!
Remember, this is all open source, so please contribute! If you have content you want to submit (demos, examples, modifications to easyChipmunk, tutorial pages/edits), please reply on this thread, or contact me via the project page!

Thanks for the support!
-Oz
Last edited by Oz on Nov 08, 2012 6:32, edited 14 times in total.
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

Thanks for this. Really appreciated. I planned to write few dummy tutorials on Chupmunk. This will be more than helpful.
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

I just wanted to bump this topic, saying that I am still maintaining the headers (Which now work 100% bug free) and trying to regularly build the linux and win32 binaries for chipmunk.

You can get the latest headers and libraries here:
http://code.google.com/p/chipmunk-freeb ... ec2010.zip
or
http://code.google.com/p/chipmunk-freeb ... sic.tar.gz

These downloads reflect the svn build as of Dec 3, 2010.

If anyone wants to help contribute to the project, either reply here, or email me at: alex _DOT_ barry _AT_ gmail _DOT_ com

Take care,
-Oz
Raddel
Posts: 23
Joined: Oct 07, 2007 3:31

Post by Raddel »

Hi all,

I want to try the chipmunk engine and i try to compile one demo file : demo-mouse.bas and the this error show up:


C:\FreeBASIC\fbc -s console "demo-mouse.bas"
C:/FreeBASIC/inc/chipmunk/cpBody.bi(135) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpVect, p, Pos)'
C:/FreeBASIC/inc/chipmunk/cpBody.bi(136) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpVect, v, Vel)'
C:/FreeBASIC/inc/chipmunk/cpBody.bi(137) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpVect, f, Force)'
C:/FreeBASIC/inc/chipmunk/cpBody.bi(140) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpFloat, w, AngVel)'
C:/FreeBASIC/inc/chipmunk/cpBody.bi(141) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpFloat, t, Torque)'
C:/FreeBASIC/inc/chipmunk/cpBody.bi(143) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpFloat, v_limit, VelLimit)'
C:/FreeBASIC/inc/chipmunk/cpBody.bi(144) error 109: Cannot modify a constant, before ':' in 'CP_DefineBodyProperty(cpFloat, w_limit, AngVelLimit)'

Build error(s)


How should i do? i have copy the header file and library into freebasic program. Am i wrong here? Everyone can explain this...

Thank You.
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

Thanks for catching that error. I'm looking into it now, and I'll let you know what I find.
I'll let you know when I post the fix,
-Oz
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

Go into inc/chipmunk/cpBody.bi
change lines 119/120 to:

Code: Select all

#define CP_DefineBodyGetter(t, m, n) function cpBodyGet##n( byval body as cpBody ptr ) as t: return body->m : end function
#define CP_DefineBodySetter(t, m, n) sub cpBodySet##n( byval body as cpBody ptr, byval value as t ) : body->m = value : end sub
The problem was body was being passed as const so the address of the variable wouldn't change, but modifying the variable seems to have been an issue.
Is this a fbc bug, or is that the proper behaviour?

Take care,
-Oz
Raddel
Posts: 23
Joined: Oct 07, 2007 3:31

Post by Raddel »

It's look like success dude when i change the CpBody.bi, but something more problem again when i compile with freebasic 0.21, now the section in library it show up like this :


libchipmunk.a(cpVect.o):cpVect.c:(.text+0x1b): undefined reference to '__mingw_vsprintf'
libchipmunk.a(chipmunk.o):chipmunk.c:(.text+0xc5b): undefined reference to '__mingw_vsprintf'
ibchipmunk.a(cpShape.o):cpShape.c:(.text+0xc84): undefined reference to '__mingw_vsprintf'




Maybe the library it's not compatible with freebasic here... or something wrong when build the library.

Thank You.
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

I can't say I ran across that error while using windows, but I can test it out tomorrow and maybe recompile chipmunk (right now, I'm running linux, but tomorrow, I'll have access to a windows machine).

I'll let you know how that goes.
Thanks for letting me know about these errors,
-Oz
rdc
Posts: 1741
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Post by rdc »

Nice tutorials. Very helpful.
Raddel
Posts: 23
Joined: Oct 07, 2007 3:31

Post by Raddel »

Yap.. I'm running chipmunk in windows version. ok i'm waiting the news tommorow. see ya.
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

So, I compiled that program on windows without any issue. I'm running windows xp sp3, with fbc 0.21.1 (standalone).

The issue may be that you don't have the c++ 2005 redistributable runtime installed (I'm pretty sure that uses mingw32), which might be the issue.

Raddel, what version of windows and fbc are you using? That will also help me track down the problem. Also, are you using my pre-compiled library, or did you compile chipmunk on your own?

Can anyone else running windows confirm this error?

Take care, and hopefully we get to the bottom of this soon,
-Alex
Raddel
Posts: 23
Joined: Oct 07, 2007 3:31

Post by Raddel »

I'm running on Windows xp sp2 and fbc 0.21.1
I'm not build the library on my own and use the exist library there. Maybe i'm lacking in some component but i dunno what is it?
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

Try installing this:
http://www.microsoft.com/downloads/en/d ... laylang=en

This is the visual c++ 2005 redistributable package, which should have a dll that will automatically be linked to libchipmunk.a, and give you the mingw32 vsprintf function that fbc is complaining you don't have.

If that doesn't solve it, let me know, and we'll do some more troubleshooting.

Take care (and I hope you had a Merry Christmas),
-Oz
Raddel
Posts: 23
Joined: Oct 07, 2007 3:31

Post by Raddel »

Thank you Oz, i had merry chrismast too...

Ok, i've download VC++ 2005 Redist and installed that, and make sure i've restart my pc, but it seems look same problem, the compiler cannot find `__mingw_vsprintf'.
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

Try downloading this (mingw32 runtime).
Uncompress the archive and copy the dll file(s) to your c:\windows\system32 directory, or optionally add the path to the dll files to your system's PATH variable.

Let me know if that works,
-Oz
Post Reply