Jump to content


Photo

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


  • Please log in to reply
80 replies to this topic

#1 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 03 September 2008 - 06:19 PM

Posted Image
GMODE is 2D physics library based on ODE (Open Dynamic Engine) physics.

Follow progress on Twitter here.

UPCOMING FEATURES IN GMODE V2.0!
Contact me (MSN/PM) if you would like to test the alpha before v2.0 gets released as beta.
  • [DONE] Whole code will be rewritten (C++ this time) and physics will be based on newest ODE svn version
  • Proper documentation of all functions
  • [DONE] Cleaner, easier to use code
  • [DONE] All ODE functions are compiled inside GMODE.dll. This means ODE.dll will no longer be used separately.
  • [DONE] All memory leaks are fixed (not a single leak of a byte with 3000 bodies and constant flow of them)
  • [DONE] Huge speed improvements (around 410% faster comparing the older version of GMODE)
  • Collision layers between bodies
  • [DONE] Realistic fluids simulation example (see videoes below for an example)
  • [DONE] Stiffness and repulsion of each particle body (with the right settings, you can re-create particle movement such as water, sand, mochi, tensile, smoke, fire, air, etc)
    Example: http://www.youtube.c...h?v=BIjSvkT8nKk
    Stress Test: http://www.youtube.c...h?v=yoV9N8Yw3pI (the performance will still keep improving)
  • [DONE] 100% Stability guaranteed as long as large forces/frictions aren't applied
  • [PROGRESS] Multi-threading is the thing I am focusing on mostly (has been over 2 weeks) and it seems to be going well (significant speed
    improvements)
  • Wiggling particles (just to add some realism - e.g. for sparks)
  • Dynamic convex/concave shapes - will be implemented in late testing
  • Blob bodies, destructible bodies and meltable bodies - those are pretty much future plans and considering the performance none of those are going to be a problem
  • Bugs? Suggestions?
  • Breakable joints?
NEW! Features v0.50b:
  • Support for Gamemaker 7 and 8 (GM6 version will no longer be updated - you can use old one though)
  • Cleaner function names (few got renamed)
  • New arguments for physx_start and physx_body_update
Features v0.30:
  • Trimesh avaible (static only)
  • New examples (motor and playground)
  • Lots of new functions (damping, max rotation, pausing physics, fixed step etc)
  • New line shape which can be used as terrain aswell
  • Minor optimizations
Features v0.26:
  • New functions
  • Up to 50% faster (only while having more than 100 bodies)
  • Joints added (fixed, hinge and slider)
Features v0.2 Beta:
  • Realistic rigid-bodies
  • Really simple to use
  • Find out exact collision points
  • Disable or enable collision between given bodies
  • and more...

Keep in mind this is just a beta. I did not focus on the features but stability and speed.
Upcoming versions will include lots of speed improvements.

Please report all the bugs and post suggestions for next release!

Screenshots:
Posted Image

Posted Image

Links:

For Gamemaker 7.0+ (GEX):
Posted Image
Link dead? http://www.mediafire.com/?immqymnz24e

For any other language e.g. C++ (DLL only):
Click here to download!

Old version of GMODE v0.30 for Gamemaker 6.0 (DLL):
Posted Image

Edited by Keth, 11 July 2010 - 03:37 PM.

  • 0

#2 posva

posva

    GMC Member

  • New Member
  • 610 posts
  • Version:GM8

Posted 03 September 2008 - 06:50 PM

if it don't work with GM 7 i can't try it :lol:
  • 0

#3 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 03 September 2008 - 07:05 PM

if it don't work with GM 7 i can't try it :lol:


The EXE file attached inside the archive will work.
You just won't be able to compile gm6 file.
  • 0

#4 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 03 September 2008 - 08:35 PM

Wow, I've heard people say that GM can't handle 100 physical objects and maintain FPS. You had more. Great work.

I really think it can use a fix for GM7 but it's fine for me.

Edited by GMREC1111, 03 September 2008 - 08:36 PM.

  • 0

#5 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 03 September 2008 - 09:27 PM

Wow, I've heard people say that GM can't handle 100 physical objects and maintain FPS. You had more. Great work.

I really think it can use a fix for GM7 but it's fine for me.


Thanks for the support!
GM7 is supported now.

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

  • 0

#6 Newly Discovered

Newly Discovered

    Harmonious Genius

  • GMC Member
  • 2475 posts
  • Version:GM8

Posted 03 September 2008 - 09:32 PM

neat, but you have a long way to go if you're attempting a full engine. two shapes that roll around isn't going to cut it.
good luck.
  • 0

#7 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 03 September 2008 - 11:13 PM

I have tried to optimize the physics using packed data (1 call per step for all bodies) but parsing the long string containing x,y,rotation for 100 bodies is a lot slower.
The Gamemaker isn't that fast in long string handling.

I guess this is the fastest way possible to do physics in Gamemaker.
The only things left now are features I will work as soon as I will find some free time.

