ZGameEditor forum Forum Index ZGameEditor forum
The rapid development solution with a tiny footprint. ZGE Wiki homepage.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Physics with ZGEBullet
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    ZGameEditor forum Forum Index -> Extensions
View previous topic :: View next topic  
Author Message
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Tue Nov 15, 2011 10:17 am    Post subject: Physics with ZGEBullet Reply with quote

ZGEBullet DLL is a 3D physics library for ZGE. It is created as a wrapper of the Bullet library. Bullet is a high-quality open-source collision detection and rigid body dynamics library.

I took inspiration from GMBullet DLL developed for Game Maker, however, I implemented ZGEBullet from the scratch. ZGEBullet is simpler and smaller.

ZGEBullet is still in an early development stage, ie., it is stable, working well, but incomplete. During next days and weeks (months) I'm going to add more collision shapes, more properties for rigid bodies, constraints, etc.

Attached you will find the ZGEBullet DLL and a small ZGE demo project I'm using as a testbed for the implemented features. Move with arrows, generate single objects with 1,2 or 3, generate formations of objects with 7, 8, or 9, clear the scene with Space.

Note: I decided to create a wrapper for some good physics engine because I was missing this functionality in ZGE for longer time. PAPPE integration in ZGE was interesting, but unfortunately it was excluded from the main development stream of ZGE. Even if the ZGEBullet is bigger than usual 64kb, I hope you will enjoy it in your physics-aware applications.

Any comments are welcome.

Have a fun!



Physics.zip
 Description:
ZGEBullet.dll + demo ZGE project

Download
 Filename:  Physics.zip
 Filesize:  233.51 KB
 Downloaded:  391 Time(s)



Last edited by Rado1 on Wed Nov 16, 2011 8:39 am; edited 1 time in total
Back to top
View user's profile Send private message
VilleK
Site Admin


Joined: 15 Jan 2007
Posts: 1509
Location: Stockholm, Sweden

PostPosted: Tue Nov 15, 2011 3:58 pm    Post subject: Reply with quote

Hi Rado1,

Wow, this is another impressive project of yours!

PAPPE integration could be resumed again one day if there is enough interest in it. I remember there being some problems and small bugs but I see that BeRo updated the code this year so maybe that is solved now.

On the other hand I think that physics is probably one of those features that is best implemented as an extension to a well-known physics engine just like you have done here.

Let me know if you need help. You could put the source on Google Code if you want, just like Diki did with Box2D for ZGE.

Also I'm sure this project could be made to great use in the Visualizer. We are adding features right now, let me know if you want the latest beta!



rado1_physics.jpg
 Description:
 Filesize:  60.53 KB
 Viewed:  3990 Time(s)

rado1_physics.jpg


Back to top
View user's profile Send private message Visit poster's website
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Tue Nov 15, 2011 4:30 pm    Post subject: Reply with quote

Putting source code of ZGEBullet to Google Code is a good idea. Once I achieve personal confidence with the code and sufficient feature richness I put it there. The library is still too volatile, I'm fixing and adding new features each day (or rather night).

Yes please, send me the latest beta of Visualizer.
Back to top
View user's profile Send private message
jph_wacheski



Joined: 16 Feb 2008
Posts: 980
Location: Canada

PostPosted: Tue Nov 15, 2011 5:35 pm    Post subject: Wow! Reply with quote

Very cool! I will check it out and give any feedback I come up with. Physics is a great addition to ZGE and will make many more advanced gameplay concepts much more possible.

Thanks Rado1.

_________________
iterationGAMES.com
Back to top
View user's profile Send private message Visit poster's website
keymasher



Joined: 20 Feb 2011
Posts: 39

PostPosted: Wed Nov 16, 2011 5:52 am    Post subject: Reply with quote

I love the idea of a physics engine, it always reminds me of Sumotori Dreams, I'd love to try my hand at something like that in zge.

I noticed that this requires MSCVR100.dll, some C runtime lib ~300kb
So I'm guessing it would unlikely to be easily cross-compilable for use on osx/nix zge runtimes?

I always thought PAPPE was really nifty as well, I haven't really played with it since it never took off in zge.
Back to top
View user's profile Send private message
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Wed Nov 16, 2011 7:42 am    Post subject: Reply with quote

This particular version of ZGEBullet was compiled in MSVC 2010 Express, so it is Windows-specific. However Bullet declares it can run on PLAYSTATION 3, XBox 360, Wii, PC, Linux, Mac OSX and iPhone. ZGEBullet is quite a simple wrapper which uses nothing special from Windows API; I tried to use generally written Bullet API as much as possible to avoid platform dependency. So if Bullet can be compiled on several platforms, I expect that also ZGEBullet can be. It's just a matter of compilation. But I have no experience with compiling to other platforms. Once, the source files are available, someone can try to compile it also for other platforms.
Back to top
View user's profile Send private message
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Wed Nov 16, 2011 8:49 am    Post subject: Reply with quote

I played little bit with compiler options and reduced the size of the DLL from 504 KB to 284 KB. I hope it can be even better after some more exploration of MSVC.


ZGEBullet.zip
 Description:
