Jump to content


Photo

Gmode Physics V0.50b - Gm 6/7/8 Support


  • Please log in to reply
80 replies to this topic

#21 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 06 September 2008 - 06:24 AM

Hmm, do you know if ODE has deactivating objects? As in, if it doesn't move for a while, it is cut out of the loop to not waste speed?


Yeap, it does and I will add this feature soon.
Edit: Added as a global for all bodies for now. I will be adding in future for given bodies aswell.

Edited by Keth, 06 September 2008 - 09:20 AM.

  • 0

#22 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 06 September 2008 - 01:47 PM

Ok, that should manage speed problems for now...
  • 0

#23 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 07 September 2008 - 11:57 PM

Okay guys, I have almost managed to create a trimesh shape.
It's really hard doing it in 2D because the shape is done in 3D.
The worst part (understanding the mesh data) is behind me.
  • 0

#24 Paper Carnival

Paper Carnival

    GMC Member

  • New Member
  • 12 posts

Posted 08 September 2008 - 11:02 AM

Nice!

I noticed a bug. When I manage to immobilize the rope, it stays fixated to its current position, even when I apply a force to it with the left and right key. Removing the bodies won't make the rope move, unless I hit it with something.

Also, a similar thing happens when I add bodies between the parts of the rope. The rope is immobilized when hanging mid-air, like this:
Posted Image

The only way to move it again is to hit it with another body.

I suppose you made the rope deactivate at certain cases to save CPU power and it doesn't become activated again when it should...

I don't suppose you figured out a fix for GM 7 yet?
  • 0

#25 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 08 September 2008 - 02:01 PM

Nice!

I noticed a bug. When I manage to immobilize the rope, it stays fixated to its current position, even when I apply a force to it with the left and right key. Removing the bodies won't make the rope move, unless I hit it with something.

Also, a similar thing happens when I add bodies between the parts of the rope. The rope is immobilized when hanging mid-air, like this:
<image>

The only way to move it again is to hit it with another body.

I suppose you made the rope deactivate at certain cases to save CPU power and it doesn't become activated again when it should...


All the objects are disabled if they aren't moving. It's possible to set the minimum force to disable the body.
physx_world_set_linear_autodisable(0.02); // minimum velocity
physx_world_set_angular_autodisable(0.02); // minimum torque

---

I don't suppose you figured out a fix for GM 7 yet?

Edit: It is supported now.

Edited by Keth, 01 May 2010 - 09:47 PM.

  • 0

#26 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 11 September 2008 - 11:14 AM

I just realized in half-way that ODE doesn't even support dynamic trimesh.

Trimesh (dynamic trimesh and trimesh-trimesh collisions are still incomplete)


So for now, I did static trimesh working.

Edited by Keth, 01 May 2010 - 09:49 PM.

  • 0

#27 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 20 September 2008 - 04:48 PM

then I don't understand you..
why you should try to make an unfinished and buggy 3d physics engine working like a 2d one?
in my opinion, that's a waste of processor time..
  • 0

#28 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 20 September 2008 - 10:43 PM

then I don't understand you..
why you should try to make an unfinished and buggy 3d physics engine working like a 2d one?
in my opinion, that's a waste of processor time..


First of all, as I said in first post it's still beta and I will be working on it so I have no idea why are you repeating it's not finished.
Secondly, you have no idea how hard it is to find really easy 2D physics DLL. Not all the games got 3D physics but 2D as well.
Thirdly, you should see games using ODE physics: http://ode.org/users.html. ODE is not that bad as you think.

The only difference between calculating 3D physics and 2D physics is additional tangent calculation which makes 3D physics a bit slower.
However, tangent is basically not used for bodies attached to plane joint.
So the physics I made has nothing to do with 3D.

btw, GMPhysics 2D is waste of time as well, isn't it? AGEIA PhysX is 3d.

p.s. New version with new examples within few minutes.

Edited by Keth, 01 May 2010 - 09:50 PM.

  • 0

#29 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14395 posts
  • Version:GM:Studio

