GLBasic forum

Main forum => Announcements => Topic started by: backslider on 2012-Feb-28

Title: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Feb-28
Hi guys,

if you love physics in 3D games, but you don't know how to implement it...
I'm writing a BulletPhysics - wrapper library for GLBasic, so you can use it without much physics knowledge!

I don't know when I will publish the lib and the functions for glbasic, but it won't take too long, I think!

In the demo are 625 falling boxes (only on Windows PC! Later for iDevices etc., I hope! :)).

Cheers

[attachment deleted by admin]
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Ian Price on 2012-Feb-28
Nice :)
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Kitty Hello on 2012-Feb-28
oh. cool. I can make my CogWork game for iOS then.
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Schranz0r on 2012-Feb-28
 <3
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Crivens on 2012-Feb-28
Excellent. Hopefully will be fast enough on mobile devices (any chance of Android and WebOS?)! Out of interest on the most simple of levels would this allow decent collision detection for complex 3D objects?

Cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: matchy on 2012-Feb-28
 :booze:
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: bigsofty on 2012-Feb-28
Wow, should be great.  :good:

I've used Bullet on iOS via iXors in the past, even compiled the static lib via GLB but it sucked ass on the iPhone. I don't think that it was Bullets fault though, the version that was used in iOS was not optimised for the platform at all and I've seen other iOS bullet examples run fine since then.
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Crivens on 2012-Feb-28
Quoteit sucked ass on the iPhone
Hopefully the newer version works better!

Cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: erico on 2012-Feb-28
Really great! chances of a video? :good:
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Feb-29
QuoteExcellent. Hopefully will be fast enough on mobile devices (any chance of Android and WebOS?)! Out of interest on the most simple of levels would this allow decent collision detection for complex 3D objects?
- Bullet should be fast enough on iOS I think, but we will see. :)
- It should work on Android and WebOS if it works on iOS.
- At the moment you can only create simple bodies like a box, sphere, cylinder, cone and a capsule but Bullet itself supports complex models! So yes, in the future it should work with complex 3D objects! ;) Maybe I will write a DDD-Import Function, so you can load your glbasic models directly. But first I have to check how to implement complex meshes!

QuoteReally great! chances of a video? :good:
In the first post is a demo program... Maybe I will record a video later. :D

Cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: erico on 2012-Feb-29
I tried it, looks wondeful.
Could you update the demo to have user controlled camera? like left/right/up/down all targeting center + zoom in/out?

Sorry the request, I´m just way excited by it.
The video would be more like a ´show the world´ kind of thing, don´t bother.

That + shadows and I would piss my pants... :-[
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Feb-29
Quote from: erico on 2012-Feb-29
I tried it, looks wondeful.
Could you update the demo to have user controlled camera? like left/right/up/down all targeting center + zoom in/out?

Sorry the request, I´m just way excited by it.
The video would be more like a ´show the world´ kind of thing, don´t bother.

That + shadows and I would piss my pants... :-[

That should be possible! ;)
I will do it later at home and update it.
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: erico on 2012-Feb-29
thanks backslider...that ought to be seen closer!
congrats for the work!

I tried changing the texture to diferent ones but it seems each cube is square mapped by that,
Idea was to get the colors of the glbasic logo there and... would ask " can anyone spot where it landed ´correctly´?"

Like I said, I´m quite excited by it, too much bullet tests on blender on this side... :good:
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Crivens on 2012-Feb-29
QuoteBullet should be fast enough on iOS I think, but we will see.
Crossing everything I have for that one! I mean it doesn't need to handle 600+ falling cubes, but fast enough for a simple enough game would be awesome!

QuoteIt should work on Android and WebOS if it works on iOS.
Nice. Sounds great if it all works out! Keep up the good work!

Cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: bigsofty on 2012-Feb-29
Quote from: backslider on 2012-Feb-29
- At the moment you can only create simple bodies like a box, sphere, cylinder, cone and a capsule but Bullet itself supports complex models! So yes, in the future it should work with complex 3D objects! ;) Maybe I will write a DDD-Import Function, so you can load your glbasic models directly. But first I have to check how to implement complex meshes!

Couldn't X_GETFACE be used to extract the mesh data, rather than write a full importer?
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Crivens on 2012-Feb-29
Obviously completely guessing here (but hey when in unknown territory might as well go for the max :happy: ), but is it possible to use the thread capability that Gernot brought up again in another thread (arf!) to make things faster? I mean putting all the physics logic behind the scenes onto another thread *should* help things out on a multi-core device right? Ok so might even make it slower on single-core devices, but practically nothing is these days really.

Cheers 
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: aroldo on 2012-Feb-29
Backslider this is very cool.
Can't wait to see the iOS and WebOS versions.

