Games using the Chipmunk4PB wrapper (2D physic engine)

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

I had a couple of questions:
1. When the output wrapper to version 6?
2. In this version of the wrapper is missing a lot of commands, and in some procedures do not match the number of parameters. The author has no plans to add a brief description of the structures and commands?
3. What exactly does this function: cpSpaceHashEach (*space\activeShapes,@DrawShape(),#Null) ?

Little things will not ask, I will try to understand them myself.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

AndyLy wrote:I had a couple of questions:
1. When the output wrapper to version 6?
2. In this version of the wrapper is missing a lot of commands, and in some procedures do not match the number of parameters. The author has no plans to add a brief description of the structures and commands?
3. What exactly does this function: cpSpaceHashEach (*space\activeShapes,@DrawShape(),#Null) ?

Little things will not ask, I will try to understand them myself.
1) When it is done and not before the 4.60 is released. Sorry.
2) Tell me what you are missing and I will add it to the wrapper. Some function have to wrap a little bit more. That's the reason for different parameter. In most cases it is the return value of a structure which PureBasic can not handle correct.
3) Read the docu here: http://chipmunk-physics.net/release/Chi ... test-Docs/ or ask in this forum:http://chipmunk-physics.net/forum/
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

I do not hurry you, just want to know: I continue to write under the current version of the procedure, or should wait for a new one.
"Tell me what you are missing..."
Without some procedures you can do if you know the description of the structures .But when some have additional parameters, it is not clear that there sent. I wanted to try a code, taken from the forum and could not implement it for lack of commands and mismatches.

Code: Select all

// velocity of the two surfaces in relation to the collision normal at the collision point
static inline cpFloat
hit_velocity(cpBody *a, cpBody *b, cpVect p, cpVect n){
   cpVect r1 = cpvsub(p, a->p);
   cpVect r2 = cpvsub(p, b->p);
   cpVect v1_sum = cpvadd(a->v, cpvmult(cpvperp(r1), a->w));
   cpVect v2_sum = cpvadd(b->v, cpvmult(cpvperp(r2), b->w));
   
   return cpvdot(cpvsub(v2_sum, v1_sum), n);
}

// This is a pre-solve callback
static bool
bumpSoundCallback(cpArbiter *arb, cpSpace *space, void *unused)
{
   cpShape *a, *b; cpArbiterGetShapes(arb, &a, &b);
   cpContact *contacts = arb->contacts;
   
   const cpFloat min = 10.0f;
   const cpFloat max = 300.0f;
   cpFloat nspeed = cpfabs(hit_velocity(a->body, b->body, contacts[0].p, contacts[0].n));

   if(nspeed > min){
      ALfloat volume = fmax(fminf((nspeed - min)/(max - min), 1.0f), 0.0f);
      playSound(bumpSound, volume, 1.0f);
   }
   return TRUE;
}
Here
cpvsub, cpvmult - need 3 parameters instead of 2. What are they?
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

AndyLy wrote: 1) I continue to write under the current version of the procedure, or should wait for a new one.
2) Without some procedures you can do if you know the description of the structures .But when some have additional parameters, it is not clear that there sent. I wanted to try a code, taken from the forum and could not implement it for lack of commands and mismatches.

Code: Select all

// velocity of the two surfaces in relation to the collision normal at the collision point
static inline cpFloat
hit_velocity(cpBody *a, cpBody *b, cpVect p, cpVect n){
   cpVect r1 = cpvsub(p, a->p);
   cpVect r2 = cpvsub(p, b->p);
   cpVect v1_sum = cpvadd(a->v, cpvmult(cpvperp(r1), a->w));
   cpVect v2_sum = cpvadd(b->v, cpvmult(cpvperp(r2), b->w));
   
   return cpvdot(cpvsub(v2_sum, v1_sum), n);
}

// This is a pre-solve callback
static bool
bumpSoundCallback(cpArbiter *arb, cpSpace *space, void *unused)
{
   cpShape *a, *b; cpArbiterGetShapes(arb, &a, &b);
   cpContact *contacts = arb->contacts;
   
   const cpFloat min = 10.0f;
   const cpFloat max = 300.0f;
   cpFloat nspeed = cpfabs(hit_velocity(a->body, b->body, contacts[0].p, contacts[0].n));

   if(nspeed > min){
      ALfloat volume = fmax(fminf((nspeed - min)/(max - min), 1.0f), 0.0f);
      playSound(bumpSound, volume, 1.0f);
   }
   return TRUE;
}
Here
3) cpvsub, cpvmult - need 3 parameters instead of 2. What are they?
1) PLease continue with your work. The Chimunk 6.x wrapper will not be free like the 5.x wrapper version.
Only 5.x will be still free. I will make a update to ther latest 5x version (5.3.5) after release of PureBasic 4.60.
2) Only cp* functions are public functions. Were you have this example source?
3) cpvsub, cpvmult, ... returning a structure of cpVect. As long PureBasic cannot handle structures as return value as long such kind of functions have to be wrapped. The first parameter is the return value.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

