Zero Gear - Kart racing game using Bullet

Show what you made with Bullet Physics SDK: Games, Demos, Integrations with a graphics engine, modeler or any other application
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Zero Gear - Kart racing game using Bullet

Post by Murphy »

Image

I am the programmer for Zero Gear and I felt it was time to show our project on the Bullet forums. We released a video a few days ago showing some gameplay which we used Bullet to create.

Here is our blog:
http://nimblebit.blogspot.com/

And here is a direct (higher quality) link to the video that shows bullet being used:
http://www.vimeo.com/634940
michaelth
Posts: 21
Joined: Mon Oct 22, 2007 12:47 pm

Re: Zero Gear - Kart racing game using Bullet

Post by michaelth »

Wow,nice work.Have a online version? I have made a network version for Kart game just like this.
michaelth
Posts: 21
Joined: Mon Oct 22, 2007 12:47 pm

Re: Zero Gear - Kart racing game using Bullet

Post by michaelth »

But your Kart seems not so cool as SuperTuxKart(our verison).
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

michaelth wrote:Have a online version?
Networking is planned.
michaelth wrote:But your Kart seems not so cool as SuperTuxKart(our verison).
Then choose a different kart: http://www.vimeo.com/448510
michaelth
Posts: 21
Joined: Mon Oct 22, 2007 12:47 pm

Re: Zero Gear - Kart racing game using Bullet

Post by michaelth »

your track is nice.
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

New networked physics video:

Image
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

Image

In this video we are using a “Tag” type game mode as an intitial test of our gameplay scripting system. Using the experience from this we will design bigger and more exciting gameplay!

In this mode, players compete for the longest amount of time being "IT". The longer you are "IT" the more points you rack up. There is also a 3 second immunity after you have become "IT". For this level, we also made points accumulate faster the closer you are to the middle, to encourage people to duke it out in the middle ring.

The test was a lot of fun, and gave us a lot of ideas and feedback for how we are going to implement more gameplay features in the near future!
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

New video! This one shows off in-game sounds, items, and our new gameplay mode: Fallout

Image
adam23
Posts: 3
Joined: Sun Jun 15, 2008 4:16 pm

Re: Zero Gear - Kart racing game using Bullet

Post by adam23 »

I've been following this game for a long time, and its really looking good.

Are there any plans on revealing how you setup your vehicle physics using Bullet, even just some advice?

Adam Larson
Game Programmer
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

Setting up the vehicle actually took a lot of time and tuning. It is basically the raycast vehicle that comes with bullet but with alot of additional functionality on top of it.

I would be happy to answer any questions related to it but it would be hard to provide all the code as it is split between client/server code and multiple .h/.cpp/.lua files throughout the project.
adam23
Posts: 3
Joined: Sun Jun 15, 2008 4:16 pm

Re: Zero Gear - Kart racing game using Bullet

Post by adam23 »

That would be really great, I have been fighting with setting up vehicles for quite a while now. I hope I don't overwhelm you with to many questions.

So basically right now this is the process we use to pull Karts in. The car is exported from MAX with a skeleton used to position the tires.

The main issues I have right now are these.

