Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / Skdding, powerslides, drifting vehicles with DarkPhysics!

Author
Message
VRMan3D
18
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 9th Dec 2006 22:40
Just wondering if anyone has figured out the seemingly impossible way to make the DarkPhysics vehicle simulation do what Mike of TGC says it can do, that being drifting/skidding/powerslides with vehicles.
Very blatantly printed across the advertisement page for DarkPhysics it says " driving around a terrain performing power slides and skids" Oh ha ha ha, I looked back now and they finally changed it from "How would you like to with a few commands be able to drive around a terrain performing power slides and skids" to the more ambiguous "It won't be too long before you can be driving around a terrain performing power slides and skids". I guess they got the message that we didn't like the false advertising. Perhaps by the "before too long" part they might be implying a patch is on the way to fix it. I sure hope so!

I have tried everything including what Mike sent in an email to get my vehicles to drift, but it never works. It basically ends up making the vehicle simulation system mostly worthless since if your vehicle is going fairly quick and you try to turn, rather than slide at all, the wheels just grip the terrain or road and send your car rolling endlessly. In my latest project it's nearly impossible to control the vehicle because of this.

The command PHY SET VEHICLE DYNAMIC FRICTION V in the help reference file says: "This property is the dynamic friction coefficient along the secondary axis of anisotropy which can allow the vehicle to be more slippery in one direction than another. This command can be used to allow the vehicle to slide around." I have tried changing this to all sorts of values and never notice the slightest bit of difference. Is it even doing anything?

Also one glaring omission seems to be the fact that you cannot set the material for the vehicle or worse yet that you can't have a specific material for the tires and a different one for the vehicle body (which should have different restitution and friction than the tires).

And changing the material for a static mesh 'level' or a terrain physics object seem to have no affect on the vehicle's ability to slide.

Have any of you out there running DarkPhysics found a way to make this work? I would really love to find out that there is one more thing I forgot to try tweaking that will make my vehicles stop catching and flipping over and start drifting around turns. I have two different games I'm working on that use the DarkPhysics vehicle system that my kids just laugh at because the vehicles are uncontrollable and just flips over when you turn LOL.

Perhaps I have to go back to the much lower performing Newton Dynamics physics engine in order to complete my vehicle related games? Newton does a splendid job of simulating vehicles (but very slow performance when you stack up several blocks), including completely customizable cushy suspension travel and excellent drifting based on the materials of what your driving on and the tires themselves (you can have different materials on different sections of the ground such as ice, asphault, and gravel and it simulates it perfectly, as well as being able to set materials for the tires and vehicle body separately - not to mention vehicle construction is more flexible rather than requiring you to load a single object with the tires as limbs...).

Really hoping to be corrected and put in my place so I can finish my projects,
-=VRMan3D=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 10th Dec 2006 07:00
VRMan,

Surely it depends upon how you build your vehicles. At the moment, mine are a single mesh with groups, but you can assemble vehicles out or different objects. That way, you can have different friction coefficients for the various bits. At least, that's the way I'm working towards for my street racing game.

I've actually got my car to powerslide. At least, it kinda looks like the slides I get in Burnout 3: Takedown. I found that the steering is critical for this. My code, with basic keyboard steering, results in an undriveable car. The same code with a cheap steering wheel has a car that can be driven and can slide without much effort.

One critical factor is the vehicle weight. If it's too light, the car is undriveable. If it's too heavy, it's sluggish and unresponsive. I've got my car set to 2,000kg right now, and t performs quite nicely.

Well, back to trying to drive a car on a SketchUp model...

Neil
VRMan3D
18
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 10th Dec 2006 16:04
Well Neilo,

This sounds great. I have tried so many different things including the mass of the object. Is there any chance you could share an example of a car that powerslides? I will try setting up analog joystick input steering and see if that makes any difference, however I don't see why it should be required. If you turn the front wheels with the keys it should still be able to slide.

So how do you build a vehicle from separate pieces? I thought everyone and the commands seem to indicate it needs to be a single model with limbs, or separate models joined by adding limbs. Please do explain what you mean exactly.

I (and others probably) really appreciate the response and look forward to any more details you might be able to offer.

Happy holidays,
-=VRMan=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 10th Dec 2006 17:11
I believe he means making a car by attaching wheels and such seperatley, using various joints in dp, however this woulden't be a prefect solution, as simulating steering suspention and rotating wheels would be very hard, and you would need lots of joints, which is why you need vehicle commands for this to work properly.