Were you have this example source?
This code is taken from the chipmunk-physics forum. Posted some guy with a nick slembcke. :)

Thank you. Somehow I figured out that code. There were link errors due to cpfabs, cpfmax, cpfmin - had to throw them away. :)
In general, it seems I am close to completing a wrapper for your wrapper. :)
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

AndyLy wrote:
Were you have this example source?
1)This code is taken from the chipmunk-physics forum. Posted some guy with a nick slembcke. :)

Thank you. Somehow I figured out that code.
2) There were link errors due to cpfabs, cpfmax, cpfmin - had to throw them away. :)
3)In general, it seems I am close to completing a wrapper for your wrapper. :)
1) There is a lot of such examples on the Chipmunk forum. I do not knowing all.
2) Polink errors?
3) Fine. You are not alone ;-)
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

Fine. You are not alone
And who else mpz?
I'm writing it for my little game, so it will not be universal.
Polink errors?
POLINK: error Unresolved external symbol 'cpfabs@@YANN@Z'
POLINK: error Unresolved external symbol 'cpfmax@@YANN@Z'
POLINK: error Unresolved external symbol 'cpfmin@@YANN@Z'

Add
Test program today, changed all the settings. The slowdown started after 1000 (small) objects, that I was not happy. Hoped for more. In connection with the question: cpSpaceResizeActiveHash shure works? I tried different settings, even removed it, no effect.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

AndyLy wrote:
Fine. You are not alone
And who else mpz?
I'm writing it for my little game, so it will not be universal.
Polink errors?
POLINK: error Unresolved external symbol 'cpfabs@@YANN@Z'
POLINK: error Unresolved external symbol 'cpfmax@@YANN@Z'
POLINK: error Unresolved external symbol 'cpfmin@@YANN@Z'

Add
Test program today, changed all the settings. The slowdown started after 1000 (small) objects, that I was not happy. Hoped for more. In connection with the question: cpSpaceResizeActiveHash shure works? I tried different settings, even removed it, no effect.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

AndyLy wrote:
Fine. You are not alone
And who else mpz?
I'm writing it for my little game, so it will not be universal.
Polink errors?
POLINK: error Unresolved external symbol 'cpfabs@@YANN@Z'
POLINK: error Unresolved external symbol 'cpfmax@@YANN@Z'
POLINK: error Unresolved external symbol 'cpfmin@@YANN@Z'

Add
Test program today, changed all the settings. The slowdown started after 1000 (small) objects, that I was not happy. Hoped for more. In connection with the question: cpSpaceResizeActiveHash shure works? I tried different settings, even removed it, no effect.
Post your code and I can say more
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

Post your code and I can say more
It will be difficult. But I tried the example that you put a wrapper, Chipmunk4PB_Demo.pb- there exact same situation.
I do not see any difference with or without cpSpaceResizeActiveHash.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

Maybe this answer is the right for you:
http://chipmunk-physics.net/forum/viewt ... Hash#p6887

Question about Chipmunk functions should be be better ask on the Chipmunk board ;-)
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

The point is that I first looked at the forum and judging by the posts it works for them. Change the settings have a visible effect, but I do not have any effect, even if I delete the hash command.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

After a long break, I returned to Сhipmunk:

http://www.youtube.com/watch?v=Xr-CicRCmKs
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
User avatar
IceSoft
Addict
Addict
Posts: 1698
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by IceSoft »

AndyLy wrote:After a long break, I returned to Сhipmunk:

http://www.youtube.com/watch?v=Xr-CicRCmKs
Sweet. But I think it is not using PureBasic. Right?
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
AndyLy
Enthusiast
Enthusiast
Posts: 228
Joined: Tue Jan 04, 2011 11:50 am
Location: GRI

Re: Who is also working on a Chipmunk wrapper (2D physic eng

Post by AndyLy »

Sweet. But I think it is not using PureBasic. Right?
Why have you decided so? Of course this is PureBasic! Pure PureBasic.
'Happiness for everybody, free, and no one will go away unsatisfied!'
SMsF town: http://www.youtube.com/watch?v=g6RRKYf_Pd0
SMf locations module (Ogre). Game video: http://www.youtube.com/watch?v=ZlhBgPJhAxI
Post Reply