3D Physics with ZgeBullet
Moderator: Moderators
3D 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!
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!
- Attachments
-
- Physics.zip
- ZGEBullet.dll + demo ZGE project
- (233.51 KiB) Downloaded 1346 times
Last edited by Rado1 on Mon Jun 08, 2015 9:09 pm, edited 2 times in total.
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!
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!
- Attachments
-
- rado1_physics.jpg (60.53 KiB) Viewed 54786 times
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.
Yes please, send me the latest beta of Visualizer.
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
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.
Thanks Rado1.
iterationGAMES.com
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.
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.
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.
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.
- Attachments
-
- ZGEBullet.zip
- ZGEBullet DLL
- (140.87 KiB) Downloaded 1221 times
Hi Rado1,
Nice work
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 ..
![Image](http://i.imgur.com/C1QtL.png)
.. and then use the following in the OnSpawn node.
Attached is a basic example ( spawn shapes with key 1, 2 and 3 ).
K
Nice work
![Smile :)](./images/smilies/icon_smile.gif)
![Image](http://i.imgur.com/C1QtL.png)
.. and then use the following in the OnSpawn node.
Code: Select all
switch(ModelShape)
{
case 0: ModelMesh.Mesh = BoxMesh; break;
case 1: ModelMesh.Mesh = SphereMesh; break;
case 2: ModelMesh.Mesh = CylinderMesh; break;
}
K
- Attachments
-
- Shape.zgeproj
- (3.08 KiB) Downloaded 1212 times
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.
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.
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
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.
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.
- Attachments
-
- Physics_v2.zip
- ZGEBullet.dll v2 + demo ZGE project
- (187.24 KiB) Downloaded 1206 times
-
- Screenshot
- scr.jpg (58.67 KiB) Viewed 54588 times
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.
- Attachments
-
- ZGEBullet.zip
- ZGEBullet DLL v2
- (231.14 KiB) Downloaded 1187 times
Hi Rado,
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
This is definitely the way to go yes.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.
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.