Posted 21 September 2008 - 07:55 AM

then I don't understand you..
why you should try to make an unfinished and buggy 3d physics engine working like a 2d one?
in my opinion, that's a waste of processor time..


First of all, as I said in first post it's still beta and I will be working on it so I have no idea why are you repeating it's not finished.
Secondly, you have no idea how hard it is to find really easy 2D physics DLL. Not all the games got 3D physics but 2D aswell.
Thirdly, you should see games using ODE physics: http://ode.org/users.html. ODE is not that bad.

btw, GMPhysics is waste of time aswell, isn't it? AGEIA PhysX is 3d aswell.

p.s. New version with new examples within few minutes.


Hehehe. Actually, you can lock the z axis and make them work in 2d (like gmphysics must do). Same with gmbullet.
  • 0

#30 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 21 September 2008 - 10:20 AM

then I don't understand you..
why you should try to make an unfinished and buggy 3d physics engine working like a 2d one?
in my opinion, that's a waste of processor time..


First of all, as I said in first post it's still beta and I will be working on it so I have no idea why are you repeating it's not finished.
Secondly, you have no idea how hard it is to find really easy 2D physics DLL. Not all the games got 3D physics but 2D aswell.
Thirdly, you should see games using ODE physics: http://ode.org/users.html. ODE is not that bad.

btw, GMPhysics is waste of time aswell, isn't it? AGEIA PhysX is 3d aswell.

p.s. New version with new examples within few minutes.


Hehehe. Actually, you can lock the z axis and make them work in 2d (like gmphysics must do). Same with gmbullet.


And same with GMODE, am I wrong?
I use plane 2d joint made espescially for 2D games (it locks to Z axis) so there is no difference between GMODE, GMBullet & GMPhysics.

p.s. New update available to download (see first post).

Edited by Keth, 21 September 2008 - 10:30 AM.

  • 0

#31 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 21 September 2008 - 02:49 PM

yes, GMPhysics is the same waste of time.
It isn't hard to find a great 2d physics engine, like Box2D

ODE isn't bad, it's just not for 3d, and not finished.

The only difference between calculating 3D physics and 2D physics is additional tangent calculation which makes 3D physics a bit slower.

Oh no..
3d physics use another collision detection, moves everything in 3 dimensions.
but I don't know what tangent calculation are you talking about..
I remember tangent velocity from collision handling which is projection of the velocity vector on an edge(2d)/plane(3d) of the other body, but that is used in 2d physics simulations too.

Edited by them4n!ac, 21 September 2008 - 02:50 PM.

  • 0

#32 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 21 September 2008 - 06:01 PM

yes, GMPhysics is the same waste of time.

In my opinion GMPhysics isn't waste of time because there are lot of games using it right now on GMC.


It isn't hard to find a great 2d physics engine, like Box2D

You have no idea about physics engines. If you are going to do Box2D in Gamemaker then good luck!
Gamemaker doesn't support SDK libraries (Box2D is SDK).
Try looking for DLL physics engines which is the only way to use in Gamemaker.


ODE isn't bad, it's just not for 3d, and not finished.

The only difference between calculating 3D physics and 2D physics is additional tangent calculation which makes 3D physics a bit slower.

Oh no..
3d physics use another collision detection, moves everything in 3 dimensions.
but I don't know what tangent calculation are you talking about..

Collision detections are based on the same calculations for 2D and 3D and as I said, the only different is additional calculation for Z axis using tangent expression.
To calculate the velocity from collision handling in X axis you use sinus. Y axis you calculate cosinus. These two calculations are used in 2D physics for calculating collision.
However, in 3D physics tangent is for Z axis.

I remember tangent velocity from collision handling which is projection of the velocity vector on an edge(2d)/plane(3d) of the other body, but that is used in 2d physics simulations too.

Tangent is ONLY used for 3D projection and 3D physics. If your game has 2D physics and 2D projection then tangent is not used.

p.s. tangent calculation is 3 times slower than sinus calculation because tangent calls sinus 3 times. It depends on optimizations of physics.
tan(x) = sin(x)/cos(x)

