Game Development Community

Bullet Vehicles in Torque Part 1

by Ron Nelson · 10/26/2009 (3:50 am) · 18 comments

Just taking a moment to show where the work deepscratch and I are with implementing Bullet physics vehicles. First off, we have started our work using the Game Mechanics Kit and are adding a ton of new stuff into it.

deepscratch has been doing massive things with adding all of the traditional Torque FX like particles, decals and explosions into the Bullet objects. The big difference is that his explosions utilize rigidbodies and have a much nicer look. I'll leave that stuff up to him to show off although it might be in future videos. He is also my Torque3D conversion guy since I don't own that yet.

I on the other hand have been doing the integration of Bullet vehicles into Torque. When I am finished, I will have added Bullet versions of wheeled vehicles, flying vehicles to include helicopters, motorcycles, hover vehicles, and finally, watercraft. I chose to start with the wheeled vehicles first since there is far more to do and I can base my work in the others from what I do with the wheeled vehicles with exceptions of course. I already modified the core vehicle class to use Bullet for its physics while maintaining the convex mesh for projectile and particle collisions.

I still ahve a few things to wrap up before I can move onto the other vehicle types. Right now I am only using a hack to simulate the wheels rotational rendering, they do not always match the Bullet wheel rotation. Also, there is tire slipping so skid marks and tire particles can work properly. Finally, if possible, I am going try to allow the triangle mesh shape type to allow for a more form fitting collision. Of course its only practicle to use that on simple vehicles.

If I get a bit more ambitious I might change the wheels into rigidbodies with a softbody option. Thats what deepscratch has been wanting me to do.

Here are a few vidoes that show my development progress. They show the problems I had along the way as well.






#1
10/26/2009 (4:02 am)
Nice work!
#2
10/26/2009 (5:53 am)
Looking good Ron.

Quote:I already modified the core vehicle class to use Bullet for its physics while maintaining the convex mesh for projectile and particle collisions.

Do you think that's a good way to approch vehicles in Torque in the future? Having an abstracted interface which the Torque vehicle calls which can be implemented differently for PhysX, Bullet, Havok?
#3
10/26/2009 (12:06 pm)
Very very interesting work Ron.

I wait for Bullet in the near future to be implemented directly into T3D, and seeing Tom looking at this post comfort me in this.

Nicolas Buquet
www.buquet-net.com/cv/
#4
10/26/2009 (8:14 pm)
I always thought P.A.L was a nice idea but I've never had the time to really check it out.
#5
10/26/2009 (8:41 pm)
Nice Ron ... glad you overcame the problems in the beginning. :)
#6
10/26/2009 (10:10 pm)
Very nice!
#7
10/27/2009 (5:58 am)
Thanks everyone.

@Tom - Yes I really do think using the abstracted interface is for the best. Each physics engine has a variety of stong and weak points that having it this way allows the game designer to choose which works best for them.

The way I have this right now allows the same dummy methods as used throughout the GMK. So implementation of the other physics engine types would be possible.

After I knock a couple more things out there should be more to show soon.
#8
12/01/2009 (3:11 am)
This looks great, the last video looks like a ton of fun! Does this work networked? I'm working on implementing Bullet vehicles in TGEA specifically for networked multiplayer and it seems like you've already done a lot of that!

I'd be more than happy to help figure out issues and implement more vehicle types too.

I implemented ODE vehicles a while ago but we only used it for a local simulation. Worked out great and was a lot of fun to crash into AI vehicles and objects but we never approached the networking side of things.

If you're not willing to share source, could you comment on how you did the network updating?

Thanks!
#9
12/01/2009 (6:08 am)
Luigi, yes it is networked and I have tested it in multiplayer. Can I share it? No because my work is based on the GMK and that would be a legal no no.
#10
12/01/2009 (8:33 am)
Ah I see there's a GMK dependency. Is it legal to share with other GMK owners? I'd be more than happy to pick it up :-)
#11
12/01/2009 (9:50 am)
Legal, yes. For sale yet, and yes I do mean for sale, not free this time, no. This one has been far too much work to give away freely.
#12
12/01/2009 (9:55 am)
Cool sounds good, look forward to when you make it available!
#13
12/15/2009 (2:38 pm)
Hi Ron.