ZGEBullet DLL

Download
 Filename:  ZGEBullet.zip
 Filesize:  140.87 KB
 Downloaded:  340 Time(s)

Back to top
View user's profile Send private message
keymasher



Joined: 20 Feb 2011
Posts: 39

PostPosted: Wed Nov 16, 2011 9:27 am    Post subject: Reply with quote

awesome, i'll see if i can give it a go. Just read my post and sorry for being such a buzzkillington. Great work!
Back to top
View user's profile Send private message
Kjell



Joined: 23 Feb 2008
Posts: 1354

PostPosted: Wed Nov 16, 2011 11:17 am    Post subject: Reply with quote

Hi Rado1,

Nice work Smile One small ZGE related tip .. instead of using a bunch of conditions to select which Mesh to render each frame, you can simply set the to-be-rendered Mesh of a RenderMesh component directly once. So ..



.. and then use the following in the OnSpawn node.

Code:
switch(ModelShape)
{
  case 0: ModelMesh.Mesh = BoxMesh; break;
  case 1: ModelMesh.Mesh = SphereMesh; break;
  case 2: ModelMesh.Mesh = CylinderMesh; break;
}

Attached is a basic example ( spawn shapes with key 1, 2 and 3 ).

K



Shape.zgeproj
 Description:

Download
 Filename:  Shape.zgeproj
 Filesize:  3.08 KB
 Downloaded:  322 Time(s)

Back to top
View user's profile Send private message
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Wed Nov 16, 2011 12:38 pm    Post subject: Reply with quote

Yes, sure... thank you Kjell for the tip. That's why I like to share source files - learning from others.
Back to top
View user's profile Send private message
StevenM



Joined: 20 Jan 2011
Posts: 121

PostPosted: Fri Nov 18, 2011 3:15 am    Post subject: Reply with quote

Thank you!!!

I tried to get bullet workig in ZGE - It seemed impossible - and I had lot of trouble just compiling it - I hate working with SDK's. So this is really appreciated, hope we can get the source code and continue to develop this as a team - there is some great potential here. Bullet is an extraordinary and very popular physics engine - perfect choice. The fact that it is now a part of ZGE is a huge asset.
Back to top
View user's profile Send private message
jph_wacheski



Joined: 16 Feb 2008
Posts: 980
Location: Canada

PostPosted: Thu Nov 24, 2011 2:53 pm    Post subject: Reply with quote

Gave this a quick look,. it seems very usable (and powerful) so far. Just needs a few more functions to add impulses to objects, and get collisions for interactions, and we will be able to build interesting games using this.

Any updates?

_________________
iterationGAMES.com
Back to top
View user's profile Send private message Visit poster's website
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Sun Nov 27, 2011 10:51 pm    Post subject: Reply with quote

Hi all,

ZGEBullet v2 comes with the following improvements:

- New shapes: cone, capsule, and compound.
- Dynamic setting of more properties of rigid bodies: mass, restitution, hit fraction, and gravity.
- Setting position and rotation of rigid bodies.
- Getting and setting linear and angular velocity of rigid bodies.
- Applying impulses for rigid bodies.
- Constraints and limits.

The demo application has been improved by constraints - press 4 for a worm and 5 for a ragdoll, and velocity - press Enter to shoot a red sphere.

Further plans: even more shapes, collision detection (propagation to ZGE), constraint motors, enabling deactivation and sleeping thresholds, maybe also soft bodies (needs more exploration), etc.

I would really appreciate your testing. Thanks.



scr.jpg
 Description:
Screenshot
 Filesize:  58.67 KB
 Viewed:  3792 Time(s)

scr.jpg



Physics_v2.zip
 Description:
ZGEBullet.dll v2 + demo ZGE project

Download
 Filename:  Physics_v2.zip
 Filesize:  187.24 KB
 Downloaded:  342 Time(s)

Back to top
View user's profile Send private message
Rado1



Joined: 05 May 2010
Posts: 442

PostPosted: Mon Nov 28, 2011 2:02 pm    Post subject: Reply with quote

Another improvement is removing dependency on MSVCR100.dll. The size increased by 80KB, but this is probably more acceptable than installing C++ runtime libs for VS 2010.


ZGEBullet.zip
 Description:
ZGEBullet DLL v2

Download
 Filename:  ZGEBullet.zip
 Filesize:  231.14 KB
 Downloaded:  350 Time(s)

Back to top
View user's profile Send private message
Kjell



Joined: 23 Feb 2008
Posts: 1354

PostPosted: Mon Nov 28, 2011 2:34 pm    Post subject: Reply with quote

Hi Rado,

Rado1 wrote:
Another improvement is removing dependency on MSVCR100.dll. The size increased by 80KB, but this is probably more acceptable than installing C++ runtime libs for VS 2010.

This is definitely the way to go yes.

By the way, using stdcall instead of cdecl should generate a smaller dll.

+ What happened to the movable flag on AddRigidBody? I'm aware it didn't work before, so I'm guessing you've taken it out temporarily?

K


Last edited by Kjell on Mon Nov 28, 2011 6:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ZGameEditor forum Forum Index -> Extensions All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group