Edit: I managed to optimize it 50% faster in 0.26 version.
See physx_body_update script for details.

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

  • 0

#8 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Member
  • 15786 posts
  • Version:GM:Studio

Posted 03 September 2008 - 11:59 PM

I have tried to optimize the physics using packed data (1 call per step for all bodies) but parsing the long string containing x,y,rotation for 100 bodies is a lot slower.
The Gamemaker isn't that fast in long string handling.

I guess this is the fastest way possible to do physics in Gamemaker.
The only things left now are features I will work as soon as I will find some free time.



Refer to the bullet dll thread for tips on how to bypass GM's API speed issues.


I get an Unexpected Error. Under GM7 and Vista.
  • 0

#9 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 04 September 2008 - 01:16 AM

I have tried to optimize the physics using packed data (1 call per step for all bodies) but parsing the long string containing x,y,rotation for 100 bodies is a lot slower.
The Gamemaker isn't that fast in long string handling.

I guess this is the fastest way possible to do physics in Gamemaker.
The only things left now are features I will work as soon as I will find some free time.



Refer to the bullet dll thread for tips on how to bypass GM's API speed issues.

Thanks about the speed issue information. I think this might be faster way.

I get an Unexpected Error. Under GM7 and Vista.

GM7 supported now.

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

  • 0

#10 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 04 September 2008 - 10:22 AM

I see you've come to a good start, it's nice and simple. Just needs more predefined shapes and custom defining of shapes.
  • 0

#11 OpticalLiam

OpticalLiam

    GMC Member

  • New Member
  • 782 posts

Posted 04 September 2008 - 01:45 PM

Very nice work, I managed to get around 450 circles before it started to dip below 100FPS. Now you need to add support for rigid bodies of any shape.
  • 0

#12 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 04 September 2008 - 07:35 PM

Can you also fix the counter, it doesn't reset. Use instance_count(object) to get it or reset each time you hit R.
  • 0

#13 fire_soul453

fire_soul453

    aarons video games

  • GMC Member
  • 542 posts

Posted 05 September 2008 - 01:59 AM

Pretty cool. Might be useful once you update it more. Keep working on it.
  • 0

#14 ShaX

ShaX

    GMC Member

  • New Member
  • 246 posts

Posted 05 September 2008 - 04:15 AM

Ah, excellent! I am a very big fan of the ODE engine and use it almost exclusively in my developments. Steffen Itterheim has ported almost the entire ODE library to Game Maker back in 2004, and that's what I've been using since, but there are many flaws and/or errors with his dll and, well, he really doesn't come around here any more. So I look forward to your implementation and will be checking up for future updates frequently. Best of luck!
  • 0

#15 Paper Carnival

Paper Carnival

    GMC Member

  • New Member
  • 12 posts

Posted 05 September 2008 - 08:59 AM

This is amazing. Great job! I'll want to use it for my game, so I'm anxiously waiting for GM7 compatibility.

Edit: Can we apply a force to a specific object, or create explosion effects, etc? Or is that a feature to be implemented later?

Also, if possible, I'd suggest more options on how to dynamically affect the ODE "world" through Game Maker (eg set the x, y and rotation of a material).

Edited by Paper Carnival, 05 September 2008 - 09:10 AM.

  • 0

#16 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 05 September 2008 - 09:34 AM

please fix the memory leaks! ;)
Posted Image

EDIT:
and why there's PhysX?
that's a copyrighted trademark, you can't use it like this ^_^

Edited by them4n!ac, 05 September 2008 - 09:35 AM.

  • 0

#17 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 05 September 2008 - 01:46 PM

please fix the memory leaks! ;)
<image>

EDIT:
and why there's PhysX?
that's a copyrighted trademark, you can't use it like this ^_^


Damn, I totally forgot about checking memory leaks.
Thanks for information!

About PhysX, On the beggining I've been doing AGEIA PhysX with those functions but then I changed to ODE because doing 2D in PhysX was a lot harder.
Now there is a lot of changing but I'm sure that AGEIA doesn't mind :D

Edit:
There is no memory leak. My memory usage for rigid_bodies.exe is static after creating 200 bodies (15,536 and doesn't change for 5 minutes).
Have you been adding new bodies while the graph was going up?

Edited by Keth, 05 September 2008 - 01:52 PM.

  • 0

#18 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 05 September 2008 - 03:22 PM

Delete the bodies, and you'll see the leak. ;)
Memory allocation doesn't make the leak if that memory is freed after usage. ^_^

Edited by them4n!ac, 05 September 2008 - 03:22 PM.

  • 0

#19 Keth

Keth

    GMC Member

  • New Member
  • 164 posts

Posted 05 September 2008 - 03:25 PM

Delete the bodies, and you'll see the leak. ;)
Memory allocation doesn't make the leak if that memory is freed after usage. ^_^


Oh, thanks for information.
Will be fixed in next release.
  • 0

#20 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 06 September 2008 - 02:50 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?
  • 0

#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

  • GMC Member
  • 15786 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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users