Racing Game Physics

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?

sort by: active | newest | oldest
1-10 of 13Next »
lemonie8 years ago
How are you weighing-in T to the rest of the physics, and is the term S a constant or variable? L
yourcat (author)  lemonie8 years ago
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.
lemonie yourcat8 years ago
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?

yourcat (author)  lemonie8 years ago
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!
lemonie yourcat8 years ago
Rather than try to work with what is part of a larger piece of code, would this coding tutorial be of any use to you?

yourcat (author)  lemonie8 years ago
Actually it doesn't cover traction...
lemonie yourcat8 years ago
Oh, I'm sure you can work it in. You're also going to accommodate spinning (off) & sliding? L
yourcat (author)  lemonie8 years ago
yourcat (author)  lemonie8 years ago
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.
1-10 of 13Next »