You did very nice work with Deepscratch, I agree your impressive work
has to be paid. Can you share an approximate release date of the
add-on(at least alpha or beta version) and price?

You mentioned abstract layer for physics and i hope it will be not
hard to use PhysX instead of Bullet.

So it is exactly what i need.

Can we get it before New Year :-) ?

Thanks.
#14
12/15/2009 (9:33 pm)
OK no idea on a date. You have to understand game development is a side-line for me right now as I am still active duty in the military and going to college to finish my Master's degree. So I do this in my spare time.

As for price, well that remains to be seen depending upon what I am able to accomplish.

Finally, its probably not going to happen for PhysX for an extremely good reason. Unlike PhysX, Bullet actually has a vehicle system in its libraries that has wheel objeccts. One of the core problems I have seen with many other programmers using vehicles is how to do wheels. With Bullet I could even make them softbodies and it would work.
#15
12/15/2009 (10:19 pm)
I meant for us to implement PhysX or even Havok via abstract physics layer :-) We are using NxWheel in PhysX, very easy thing too, with all tuning stuff inside.

Need for Speed: Shift uses PhysX(maybe improved, do not know exactly).

But, of course, bullet does not need any registration,System Software and not bad at all.

It was just thoughts :-)

Waiting for this release!

#16
01/16/2010 (3:11 pm)
Quote:Do you think that's a good way to approch vehicles in Torque in the future? Having an abstracted interface which the Torque vehicle calls which can be implemented differently for PhysX, Bullet, Havok?

Coming in a bit late here, but that seems like the best possible solution to me. I'm glad getting vehicles working in a more stable physics solution is still on the list somewhere, I was afraid the PhysX work might stop at props and breakables! The Rigid class was functional for its time, but even the T2 devs knew it was a problem then (making vehicles that always float above the ground, totally commenting out vehicle->vehicle collision solving, overdoing the collision damage scale, keeping them slow, etc.).

I'm currently working on converting the standard Torque vehicle model to use Bullet in the most haphazard, disfunctional way possible. What you're doing certainly looks like a more thought out and advanced project, and I think it's very reasonable that you'd hope to get some compensation for the work.

I parented Vehicle to an existing GMK Bullet object because said object came from ShapeBase. Yeah, I know, welcome to the 9th circle of bloat. Then I set to work removing every trace of Rigid and replacing it with the appropriate calls to my parent class's physics. I've had some luck, more with flyingVehicle than anything, but I'm still currently in the "removing large chunks of my own hair" phase of the project. My goals are a good deal less exciting, too: I'm still using Torque's super unrealistic flyingVehicle physics model, just replacing Rigid with a Bullet object, and I'll be doing the same for wheeledVehicle (sticking with fake, inaccurate simulated wheels).

Technically, Torque's Tribes-style flying vehicles actually fit my game design, but I think we'd all be excited to see "realistic" vehicles types as a possibility.

Here's hoping you guys finish this and can sell me a better solution than my cheap hacks. ;)
#17
01/17/2010 (3:10 am)
Well I have to admit for the most part my solution to the flying vehicle and hover vehicle is much like you describe with a couple of exceptions. The wheeled vehicle however is a much different story. I would say about 95% of the updateForces function has been replaced.
#18
01/19/2010 (11:36 pm)
Well, that's the bit that really got my attention. Torque's old simulated wheels system was prone to a good amount of error (not to mention it wasn't exactly a realistic sim) which would result in things like the vehicle not ever being able to travel in a straight line without the user constantly guiding it. Anyone building a game with driving as one of the focuses isn't likely to find that system satisfying.

Anyway, it looks like those are actual Bullet wheels, though I could be wrong. They're interacting very convincingly with the ground, I'm certain I actually saw a wheel bounce up into the air in the video (totally impossible with WheeledVehicle's raycast-based wheels).