3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

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?

13 comments
sort by: active | newest | oldest
Apr 18, 2009. 3:37 PMlemonie says:
How are you weighing-in T to the rest of the physics, and is the term S a constant or variable? L
Apr 18, 2009. 4:23 PMlemonie says:
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?

L
Apr 20, 2009. 10:43 AMlemonie says:
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?
http://www.gamedev.net/reference/programming/features/2dcarphys/

L
Apr 20, 2009. 11:39 PMlemonie says:
Oh, I'm sure you can work it in. You're also going to accommodate spinning (off) & sliding? L
Apr 18, 2009. 5:14 PMNachoMahma says:
. 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.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!