VRMan3D
18
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 10th Dec 2006 17:32
Ah yes, I've considered doing just that, ignoring the vehicle commands and doing it myself, but I came to the same conclusion that it would be very difficult so I took up the track of just hoping to encourage TGC to finish and polish off their sdk. Lets hope they do.

World Famous 3D Screensavers
-- http://www.vrman3d.com --
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 10th Dec 2006 23:00
@Dark Coder:
Quote: "
I believe he means making a car by attaching wheels and such seperatley, using various joints in dp, however this woulden't be a prefect solution, as simulating steering suspention and rotating wheels would be very hard, and you would need lots of joints, which is why you need vehicle commands for this to work properly.
"

I take it you've actually done this? Because reading the docs seems to indicate that it's a reasonably staightforward procedure, as does the various examples supplied with DarkPhysics.

@VRMan3D:
Quote: "
Is there any chance you could share an example of a car that powerslides? I will try setting up analog joystick input steering and see if that makes any difference, however I don't see why it should be required. If you turn the front wheels with the keys it should still be able to slide.
"

Let's be certain we're talking the same thing here: I understand Powerslide to mean taht I throw the vehicle hard left or right to induce a slide, then max power to the wheels for when the wheels stop sliding and start gripping. I'm basing it on what I can achieve in Burnout 3. The really basic example here http://forum.thegamecreators.com/?m=forum_view&t=91473&b=30 only needed wehicle weight to induce tht sort of slide.

The steering remains the key. The steering in the example above was horrendous, but by adding an analogue input it became quite manageable. It's the extra-fine control the steering wheel allows, I think. See how you go with an analogue stick. I can achieve the powerslide in Burnout with an analogue stick.
VRMan3D
18
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 11th Dec 2006 22:33
Hi Neilo,

Although Burnout 3 is a great game, it's idea of powerslides and drifting are kind of unrealistic. However, it's still something more than we've been able to get with DP.

Quote: "Let's be certain we're talking the same thing here: "


Yep, a powerslide is just accelerating around a turn causing the rear end of the vehicle to lose grip and 'fishtail' around the corner. In sprint racing, the cars maintain a nearly constant drifting state, you know the dirt track racing with the little buggys that always turn left and have a huge asymetrical spoiler on the back? There's a PC game called Dirt Track Racing that models it pretty well, but any vehicle should be able to do it. Also of course the newish movie 'Tokyo Drift' is of course all about street racing and drifting.
Here's a random picture from the web of a sprint car drifting on dirt:


Quite honestly I think DarkPhysics is just incomplete in it's vehicle physics modelling, and I've been talking with Mike Johnson of TGC about the wheel slip functions (which are a complicated mess) and they may not even be hooked in at all with this version of DarkPhysics. These functions are supposed to feed in the longitudinal and lateral forces to the vehicle based on slippage and I'm pretty sure they just aren't being called or something. Hopefully though in a (soon) update to DarkPhysics this will be addressed.
If there's still any question about what drifting is, I can post an executable from my R/C Trucks game I wrote using the NewtonDynamics physics engine. If anything it suffers from too much drift hehheh, but it's a good example of what it should look like (powerslides and spinouts on a dirt track).

World Famous 3D Screensavers
-- http://www.vrman3d.com --
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 12th Dec 2006 00:20
Ah. Nope; this I have not achieved. I was woking on the Burnout model. Looks like I'll have to check out Toyko Drift...
Choccy monster
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location:
Posted: 12th Dec 2006 12:58
I would advise researching what is known as vehicle "SIDESLIP".

This is the direction of travel of the car against it's yaw orientation. The effect of Sideslip is often called Oversteer.

It is calculated as atan2(car longtitude velocity, car lateral velocity )

or atan(car longtitude velocity / car lateral velocity )

I think DB uses atanfull instead of atan2. I'm not a user of the db language.

atan gives +- 180 degrees ( +- pi radians )

The order, (long , lat) might be reversed, im typing from memory at present with no access to code to verify.

The longtitude and lateral velocities of the car are in local car coordinates and not world frame coordinates.

The car might be travelling positevly in x world coordinates but pointing along the positive z axis, thus making it slide sideways at 90 degrees. This would give a sideslip value of 90 degrees.
longtitude velocity of 0 and a lateral velocity of >0 in local car frame coordinates.