I have no idea how to make this more clear to understand. :blink:

Edited by Keth, 21 September 2008 - 06:21 PM.

  • 0

#33 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 23 September 2008 - 07:47 PM

You look too inexperienced to make a physics dll.

In my opinion GMPhysics isn't waste of time because there are lot of games using it right now on GMC.

And it still can be faster. And that's the worst.


You have no idea about physics engines. If you are going to do Box2D in Gamemaker then good luck!

Oh no, I do have. And a lot. I've made a particle simulation with continuous collision detection so the particles never ever run behind walls with any speed.
As soon as Tutorial subforum will be opened, I'll put my ball physics example with sprite collisions using bounce function but controlling the power of friction and restitution.
But you have no idea about generic programming techniques, so you don't know how to make a Box2D DLL

Gamemaker doesn't support SDK libraries (Box2D is SDK).

SDK is Software Development Kit, not a library or something like that.
Try understanding the problem before saying "no".

Try looking for DLL physics engines which is the only way to use in Gamemaker.

[joke]Oh yeah, 2 dlls, that will be much(!!) faster!![/joke]

Collision detections are based on the same calculations for 2D and 3D and as I said, the only different is additional calculation for Z axis using tangent expression.
To calculate the velocity from collision handling in X axis you use sinus. Y axis you calculate cosinus. These two calculations are used in 2D physics for calculating collision.
However, in 3D physics tangent is for Z axis.

Do you have any idea what is sine, cosine or tangent?
http://en.wikipedia....metric_function
learn before talk such things. :D

Tangent is ONLY used for 3D projection and 3D physics. If your game has 2D physics and 2D projection then tangent is not used.

the same...
are you actually thinking what you're saying?
can you prove your words?

p.s. tangent calculation is 3 times slower than sinus calculation because tangent calls sinus 3 times. It depends on optimizations of physics.

tan(x) = sin(x)/cos(x)

why do you think that could ever happen?
tangent doesnt "call sinus" ever.

I have no idea how to make this more clear to understand. :mellow:

can't... understand.. :D

Edited by them4n!ac, 23 September 2008 - 07:48 PM.

  • 0

#34 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 23 September 2008 - 10:24 PM

tan(x) = sin(x)/cos(x)

why do you think that could ever happen?
tangent doesnt "call sinus" ever.

You sure about that?
Open the link you have said: http://en.wikipedia....metric_function
and scroll down and you will see this:
Posted Image
as I said
tan(x) = sin(x)/cos(x)
Proof:
val = random(pi)-random(pi); // any number between -3.14 and 3.14 (and not only)
calc1 = tan(val);
calc2 = sin(val)/cos(val);
// calc1 = calc2
show_message(string(calc1) + ' = ' + string(calc2)); // print out
Result 0.71 = 0.71
GM6 Example: Download proof.gm6

---


You have no idea about physics engines. If you are going to do Box2D in Gamemaker then good luck!

Oh no, I do have. And a lot. I've made a particle simulation with continuous collision detection so the particles never ever run behind walls with any speed.

Oh noes! You made particles :mellow:.
I didn't asked what you did and I have no idea why are you saying this.
You haven't explained how you would implement Box2D into Gamemaker because that was my question.

---


Gamemaker doesn't support SDK libraries (Box2D is SDK).

SDK is Software Development Kit, not a library or something like that.
Try understanding the problem before saying "no".

I didn't asked what SDK is. I said that SDK is not supported by Gamemaker and you said it is. Could you explain a bit more how you would use that?
Also, SDK Library means that SDK is used as a library imported into application using collection of subroutines.
http://www.google.co...p;q=SDK Library

---


Collision detections are based on the same calculations for 2D and 3D and as I said, the only different is additional calculation for Z axis using tangent expression.
To calculate the velocity from collision handling in X axis you use sinus. Y axis you calculate cosinus. These two calculations are used in 2D physics for calculating collision.
However, in 3D physics tangent is for Z axis.

