I noticed we are now at least 3 on this forum, trying to create a proper car simulation. It seems everyones main goal is to create something fun (drifts...), based on realistic physics, but not too hard for the player. So closer to something like GRID than Forza.

I think i am right when i say this : we all want the kind of fun we can find in games like NFS. If a game like NFS or GRID (or even the Steam racing casual games) can only be achieved by using some cheats or specific player input tweaking, i suppose we all want to know what they are.

What i propose here is :

- Share the fundamental basics every car simulation based on newton physics should have. eg : weight transfer, pacejka-like curves for getting output of SR/SA....
- Share one or two basics car models and parameters to be sure we are talking about the same thing.
- Share some reference values/behaviours in predetermined situations, so that everyone can compare their own values with some reference to know if things are going right or wrong.
- Share math/physics formula, tips & tricks, or cheats & shortcuts that would allow us to make the game more fun. Because we must not forget, it is all about fun in the end.

I'll start to fill the blanks, and i hope the car experts will bring their knowledge to be sure future readers won't be misleaded by the things listed here.

One of the goals here is to cover 2D and 3D games, as the car behaviour will be similar in both situations.

**Part 1 - What should i absolutly do to make this a fun game with drifts, skids and such things ?**

Let's make an exhaustive list of things needed to achieve a drifting behaviour on a racing car.

- Get
**basic newton physics**right : forces, acceleration, torque, integration. You can use a physics engine for this, like box2d or PhysX. - At first use a
**1ms timestep**to update the simulation at a decent rate and avoid bad approximations. - Create
**4 wheels and attach them**to the body. - Use wheel distance to CG to
**calculate weight transfer lateraly and longitudinal**. Combine those two. - Use
**real car suspension/springs/anti roll bars**, or the weight transfer will just be instantaneous and make the car highly unstable.

Subsidiary question : is it vital to have proper car suspensions ? - Use some
**"soft" player inputs, and try to limit steer angle**at high speed to get good lateral forces, or the car might be totally uncontrolable. Or use realistic driving accessories. - Find out
**velocity for each wheel contact patch**, transformed in the wheel space. So if the wheel is heading 45° and the car going straight, the front wheels will have both X/Y velocities, as rear wheels will only have Y (if Y is front). - Use the powered wheels velocity to
**determine motor RPMs**. Based on player throttle input, and engine torque curve,**generate a torque force for powered wheels**. **Apply torque on wheel so it increase their angular velocity.**- Calculate wheel
**slip angles**and**slip ratios**. - Use a plotted
**pacejka curve**, or a real formula to find out the normalized force the tire must produce front/lat.

Subsidiary question : is it vital to have the original formula instead of a simple pre-plotted curve ?

Subsidiary question : is it vital for nice drifting to have combined lateral/front formula ?

Subsidiary question : is it vital for nice drifting to feed directly the real load to the formula ? If i multiply the normalized 1N value by the wheel Fz result is supposed identical right ? **Create a vector for front/lat forces**, and**check this vector on friction circle/ellipse**. Cut any part which is not inside the circle.

Subsidiary question : should ellipse max values be the same as pacejka normalized max values ?- You can now
**multiply the remaining vector by the wheel weight**(Fz) - For the
**longitudinal component**of the force, reintegrate it in the wheel (with the radius), so it**decrease their angular velocity**. That part is what makes the wheel angular velocity adapt to the car speed. - Apply
**the resulting forces to the body**, at the attach point of the wheel, or directly the contact patch in 3D, and calculate resulting torque/acceleration on the body. - When 4 wheels have generated torque/forces for the car body,
**integrate those values in the physical**engine to produce velocity and move the car. **Apply damping forces (rolling friction, air drag)**. It is not supposed to be vital to car behaviour, but it might help a little. It will mostly influence acceleration time and maximum speed.

That should be all what is needed to get a car simulation right. At least theorically. I think i have forgotten nothing.