Once the sideslip of the car is calculated, you can then calculate the force produced by the tires, which in turn provides a yaw force (torque) on the car in order to turn it back to neutrol. Any amount of sideslip the car is experiencing will have the effect of forcing the car back into a straight line. Slowing it's angular momentum until sideslip = 0.

To calculate the tire force in order to turn the car, i would advise using the famous Magic Pacejka Formula. The formula is available via the racer free open project as c source code, just a relatively small function which should be easy to port.

www.racer.nl

Incidentally, the racer site is an excellent place for car physics resources and also the forums at racesimcentral are invaluable for help from other car physics coders.


So to recap,
calculate the sideslip of the car
calculate the tire force with sideslip as your input
turn car by resulting force (slowing its angular (yaw) momentum)


This is the method most commercial car games use. Using a physics engine for general physics interactions and collisions and handling the car physics via your own code. This i have also done myself.

You can, for instance, simply make a cube in your physics engine with no ground friction. Apply force in its longtitude direction, which would push it forward ie, acceleration, add a yaw force via the steering which would give it angular momentum, then process your car physics code, which would apply a yaw force to slow down the yaw momentum of the car via it's current sideslip.


Even if you dont decide to go this route, i would still advise researching the method if only to get a better understanding of how a real car behaves.

Hope that sheds a bit more light on a pretty tricky subject.



A choc a day keeps the doctor away
VRMan3D
18
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 12th Dec 2006 21:32
Hey Choccy,

Good info, thanks for your input. What we are hoping for however is for the DarkPhysics library to be able to handle this for us (since that's what it's made for).

In conversations with Mike Johnson (DarkPhysics project lead) I decided to look a little more deeply into the Ageia PhysX documentation (what DarkPhysics is based on). And discovered this disheartening comment:

Quote: "The following two parameters are currently unimplemented, but will be implemented in the future. They descript

NxTireFuncDesc longitudalTireForceFunction – hermite spline coefficients describing the longitudal tire force curve
NxTireFuncDesc lateralTireForceFunction – hermite spline coefficients describing the lateral tire force curve