-The Kart tips over very easily.
-Steering is all or nothing, ( meaning I can't seem to get the smooth Mario Kart like turns around corners, instead it seems like a tire lifts off of the track and spins the car ).


Do you guys use OgreBullet to handle your physics? I'm guessing no because in the 6 weeks i've been using it i've already found quite a few bugs.

How do you get your karts so low to the ground, are you offsetting the position of the mesh from the collision box? Anytime I lower the box closer to the road, the box will hit parts of the road ( especially when going up a ramp or anything similar ).

Are you using just a bounding box for the car, or do you use something else?

How do you make your suspension almost non-existent ( at least from what i've seen in the videos )? This is exactly the effect i'm looking to achieve? Meaning your tires don't seem to move up and down at all. I've got the suspension stiffness variable set pretty high, but that doesn't seem to accomplish it.

Are your vehicles front wheel, rear wheel, or 4 wheel drive?

What is the average mass your using for vehicles ( i've seen 250 - 800 used in demos )?


I guess my main problem right now is keeping all 4 tires on the road, which would probably improve the control around turns as well.

Thanks
Adam
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

First of all, I'll just paste my general setup here for reference:

Code: Select all

centerOfMass = btVector3(0.f, 0.3f, 0.08f);

btCollisionShape * chassisShape = new btBoxShape(btVector3(0.5f, 0.2f, 0.625f));
btCompoundShape * compound = new btCompoundShape();
btTransform localTrans;
localTrans.setIdentity();
//localTrans effectively shifts the center of mass with respect to the chassis
localTrans.setOrigin(centerOfMass);

compound->addChildShape(localTrans, chassisShape);

btTransform tr;
tr.setIdentity();
tr.setOrigin(btVector3(0, 0, 0));

carChassis = CreateRigidBody(tr, compound, GetMotionState());
carChassis->setDamping(0.2f, 0.2f);
adam23 wrote:The Kart tips over very easily.
We use a low center of mass along with a Roll Influence value of 1.
adam23 wrote:Steering is all or nothing
Are you changing your steering value over time or directly setting it upon a key press? You need to make sure the turning happens over time (just like a real car).
adam23 wrote:Do you guys use OgreBullet to handle your physics?
No, I wrote my own wrapper as we needed to simulate most of the physics on the server which doesn't have any concept of Ogre.
adam23 wrote:How do you get your karts so low to the ground
This was just a matter of tweaking the suspension and mass until it looked and felt right.
adam23 wrote:Anytime I lower the box closer to the road, the box will hit parts of the road ( especially when going up a ramp or anything similar ).
Try stiffening your suspension I suppose. We had the same problem when the kart hit a ramp too fast. To fix this we designed our ramps on a curve instead of a hard angle.
adam23 wrote:Are you using just a bounding box for the car
Yep. btCollisionShape * chassisShape = new btBoxShape(btVector3(0.5f, 0.2f, 0.625f));
adam23 wrote:How do you make your suspension almost non-existent
It actually does exist and is necessary to give the whole thing some damping upon landing from a ramp, etc. It isn't visible on the client because I don't send the wheel positions over the network. It was determined to be too much data to transfer for something that isn't even expected on a kart type vehicle.

Here are the suspension values we use:
SuspensionStiffness = 100
SuspensionDamping = 20
SuspensionCompression = 4.2
SuspensionRestLength = 0.3
(Note: these values are most likely dependent on other values such as mass)
adam23 wrote:Are your vehicles front wheel, rear wheel, or 4 wheel drive?
2 rear wheel drive.
adam23 wrote:What is the average mass your using for vehicles
We use 400 now for all our karts.

Hope the info helps. Good luck! :)
adam23
Posts: 3
Joined: Sun Jun 15, 2008 4:16 pm

Re: Zero Gear - Kart racing game using Bullet

Post by adam23 »

-We do apply steering values based on time.

Its interesting that you use a set box size for your karts, that may be one of the issues I am having. I was generating based on the mesh size of the car.

That helps immensly, thanks a ton!
hiker
Posts: 83
Joined: Tue Oct 24, 2006 11:52 pm
Location: Australia

Re: Zero Gear - Kart racing game using Bullet

Post by hiker »

Just a quick question:
Are you using just a bounding box for the car
Yep. btCollisionShape * chassisShape = new btBoxShape(btVector3(0.5f, 0.2f, 0.625f));
In SuperTuxKart I am having a really hard time defining the physics parameters for all our karts - some karts keep on toppling over, don't accelerate properly, sometimes even sink into the ground. The main reason appears to be that all our models have a different size and therefore a different bounding box (which we use for the kart chassis) - I am running out of ideas short of tweaking each model separately. How are you handling this?
  • Do you use the same box shape for each model, indepent of the graphics model size?
  • If yes, what do you do about graphical glitches (e.g. if the graphic model is smaller, you might get a collision in the physics model, but not in the graphics)? Or are you in the lucky position that all your karts have (roughly) the same size?
  • If not, do you modify the physics parameters for each kart? Or did you try to use one rigid body for the physics, and 'surround' it with a collision shape (not even sure if this works in bullet)? I.e. forces etc. act on the physics body, but collisions are detected via the larger collision shape around it?
  • Or anything else?
Cheers,
Joerg
~
~
~
Murphy
Posts: 32
Joined: Fri Aug 31, 2007 6:36 am

Re: Zero Gear - Kart racing game using Bullet

Post by Murphy »

Things have changed quite a bit since I last posted in this thread. We are now using a convex hull for our kart physics shape.

The reason for this change was mainly because we wanted the kart to bounce off surfaces in a different way. We wanted more curvature to the kart's body than a simple box provides. We also put a small "hump" at the top of the shape and as a result, the kart doesn't get stuck upside down anymore :)

We use the same physical shape for all karts regardless of graphics. The physical kart is only on the server so doesn't even know that graphics exist. We have then just tweaked all the different variables of the kart (and still tweak every week in some way) until it generally feels right. It is enough effort to tweak one kart type, we didn't want to complicated things by tweaking each and every graphical kart. There are some minor graphical glitches I suppose but nothing I notice and nothing that gets in the way of enjoying the game at least.