**Part 2 - The reference car(s)**

The goal of this part is to have reference values for a classic car, so we can compare our values and behaviours.

The classic car inspired from some Corvette C5 values and other frequent values seen here and there. Let's call it X-Car-1

Spoiler

To be honest i must say this reference values don't make a nice car. I'll post a general handling video soon.

Here are some parameters taken from Edys Car Vehicle Physics for the Red Pickup you can try in the demo. Some of the values can be monitored with B and the SHIFT+B in the demo. I post it here to give some elements to discuss about as a part of those values are not present above, and for some i just dont know what they mean. Any idea / insight would be appreciated.

Spoiler

**Part 3 - Reference handling and values**

The goal of this part is to put the car in a typical situation with controlled environment, and to look at what happens. Game may be written in Java, .NET, Unity or whatever, if you have taken control of the physics, and if you have the right car parameters, the values should look like these.

**X-Car-1_T01**: apply 100% throttle for 10.00 seconds

Coming soon...

**X-Car-1_T02**: launching directly the car with a front velocity of 50 meters/s

Coming soon...

**X-Car-1_T03**: launching directly the car with a side velocity of 50 meters/s

Coming soon...

**X-Car-1_T04**: launching directly the car with an angular velocity of 10 radians/s

Coming soon...

**X-Car-1_T05**: launching directly the car with a combined front/lateral velocity : 50m/s in each direction

Coming soon...

**X-Car-1_T06**: launching directly the car with a combined front/lateral velocity : 50m/s in each direction and a 10 radians/s angular velocity

Coming soon...

**X-Car-1_T07**: apply 100% throttle for 10.00 seconds, then without releasing throttle, press the right key for the next 10.00 seconds (right + full throttle)

Coming soon...

**X-Car-1_T08**: apply 100% throttle for 10.00 seconds, then release throttle, and press the right key for the next 10.00 seconds (right + free roll)

Coming soon...

**X-Car-1_T09**: apply 100% throttle for 10.00 seconds, then apply brake, and press the right key for the next 10.00 seconds (right + brake)

Coming soon...

**X-Car-1_T10**: a controled drift situation (still have to find a reference test)

Coming soon...

**Part 4 - Tips & tricks**

This part is still R&D, and i am more open to debate and wanting to collect ideas and tests than trying to explain to do this or not. I do not have the solution for doing most of those things anyway.

List of "legit" tricks :

- Limit maximum steer angle according to speed & max grip peak SA
- Same for throttle/brakes with peak slip ratio output
- Decrease gently (or not) steer angle after input release
- Be aware (you, programmer) of when a drift situation occurs and change car control inputs to help player have more fun
- Instead of modelizing a complex combined front/lat grip formula, just determine how much percent of lateral grip you lose in function of the slip ratio

Cheap tricks or cheats :

- If player apply throttle, just directly add front Y velocity to car
- Disable real front/rear weight calculations. Just decide of a prefixed weight change on acceleration/braking situations
- Gently decrease forces near/after traction circle max value, instead of just cutting it
- Rotate directly car velocity vector by a very small percent of the front wheels slip angle
- Use a linear slipAngleInRadians * someConstant formula for lateral pacejka output

**Part 5 - Reference formulas and ressources**

More content to come...

Reference physics formulas, tutorials and references...

**Part 6 - Questions, FAQ, things we don't know**

**Questions :**

- What is the formula to have a friction ellipse instead of a circle ?
- Where can we find a simple formula for combined long/lat grip ?
- Should we apply a static friction force or something like that or just pacejka ?

**FAQ :**

- Should i apply forces lateraly to car body or to the wheel ?

To the wheel. - More classic question and answers to come...
- What value can i use to decide if i must draw lateral drift skidmarks ?
- What value can i use to decide if i must draw burnout skidmarks ?

I'm looking forward to read your answers and contributions, if anyone interested !