ODE Physics
by OtakuNoZoku · in Torque Game Engine · 12/14/2004 (5:10 pm) · 17 replies
Currently I have a game in development making use of Ogre3D and ODE physics. The physics of the game are an integral part of the gameplay (actually, I could fake the physics but ODE is an "ideal" solution and if I believed in re-inventing the wheel then I wouldn't be making use of 3rd party SDK's and engines).
My initial reaction was to go with TGE but the programmer who I assigned to the project didn't feel comfortable so we looked around for other "low-budget" solutions.
The project is in its early stages but is starting to get a bit behind on the prototype.
It's not too late in the development cycle to switch to TGE which is something I'm contemplating. I've read through all the resources & forum threads on integrating ODE into TGE but was wondering what the REAL state of integration is. This is the most active resource on the subject:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5024
but unfortunately there is also a lot of noise in there. Time for someone to clean up the resource? I'd like to get ODE into TGE but I also don't have time myself and I don't think the programmer on the project is knowledgable enough with TGE & ODE to do the integration himself in any reasonable time frame without a good resource pointing the way.
Is there __anyone__ out there who has successfully achieved full ODE integration? i.e. It isn't a "90%" solution. Can you please let me know if you have achieved this?
I didn't post this comment at the end of the resource as that is already quite noisy.
My initial reaction was to go with TGE but the programmer who I assigned to the project didn't feel comfortable so we looked around for other "low-budget" solutions.
The project is in its early stages but is starting to get a bit behind on the prototype.
It's not too late in the development cycle to switch to TGE which is something I'm contemplating. I've read through all the resources & forum threads on integrating ODE into TGE but was wondering what the REAL state of integration is. This is the most active resource on the subject:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5024
but unfortunately there is also a lot of noise in there. Time for someone to clean up the resource? I'd like to get ODE into TGE but I also don't have time myself and I don't think the programmer on the project is knowledgable enough with TGE & ODE to do the integration himself in any reasonable time frame without a good resource pointing the way.
Is there __anyone__ out there who has successfully achieved full ODE integration? i.e. It isn't a "90%" solution. Can you please let me know if you have achieved this?
I didn't post this comment at the end of the resource as that is already quite noisy.
About the author
#2
12/14/2004 (5:39 pm)
Okay, I'll take a look at that. Definitely looks interesting just from the screen shots. This will teach me to pay more attention to what other people are doing rather than getting too deep in to programming. ;-)
#3
12/15/2004 (10:54 am)
So is Rocketbowl is using ODE?
#4
12/15/2004 (11:34 am)
Yes... Large Animal is using ODE for the pin action.
#5
12/15/2004 (11:52 am)
Another game engine that uses ode is http://www.3impact.com
#6
12/15/2004 (12:05 pm)
Does Rocketbowl have multiplayer support?
#7
12/15/2004 (5:52 pm)
@ Owen Yes. As far as I know.
#8
I'm having trouble with my ODE integration right now on small objects. The objects are like boxes about 0.5 units thick in each direction. They penetrate each other like no tomorrow and always get stuck together, especially when you drop them on each other. For big crates at like 2 unit thickness it works fine, though. I know the ODE docs mentioned something about it's integrator not working good for small vaules, so I can't tell if these errors are popping up because the numbers are too small for ODE, or if the resource is passing in bad contact info.
It be interesting to find out what scale the RocketBowl objects are at.
Also, with the timestep, has anyone experimented at changing it from the tick value of 0.032? Can ODE get more accurate if it runs twice a tick with a smaller timestep? If you do that, how do make sure the contact information is updated inbetween ticks?
12/17/2004 (6:08 am)
I played the demo but didn't see any multiplayer mode, just challenges against AI. It seems to have an online ranking system, though. Pretty fun game!I'm having trouble with my ODE integration right now on small objects. The objects are like boxes about 0.5 units thick in each direction. They penetrate each other like no tomorrow and always get stuck together, especially when you drop them on each other. For big crates at like 2 unit thickness it works fine, though. I know the ODE docs mentioned something about it's integrator not working good for small vaules, so I can't tell if these errors are popping up because the numbers are too small for ODE, or if the resource is passing in bad contact info.
It be interesting to find out what scale the RocketBowl objects are at.
Also, with the timestep, has anyone experimented at changing it from the tick value of 0.032? Can ODE get more accurate if it runs twice a tick with a smaller timestep? If you do that, how do make sure the contact information is updated inbetween ticks?
#9
12/17/2004 (6:12 am)
ODE seems to be very prone to issues with object sizes and mass. Even though it's closed source i've been leaning towards using Newton (http://www.newtondynamics.com/) in our projects.
#10
12/17/2004 (12:39 pm)
Drew: How difficult was your integration? Is it completed? Even in single-player mode? Care to share your thoughts and code?
#11
To answer some of the ODE & RocketBowl questions:
1. RB does not have multiplayer. This was partly to do with the difficulty of implementing ODE in a multiplayer situation (i.e. needing to revise how interpolation is done client side, probably) There is no reason you couldn't do it, just that you would need to spend some time redoing the interpolation code, in theory client and server should still be pretty close.
2. You can use a smaller time step, and step the simulation multiple times per update. For RB we found we did not need to do this.
3. Small objects can be a problem, but this will be true with any physics simulation. In RB, we cap the velocity of objects, and played with object size, til we got the result we wanted. Actually not that big a deal -- unless you are trying to simulate very small objects moving very fast. To calculate our velocity cap, we just figured out the most we could have the smallest object move in a single simulation step and then set the velocity cap so that so object would ever be able to step more than that in one update. Alternativly, you could add more simulation steps each 32 millis.
4. The pins are are the smallest objects in RB. They are actually made up of 4 ODE bodies pinned together (a tall box and 3 spheres). A cylinder and 3 spheres would have been better, but at the time the capped cylinder collision detection was buggy, so we went with a box to represent the central col of the pins. The central col of the pin is 0.74 units wide/deep and 3.9 units tall.
Hope this helps -- we have an ODE integration we are pretty happy with, although the only joints we use are for collision between the bodies, none of the fancy joints. It does take a little (or a lot) of experimenting to get the feel you want, but depending on what you are trying to simulate you can get pretty satisfying results without too much effort. Multiplayer is definitely a bigger task, but certainly do-able.
12/17/2004 (12:59 pm)
Drew & folks,To answer some of the ODE & RocketBowl questions:
1. RB does not have multiplayer. This was partly to do with the difficulty of implementing ODE in a multiplayer situation (i.e. needing to revise how interpolation is done client side, probably) There is no reason you couldn't do it, just that you would need to spend some time redoing the interpolation code, in theory client and server should still be pretty close.
2. You can use a smaller time step, and step the simulation multiple times per update. For RB we found we did not need to do this.
3. Small objects can be a problem, but this will be true with any physics simulation. In RB, we cap the velocity of objects, and played with object size, til we got the result we wanted. Actually not that big a deal -- unless you are trying to simulate very small objects moving very fast. To calculate our velocity cap, we just figured out the most we could have the smallest object move in a single simulation step and then set the velocity cap so that so object would ever be able to step more than that in one update. Alternativly, you could add more simulation steps each 32 millis.
4. The pins are are the smallest objects in RB. They are actually made up of 4 ODE bodies pinned together (a tall box and 3 spheres). A cylinder and 3 spheres would have been better, but at the time the capped cylinder collision detection was buggy, so we went with a box to represent the central col of the pins. The central col of the pin is 0.74 units wide/deep and 3.9 units tall.
Hope this helps -- we have an ODE integration we are pretty happy with, although the only joints we use are for collision between the bodies, none of the fancy joints. It does take a little (or a lot) of experimenting to get the feel you want, but depending on what you are trying to simulate you can get pretty satisfying results without too much effort. Multiplayer is definitely a bigger task, but certainly do-able.
#12
Man, that's seriously cool... and it's a lot of fun to play with too!
-Josh
12/17/2004 (1:13 pm)
ODE was used in Hellforces, Bloodrayne 2, 18 Wheels of Steel: Pedal to the Metal, and a bunch of other stuff.Man, that's seriously cool... and it's a lot of fun to play with too!
-Josh
#13
Basically I'm just working off the ODE resource, integration wasn't too bad, but still in progress for what I'm trying to do with it (small objects). Overall I think the resource is really good, it just may take some tweaking like Josh said. If you start working on integrating and come across some problems you can post on the forum. Can't share code currently due to some contract restrictions, but I'd also like to see some updates to the resource. :) Lets knock our heads together and maybe a community update to the resource will roll out, which would be cool.
I can say, there are a few updates to packUpdate() I made to fix some ghosting problems, namely ODE mission objects not showing up on mission load. I had to add an InitialUpdate mask to make sure those would show up.
Josh W:
Thanks a lot for taking some time to answer some questions, that is really helpful. Right now I'm working on that small object problem I'm getting. It sounds like your pins aren't too much wider then my objects, but a bit taller. I'll keep cranking away at what I've got, and if I come up with anything interesting I'll let people know. But right now, I get big time penetrations at about every 4-5 collisions, especially when one box is dropped on another. But it never happens for the large boxes of like 2 units per side.
You mentioned each pin 4 bodies pinned together. So for 10 pins, that's like 40 ODE objects. Do you ever experience any slowdown during your integration from the amount of objects or contact points? Right now, I'm finding with about 7 or more ODE objects moving at once, even with no contact points (aka all flying through the air), I get a little visible lag from ODE, and once the contact points lay in, it gets slow. We've got quickstep working when our contact points go above 40, and that helps a lot.
But if I make a stack of 6 boxes, and toss the bottom one up to have all boxes fly apart, my sim definitely bogs down. On a bizarre related note, I found running the advanced camera at the same time also slows down my ODE integration, but I'm not sure why. I did some small profiling tests with some buddies, and it seems the main reason is that ODE is taking longer then 32 milliseconds to finish it's calculations, so I think we need to do some optimizing somewhere.
Josh R:
I know, ODE is picking up! It's pretty fun just knocking stuff around, even without any in-game goal. :)
12/22/2004 (9:37 am)
OtakuNoZoku:Basically I'm just working off the ODE resource, integration wasn't too bad, but still in progress for what I'm trying to do with it (small objects). Overall I think the resource is really good, it just may take some tweaking like Josh said. If you start working on integrating and come across some problems you can post on the forum. Can't share code currently due to some contract restrictions, but I'd also like to see some updates to the resource. :) Lets knock our heads together and maybe a community update to the resource will roll out, which would be cool.
I can say, there are a few updates to packUpdate() I made to fix some ghosting problems, namely ODE mission objects not showing up on mission load. I had to add an InitialUpdate mask to make sure those would show up.
Josh W:
Thanks a lot for taking some time to answer some questions, that is really helpful. Right now I'm working on that small object problem I'm getting. It sounds like your pins aren't too much wider then my objects, but a bit taller. I'll keep cranking away at what I've got, and if I come up with anything interesting I'll let people know. But right now, I get big time penetrations at about every 4-5 collisions, especially when one box is dropped on another. But it never happens for the large boxes of like 2 units per side.
You mentioned each pin 4 bodies pinned together. So for 10 pins, that's like 40 ODE objects. Do you ever experience any slowdown during your integration from the amount of objects or contact points? Right now, I'm finding with about 7 or more ODE objects moving at once, even with no contact points (aka all flying through the air), I get a little visible lag from ODE, and once the contact points lay in, it gets slow. We've got quickstep working when our contact points go above 40, and that helps a lot.
But if I make a stack of 6 boxes, and toss the bottom one up to have all boxes fly apart, my sim definitely bogs down. On a bizarre related note, I found running the advanced camera at the same time also slows down my ODE integration, but I'm not sure why. I did some small profiling tests with some buddies, and it seems the main reason is that ODE is taking longer then 32 milliseconds to finish it's calculations, so I think we need to do some optimizing somewhere.
Josh R:
I know, ODE is picking up! It's pretty fun just knocking stuff around, even without any in-game goal. :)
#14
It is fully network enabled.
Problem is - it uses the vehicle physics, and as you know it has some collision issues especially at high velocity. But for anything "normal" it works.
12/23/2004 (12:10 am)
For those only needing simple physics, take a look at the "rigid shape" resource. It exposes already existing physics in TGE (what the vehicles use internally), so you can have boxes, boulders, bowling pins and similar.It is fully network enabled.
Problem is - it uses the vehicle physics, and as you know it has some collision issues especially at high velocity. But for anything "normal" it works.
#15
12/23/2004 (7:21 pm)
I've been playing with that class recently. Good stuff.
#16
Drew Parker
Nick
02/14/2005 (2:43 pm)
Anyone interested in ODE integration with Torque should check this out.Drew Parker
Nick
#17
02/14/2005 (2:59 pm)
Http://www.garagegames.com/blogs/28327/7186
Torque Owner Benjamin Bradley