Author Options:

Racing Game Physics Answered

I've been designing a physics engine for a racing game for a long time now (months? years?) and I think that I've finally got almost everything figured out. The one thing that I don't know about is traction. So far my best guess for a formula is

T = X + (Y * S)

Where T is the stabilizing force on the car, S is the amount of slippage, and X and Y are two of the car's stats (probably measured in G's). This formula would be applied to each tire separately to account for the suspension.

NOTE: The thing that might not be obvious here is that the car doesn't slip at all as long as X isn't exceeded.

What do you think of this?


How are you weighing-in T to the rest of the physics, and is the term S a constant or variable? L

There are actually several different sections that produce something like T. The engine and brake values go through the traction part separately for each wheel, then from that it comes up with the total force on the car from the wheels. Then it comes up with the aerodynamic part and corrects the velocity according to all 5 points. S is just the difference between the car's speed and the tire's speed.

Something about this doesn't seem quite right - you must be using T in the calculations for speed but if S is also determined by speed you've got some kind of circular equation?
From first principles I'd be thinking T is proportional to:
Tyre temperature, which would be a variable if you wanted to model it.
Road surface, again a variable if you wanted to model it.
Down-force (directly related to speed)
Basic coefficient of friction (modified by the above)

T plus engine output give you an acceleration, but you'd need to factor in output exceeding T such that wheels spin. Imagine traction control and it's easy, without that it's complicated...

I get the wheel-slip bit S, but am thinking you could avoid it as a necessary factor if the above are included correctly?


BASIC example: not including much except the traction formula

Priming some stats, let's say X is 0.8g and Y is 0.02g.

A car using my system is already up to high speed. Approaching a turn, there is no force applied through the wheels (just to make it simpler). As it starts to turn, it has less than 0.8g of force on it, so it keeps traction perfectly. If the force were held at 0.9g, then it would slip in the direction of the force at 5 mph (because the extra 0.1g = 0.02(Y) * 5(S)). If it somehow ended up going sideways at 100 mph, then 0.8g + (0.02g * 100) = 2.8g (!!!) or just deceleration of 61 mph per second (maybe Y should be a little lower...).

I hope that explains something!

Actually it doesn't cover traction...

Oh, I'm sure you can work it in. You're also going to accommodate spinning (off) & sliding? L

That looks like the right stuff! Thanks!

. The way I read the formula, I come up with what amounts to a binary value - are the wheels slipping or not. X would be a value indicating where the wheels loses traction. Y (or S) is a tire traction coefficient. And S (or Y) is torque applied. X will be negative, so when T >= 0, the wheels are slipping. But I'm just shooting in the dark. ;)
. For a homebrew game, taking tire temp, downforce, &c into account is overkill. A single (2-3 tops) factor should be good enough. Sounds to me as if accounting for each suspension is overkill - I'd treat all four the same. Guess it depends on one's programming skills and other resources.

Suspension isn't actually calculated individually. It only keeps track of the center of gravity. That example is posted now.

??? I didn't really get that... Like I said above, I'll model an example sometime here. I can't really even program, but I can work with formulas to figure out what the programming should be doing. You're probably right, but I just need something to do with my time.

I don't think it's circular, but I'm not completely sure of that. Tire temperature is a good idea, road surface is just another coefficient on the whole traction formula, down-force is implied (because things are measured in G's), and friction is modeled beween the differential and the tires. I'll model an example for you some time here but I'm in a bit of a hurry right now. If you didn't include S somehow, then it would be possible to get too powerful an engine and the wheels would keep spinning faster and faster indefinitely.