/*
Force
^ extremum
| _*_
| ~ \ asymptote
| / \~__*______________
| /
|/
---------------------------> Slip

NxTireFuncDesc

NxReal extremumSlip – extermum point of curve (default 2.0)
NxReal extremumValue – extermum point of curve (default 0.01)
NxReal asymptoteSlip – point on curve at which for all x > minimumX, function equals minimumY (default 2.0)
NxReal asymptoteValue – point on curve at which for all x > minimumX, function equals minimumY (default 0.01)
NxReal stiffnessFactor – scaling factor for tire force"


These are the functions that Mike is exposing since the 1.01 update and I have been able to get anything useful out of them. Now I finally noticed why -> they aren't even implemented *yet* in the current version of the Ageia SDK.

I'm going to be working with Mike on the next update to DarkPhysics and hopefully the newer Ageia SDK has finished and improved the vehicle handling routines and hopefully we will be able to get them in to the next update. If there are other things you guys feel we need in DarkPhysics relating to vehicles, be sure to post your wish lists in this forum. I will also make sure and check out the site you mentioned Choccy Monster, but really we are tied to whatever Ageia gives us. The NewtonDynamics does an excellent job of modelling vehicle physics (try out StuntPlayground on www.walaber.com as a good example) and hopefully we will get at least that much flexibility with DarkPhysics in the future.

Best regards,
-=VRMan=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 12th Dec 2006 23:45 Edited at: 13th Dec 2006 06:53
@Choccy monster,

Great advice; thanks. Also, the racer.nl site seems to be a very good place to start.

@VRMan3D,
Well, I must say I'm dissapointed in what the physics engine is offering, then. It's good enough to get started, but beyond that, I don't know. I had a look at the Newton stuff; it seems quite complete, but I'd like to go with DarkPhysics if I can.

For a wish list... a better understanding of the various vehicle parameters and their interactions would be nice. I've got a vehicle that falls into the static mesh that is the racetrack, and it's a devil of a problem to work out what the actual issue is. I'm rewriting my vehicle loading / construction code (I'm going to implement seperate wheels now, rather than groups in the body model) to try and get a handle on some of the interactions. However, reading the Ageia SDK may shed some light on the issues.

Thanks for sharing this with us, VRMan3D.

Edit:
Since you mentioned this Newton Physics (never heard of it before), I found the wrapper and the example files. Crikey; it's nice! Setting things up seems to be a lot more involved than in DarkPhysics, but the end results seem better. Not certain which way to go now; but I'll stick with DarkPhysics for the moment. Unless, that it, I can't sort out this issue with the cars falling into the ground, seemingly at random.

Kind regards,

Neil
VRMan3D
18
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 13th Dec 2006 16:47 Edited at: 13th Dec 2006 16:52
Hey Neilo,

Newton isn't bad at all, lots of good games have been written with it, but the integration is much more difficult with DBPro as compared with Dark Physics, and the performance is terrible once you try to do certain things like stacking up blocks (your framerate will drop down to something like 5fps, even if it's just because your vehicle ended up powersliding into some other physics objects and they end up pushing against each other. The newton engine will spend endless amounts of time trying to figure out what is happening and kill your framerate.) BUT, notice I said when your vehicle powerslides.... To be completely honest (and why wouldn't I be), Newton Dynamics beats DarkPhyics hands down when it comes to vehicle simulation. But I think that will be changing very soon with the next update to DarkPhysics. Really the only difference is that DarkPhysics ddoesn't have a complete vehicle system. But in DarkPhysics favor, you will find it to be very difficult getting Newton to handle a large terrain to drive on, something DP does with one command. And of course Newton doesn't support any of the hardware physics accelerators either.

What is kind of ironic though is that you mention your vehicle is falling through the ground seemingly at random with DarkPhysics. This was one of the main reasons I switched to DarkPhysics, the other being the terrible performance of Newton. But I made an R/C truck racing game for a client and with Newton there were spots on my terrain that the trucks would for some unknown reason seem to sink into the terrain as if it were a pool of mud. I was never able to overcome this problem, and was blown away by how easy it was to setup physics terrain in DarkPhysics. But once again, in my opinion, DarkPhysics is currently kind of useless for vehicles since no racing game would ever sell that didn't model drifting and powersliding properly.

I was working on my 'Janger' game (a block stacking game uhh remarkably like Milton Bradley's Jenga =) using Newton, and because the blocks are always resting on each other, the best I could get for performance with Newton was around 7-12fps - completely unacceptable. But the quick conversion to DarkPhysics yielded 700-1000 fps! Nearly 100 times faster! So for certain things (not vehicles) I think DarkPhysics blows away the competition. Anything with large scenes full of physical objects, DarkPhysics is the clear choice. For vehicles, ODE or Newton beats DarkPhysics. Also, the flexibility that DarkPhysics provides lets you do things you could never do with Newton. Maybe I'll post a demo here of what I mean.

Please let us see your results Neilo if you don't mind sharing (and I could probably help you fix your vehicle falling through the terrain with DarkPhysics if you wanted).

Best regards,
-=VRMan=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
DTsine
18
Years of Service
User Offline
Joined: 5th Mar 2005
Location:
Posted: 13th Dec 2006 20:33
@VRMan3D

Count me in on this I agree with all you have said so maybe I can be of some help.

@ Neilo

If I understand you right then your car is falling through your track?
If so then try making one point on your track really high I had a problem with some track models I was testing and found that doing this stopped the problem.

Rich
neilo
18
Years of Service
User Offline
Joined: 15th Feb 2006
Location: Sitting in front of my computer
Posted: 13th Dec 2006 22:51
@DTSine,
Quote: "If I understand you right then your car is falling through your track?
If so then try making one point on your track really high I had a problem with some track models I was testing and found that doing this stopped the problem."

Thanks for the tip.

I had a strange problem in the very beginning with a model brought out of Sketchup. Since the model had no thinkness, the car could not move. I'll try extruding the roadway and see if that makes a difference.

@VRMan3d,
You've obviously had far more experience with both systems than I have, so I'll follow your advice. There's plenty I can be working on anyway, other than the physics, so I can wait for an update.

Happy to share my results, but nothing for now. I'm rewriting my vehicle loading / building / configuration routine so it analyses the model being loaded and sets the parameters accordigly, rather than the hand-tweaked numbers in there now.

Kind regards to you both,

Neil

Login to post a reply

Server time is: 2024-02-21 11:37:55
Your offset time is: 2024-02-21 11:37:55