Do you have any idea what is sine, cosine or tangent?
http://en.wikipedia....metric_function
learn before talk such things. :D

Could you be nice and explain me what I have said wrong? In my opinion I do know what I am saying and you haven't explained me why I am wrong.

---


Tangent is ONLY used for 3D projection and 3D physics. If your game has 2D physics and 2D projection then tangent is not used.

are you actually thinking what you're saying?
can you prove your words?

Yes, I do know what I am saying and if you wan't a proof then your intelligence should prove it not me.

Edited by Keth, 23 September 2008 - 10:37 PM.

  • 0

#35 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 24 September 2008 - 02:36 PM

You sure about that?
Open the link you have said: http://en.wikipedia....metric_function
and scroll down and you will see this:
Posted Image
as I said

tan(x) = sin(x)/cos(x)
Proof:
val = random(pi)-random(pi); // any number between -3.14 and 3.14 (and not only)
calc1 = tan(val);
calc2 = sin(val)/cos(val);
// calc1 = calc2
show_message(string(calc1) + ' = ' + string(calc2)); // print out
Result 0.71 = 0.71
GM6 Example: Download proof.gm6

Yes.
The results are equal but computer's processor has a different function for each math function and one is never using another.

Oh noes! You made particles :mellow:.
I didn't asked what you did and I have no idea why are you saying this.
You haven't explained how you would implement Box2D into Gamemaker because that was my question.

I would make a dll which uses it. And that's it. There's no magic.
Learn programming in C++ good, and you'll know how to do it.


Gamemaker doesn't support SDK libraries (Box2D is SDK).

- Yeah, Box2D is SDK, not a library, and not SDK Library.

Also, SDK Library means that SDK is used as a library imported into application using collection of subroutines.

Where did you find that?
http://en.wikipedia....rch/SDK_Library
not there for sure. there are 2 types of libraries which are used by executables - statically (.lib(MSVC compiler)/.a(MinGW compiler)) and dynamically linked libraries (.DLL in windows)
both are used the same way.


Could you be nice and explain me what I have said wrong? In my opinion I do know what I am saying and you haven't explained me why I am wrong.

Well, it's not my job really.. but I can try.
I'll download ODE source.
searching for "tan"
found 1 .cpp file collision_trimesh_distance.cpp
everywhere I found "tan", it was in the word "Distance" either in the name of a function or in a description of the function.
Here's your proof.
You give me your proof or I'll know that your words are nothing, just words without any knowledge about it.
  • 0

#36 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 24 September 2008 - 05:24 PM

You sure about that?
Open the link you have said: http://en.wikipedia....metric_function
and scroll down and you will see this:
Posted Image
as I said

tan(x) = sin(x)/cos(x)
Proof:
val = random(pi)-random(pi); // any number between -3.14 and 3.14 (and not only)
calc1 = tan(val);
calc2 = sin(val)/cos(val);
// calc1 = calc2
show_message(string(calc1) + ' = ' + string(calc2)); // print out
Result 0.71 = 0.71
GM6 Example: Download proof.gm6

Yes.
The results are equal but computer's processor has a different function for each math function and one is never using another.

Well, it might be as you said but it doesn't change the fact that the calculation CAN be optimized and the calculation is wrong at all.

---


Oh noes! You made particles :D.
I didn't asked what you did and I have no idea why are you saying this.
You haven't explained how you would implement Box2D into Gamemaker because that was my question.

I would make a dll which uses it. And that's it. There's no magic.
Learn programming in C++ good, and you'll know how to do it.

That changes the fact. You said "Box2D in Gamemaker" not "Box2D in Gamemaker via DLL".
Doesn't matter anyway :mellow: I do get your point now.
However, thanks for explaining.

---


Gamemaker doesn't support SDK libraries (Box2D is SDK).

- Yeah, Box2D is SDK, not a library, and not SDK Library.

Also, SDK Library means that SDK is used as a library imported into application using collection of subroutines.

