| View previous topic :: View next topic |
| Author |
Message |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Tue Nov 15, 2011 10:17 am Post subject: Physics with ZGEBullet |
|
|
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!
| Description: |
| ZGEBullet.dll + demo ZGE project |
|
 Download |
| Filename: |
Physics.zip |
| Filesize: |
233.51 KB |
| Downloaded: |
295 Time(s) |
Last edited by Rado1 on Wed Nov 16, 2011 8:39 am; edited 1 time in total |
|
| Back to top |
|
 |
VilleK Site Admin

Joined: 15 Jan 2007 Posts: 1438 Location: Stockholm, Sweden
|
Posted: Tue Nov 15, 2011 3:58 pm Post subject: |
|
|
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!
| Description: |
|
| Filesize: |
60.53 KB |
| Viewed: |
2371 Time(s) |

|
|
|
| Back to top |
|
 |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Tue Nov 15, 2011 4:30 pm Post subject: |
|
|
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 |
|
 |
jph_wacheski

Joined: 16 Feb 2008 Posts: 965 Location: Toronto Canada
|
Posted: Tue Nov 15, 2011 5:35 pm Post subject: Wow! |
|
|
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 |
|
 |
keymasher
Joined: 20 Feb 2011 Posts: 39
|
Posted: Wed Nov 16, 2011 5:52 am Post subject: |
|
|
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 |
|
 |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Wed Nov 16, 2011 7:42 am Post subject: |
|
|
| 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 |
|
 |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Wed Nov 16, 2011 8:49 am Post subject: |
|
|
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.
| Description: |
|
 Download |
| Filename: |
ZGEBullet.zip |
| Filesize: |
140.87 KB |
| Downloaded: |
248 Time(s) |
|
|
| Back to top |
|
 |
keymasher
Joined: 20 Feb 2011 Posts: 39
|
Posted: Wed Nov 16, 2011 9:27 am Post subject: |
|
|
| 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 |
|
 |
Kjell

Joined: 23 Feb 2008 Posts: 1293
|
|
| Back to top |
|
 |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Wed Nov 16, 2011 12:38 pm Post subject: |
|
|
| Yes, sure... thank you Kjell for the tip. That's why I like to share source files - learning from others.
|
|
| Back to top |
|
 |
StevenM
Joined: 20 Jan 2011 Posts: 121
|
Posted: Fri Nov 18, 2011 3:15 am Post subject: |
|
|
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 |
|
 |
jph_wacheski

Joined: 16 Feb 2008 Posts: 965 Location: Toronto Canada
|
Posted: Thu Nov 24, 2011 2:53 pm Post subject: |
|
|
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 |
|
 |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Sun Nov 27, 2011 10:51 pm Post subject: |
|
|
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.
| Description: |
|
| Filesize: |
58.67 KB |
| Viewed: |
2173 Time(s) |

|
| Description: |
| ZGEBullet.dll v2 + demo ZGE project |
|
 Download |
| Filename: |
Physics_v2.zip |
| Filesize: |
187.24 KB |
| Downloaded: |
254 Time(s) |
|
|
| Back to top |
|
 |
Rado1

Joined: 05 May 2010 Posts: 318
|
Posted: Mon Nov 28, 2011 2:02 pm Post subject: |
|
|
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.
| Description: |
|
 Download |
| Filename: |
ZGEBullet.zip |
| Filesize: |
231.14 KB |
| Downloaded: |
244 Time(s) |
|
|
| Back to top |
|
 |
Kjell

Joined: 23 Feb 2008 Posts: 1293
|
Posted: Mon Nov 28, 2011 2:34 pm Post subject: |
|
|
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 |
|
 |
|