I made a video of your Windows demo and posted on You Tube.
I hope you don't mind!

Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Feb-29
Yeah cool, a video! :)
Very nice, thanks.
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Feb-29
Ok guys,

I uploaded a new version of the demo in the first post.
Now the boxes have more friction you can rotate the cam with the mouse and the world has shadows... Much nicer now! :)

Next version in a few days I hope!

cheers and have a nice evening
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: erico on 2012-Feb-29
damn it, now I have to go put my pants on the washing machine... ;)
Really great! It runs incredibly fast here.
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: mentalthink on 2012-Feb-29
When has posted this ?¿... backslider your a crack...  :nw: :nw: :nw:

It´s simply awesoming , and well another great leap in 3D in Glbasic... :blink:
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Slydog on 2012-Feb-29
 :nw:  Sooo cool!

How did you do your shadows?
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: aroldo on 2012-Mar-01
New Video.

Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Mar-01
Quote:nw:  Sooo cool!
How did you do your shadows?

Very easy... For everything in 3D in GLBasic I use the EntitySystem. And there you can use the function
Code (glbasic) Select
EntityEnableShadow(entity, TRUE) or sth. like that...

With the EntitySystem and the BulletPhysics lib you will have a really nice Engine for professional 3D games! :)

Today after work I will extend some functions and maybe I will upload a first demo project (the cubes in the first post), where you can see how the wrapper works and how you can use it with the EntitySystem.
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Mar-01
Ok guys,

I uploaded the first version of the bullet physics engine code for glbasic and the demo project.
Hope you like it! :)

You can find the stuff here...
http://www.glbasic.com/forum/index.php?topic=7757.0

Show your physics! :D

cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Slydog on 2012-Mar-01
Thanks again!

I didn't know the Entity System had shadows! 
I'll have to check that out, and see how it does it.
Too late to convert my code now, as I'm using my own system.

QuoteWith the EntitySystem and the BulletPhysics lib you will have a really nice Engine for professional 3D games! :)

Or better, build the BulletPhysics INTO the EntitySystem!
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Crivens on 2012-Mar-01
QuoteOr better, build the BulletPhysics INTO the EntitySystem!
Ooh, did anyone else get a bit of a shiver down their spine then? :) Heh, possibly after getting it on a mobile device?... But yeah would be amazing to be all built into the 3DES. And possibly on a different thread (although difficult to update objects if GL objects can't be touched on a different thread. Possibly update all physics and then 3DES updates the objects on the main thread)?...

Cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Mar-01
At the moment putting the ES and Bullet together isn't a good idea, because Bullet isn't multiplatform, yet. ;)
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Slydog on 2012-Mar-01
Oh, yeah, I forgot about physics libraries, they generally want a fixed frame rate right?  (deterministic?)
In Unity3D, they have two callback functions, one to handle the current frame, and one to handle your physics updates.  (At least this was in Unity 2)
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Mar-01
Huh?

Bullet updates in the while loop like glbasic...
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Slydog on 2012-Mar-01
Do you use 'LIMITFPS' in your demo?
If not, then either BulletPhysics isn't deterministic, or it handles the timing by itself (by skipping frames when needed?).
But keep in mind, I have no experience (or little) with physics libraries, so I may have misunderstood while learning!
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Mar-01
no, I don't use limitfps, you step the world each frame with your own timer... You will see in the code ;)
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: kanonet on 2012-Mar-01
The Bullet Engine is an EntitySystem so in my opinion its a really bad idea to use the EntitySystem+Bullet, its just not necessary and a waste of cpu power. Why you want to calculate everything two times?

just make something like that:
Code (glbasic) Select
X_MOVEMENT btGetRigidBodyPosX(self.bt),btGetRigidBodyPosY(self.bt),btGetRigidBodyPosZ(self.bt)
X_ROTATION btGetRigidBodyRoll(self.bt), 1,0,0
X_ROTATION btGetRigidBodyYaw(self.bt), 0,1,0
X_ROTATION btGetRigidBodyPitch(self.bt), 0,0,1
X_SETTEXTURE tex, tex2
X_DRAWOBJ ddd, 0

That is what this get functions are for. ;)
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Nathan on 2012-Mar-01
Quote from: backslider on 2012-Mar-01
At the moment putting the ES and Bullet together isn't a good idea, because Bullet isn't multiplatform, yet. ;)
Which platforms does this currently work with, I'm guessing Win (obviously) and being the physics library file has an ".a" extension then iOS maybe as well?
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: backslider on 2012-Mar-02
At the moment the lib is win only but Bullet is Cross platform so it will work on iOS and Linux and all other OSs...
But I have to test it. :)

Please be patient. :)

cheers
Title: Re: BulletPhysics for GLBasic... first preview! :)
Post by: Schranz0r on 2012-Mar-11
if you use the source u dont need any lib :)
Like Gernot did in Box2D!

Maybe its possible?!