Where did you find that?
http://en.wikipedia....rch/SDK_Library
not there for sure. there are 2 types of libraries which are used by executables - statically (.lib(MSVC compiler)/.a(MinGW compiler)) and dynamically linked libraries (.DLL in windows)
both are used the same way.

In Borland Delphi when you load SDK it says "Load Library".
Maybe this made you to misunderstood me.
Still, I have no idea who is right.

---


Could you be nice and explain me what I have said wrong? In my opinion I do know what I am saying and you haven't explained me why I am wrong.

Well, it's not my job really.. but I can try.
I'll download ODE source.
searching for "tan"
found 1 .cpp file collision_trimesh_distance.cpp
everywhere I found "tan", it was in the word "Distance" either in the name of a function or in a description of the function.
Here's your proof.
You give me your proof or I'll know that your words are nothing, just words without any knowledge about it.

You forgot about searching for ArcTan function which is used to calculate Z rotation axis.
Search for ATan (plane2d.cpp, collision_util.h and not only) :D
  • 0

#37 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 24 September 2008 - 05:40 PM

Well, it might be as you said but it doesn't change the fact that the calculation CAN be optimized and the calculation is wrong at all.

How? these trigonometric functions are at their maximum speed on every processor with the newest C runtime libraries.

That changes the fact. You said "Box2D in Gamemaker" not "Box2D in Gamemaker via DLL".

There's no another way :D
You're using ODE through your DLL, right?
But you could compile it into your DLL and you would get increase in speed too.

You forgot about searching for ArcTan function which is used to calculate Z rotation axis.
Search for ATan (plane2d.cpp, collision_util.h and not only) :mellow:

you were talking about "tan"
arctangent is "a different story".
the function is used to get direction as angle from a 2d vector
  • 0

#38 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 24 September 2008 - 06:17 PM

Well, it might be as you said but it doesn't change the fact that the calculation CAN be optimized and the calculation is wrong at all.

How? these trigonometric functions are at their maximum speed on every processor with the newest C runtime libraries.

I mean optimization like calling sinus once and using it for tangent because this is what I meant from the beginning.
Example:
x = degtorad(45);
sx = sin(x);
sy = cos(x);
sz = sx/sy; // instead of tan
It speeds up around 25% instead of using tan.

---



That changes the fact. You said "Box2D in Gamemaker" not "Box2D in Gamemaker via DLL".

There's no another way :D
You're using ODE through your DLL, right?
But you could compile it into your DLL and you would get increase in speed too.

That would be against the ODE GPL I think.
Adding DLL into resources of application would result combining.

---


You forgot about searching for ArcTan function which is used to calculate Z rotation axis.
Search for ATan (plane2d.cpp, collision_util.h and not only) :mellow:

you were talking about "tan"
arctangent is "a different story".

Arctan is based on the same calculations as tan does - just backward.
tan(x) = y
arctan(y) = x
1,000,000 times calling arctan takes 2.2 seconds.
Exactly same for tan.

Edited by Keth, 24 September 2008 - 06:29 PM.

  • 0

#39 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 24 September 2008 - 07:35 PM

1. don't measure performance of basic math functions in GM
2. you can't add ODE to your dll, but you can do it with Box2D :)
3. I made a test in C++
tan is still faster than both sin and cos together
1000000 function calls
time there in seconds.
Posted Image
  • 0

#40 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 24 September 2008 - 08:12 PM

1. don't measure performance of basic math functions in GM
2. you can't add ODE to your dll, but you can do it with Box2D :)
3. I made a test in C++
tan is still faster than both sin and cos together
1000000 function calls
time there in seconds.
<image cut>


1. It was a sketch code. I didn't tested it in GM just Delphi with micro time and 25% is average of 10 tests ran.
2. Well, I find ODE more precise than Box2D.
3. 0.038849 (sin float) + 0.038351 (cos float) = 0.0772
0.055449 (tan float)
so, 0.055449 / 0.0772 = 0.71825 = 28% faster.
Similar result I told in previous post. :)

Edited by Keth, 01 May 2010 - 09:58 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users