Broughy1322's Handling SpreadSheet
Jul 29, 2015 15:21:00 GMT
reservoirdoc, Trowa, and 18 more like this
Post by CHILLI on Jul 29, 2015 15:21:00 GMT
Hello again fellow drivers, it's that time again where I emerge out of the shadows and create a thread.
So for those that havent seen Broughy1322 video on Vehicle Stats or His SpreadSheet regarding the handling file data, go take a look at either or both! This thread is going to be for trying to figure out and explain what the different parameters are for, including that seemingly random string of numbers at the end of each line. So lets get started, shall we?
The New Format
Since the original release back in 2013 the handling file has changed. It went from being a tightly packed collection of handling lines, each line being a different vehicle, to a XML file. Why is this important? Because we lost some valuable info the devs had put in at the beginning of the file. But as always some files from the old system linger behind, letting us know about the recent changes to the file relative to the previous game. This file probably originates back to GTA 3 because the parameter order has stayed more or less the same since then.
The Old & The New
The Basic Bits
While the handling.meta article that was referred to on the spreadsheet is an alright source of information, it also saddens me that some of it is incomplete or wrong. I've been into modding the handling data of GTA since San Andreas so naturally I've decided to dig into the data of each new game. While I feel confident I got most things nailed down a thing or two might still need to be filled in. I'm open to your input.
Anyway, these are the units the devs are working with. Some of these are not used anymore (Levels, engine type and engine drive) but the rest is still in use. Here we see that the total mass for each vehicle is in kilograms, units in metres, velocity in KM/H and one of the most important things to note; acceleration/deceleration in ms^2 (metres per second squared). These are the most important parameters because if you leave out any one of these the vehicle will no longer be functional. That said though, all parameters have to be present or the game will freeze or crash because it hangs during the vehicle loading process.
So, those are the basics out of the way. Lets dig deeper, shall we? I'll split up the rest in the same categories as Broughy's sheet.
The Physical Attributes
Or to be more specific, the setup for the physical body of the vehicle itself. If you stripped the vehicle of its wheels and propellers, this is what you're left with. At this point the vehicle is as useful to us as if it was blown up
Time to try to explain what the parameters are for. From now on I'll explain them in the order as they appear along with their terminology.
fMass is the total mass of the vehicle object. This will be used for calculating collision forces.
fDragMult the file states "proportional to velocity squared" meaning that if you increase the speed, you'll experience more drag. This is a force acting in the opposite direction of travel relative to your current speed.
nPercentSubmerged how much of the vehicle is meant to sink before it is destroyed? A lower value = more floaty. So 100% would equal the bouyancy of a rock. I dont know what 0% would be like, though. Presumably like a boat.
CentreOfMass this is referred to as a "Vec" value on the sheet, I'll explain that in a moment. These 3 values are used for tweaking the point where gravity pulls the object down relative to the visual model. This is a lot faster way of fine tuning than having to reimport the models over and over.
Note: Suspension upgrades naturally lowers the car. As far as I can tell these values remain the same at all times.
"Vec" is short for Vector. In programming a Vector is used to store data in a "list" instead of individual values. In this case this refers to a Vector3 since it carries 3 values in it. a Vector1 is simply known as a "float", hence the "f" in front of some values. a "float" supports decimals. A Vector can hold any amount of values, but is commonly never above Vector4 (x, y, z, w). Usually used for position, rotation and direction data.
"f" Float is another variable type that can hold decimal values like 0.1, 0.01, 0.001 etc.
InertiaMultiplier you know how it's quite tough to instantly spin around in water? That's because your inertia is higher. These values (another Vector3) are for making it harder for the object to rotate around said axis. 1, 1, 1 would mean it's the expected toughness. Below this it will feel lighter and above this it will feel heavier. The primary use is to give the turning some weight to it, but in the case of the modern police car it just ends up behaving like a friggin boat.
Note: The suspension upgrades alter the Z value as far as I can tell. A higher upgrade (for example Competition) increases the inertia, thus making the car respond slower when starting or ending a turn.
The Transmission Attributes
This is what lets us move the vehicle in the first place, granted it has wheels to begin with.
nDriveBias this value goes to the front wheels. (1 - Bias) goes to the rear. So a value of 0 means it's 0% power to the front, the remainder to the rear. 0.5 is perfectly balanced all wheel drive.
nDriveGears how many gears should the vehicle have? The torque curves are generated in real-time based on this number along with nDriveForce.
fDriveForce the target acceleration in ms^2. The game will do its best to achieve this rate of acceleration by converting it to torque in real-time. This means that the fMass can be ruled out because it will be compensated for. This is why heavy vehicles with really bad engine power can push lighter cars and objects.
Math: The acceleration per wheel is: (fDriveForce * 10 * nDriveBias) / current gear.
fDriveInertia how quickly can it rev up? 0 is like a truck and 1 is like a F-1 engine.
fClutchChangeRateScale how quickly can it change gear up/down? A higher value means faster shifts.
fV the target Velocity. The game will use this value to calculate the torque curves before adding drag, which is why you'll never quite reach this speed unless going downhill.
Note: Contrary to common belief this speed is actually reached despite the huge amounts of drag. It is however possible to exceed this limit. It's even easier to exceed with performance upgrades. And bump/curb-boosting will in fact let you exceed this speed for a few seconds after boosting.
fBrakeForce as the file said at the top even deceleration is in ms^2, so this is how quickly it will slow down and not how much force is applied. That comes later.
Math: The braking per wheel is: (fBrakeForce * 4 * fBrakeBias).
fBrakeBias "Front / rear brake ratio" so another case of where 1 = only the front brakes, 0 = only the rear brakes, 0.5 = all wheels brake equally.
fSteeringLock how much will the inner wheel turn when stopped? This is in degrees, so if this was set to 90 and you turn right, the right front wheel will turn 90 degrees and vice versa. This of course isnt part of the performance of the car but hey, it seems silly to give a single parameters its own category.
The Wheel Traction Attributes
This is where it gets really interesting. Having wheels is quite essential to getting a car or bike moving, so this is one half of what makes a vehicle behave the way it does.
fTractionCurveMin, Max and Lateral / Longitudal.
You have to look at all 4 of these at the same time to understand how the traction works. inb4 wall of text!
As Broughy covered the game has a min and max value for the traction where the max is used when cornering. But that isnt the whole story.
This is sort of Rockstar's variant of a Pacejka friction model (google it). When standing still only the Min is used. When moving without accelerating or decelerating or turning only Min is used. But the moment you start changing your direction of movement the game will first take a look at the Lateral & Longitudal values. Are you turning? If so, by how many degrees? The closer to the Lateral you get when turning, the closer to Max you'll get. Likewise the moment you turn more than Lateral you will lose traction. I will admit that I'm not entirely sure what Longitudal is for, but I'd imagine it's to give acceleration/braking some room for error so you dont have to accelerate/brake that exact 47.53% to make full use of the traction. Instead accelerating/braking anywhere between 40% - 50% is fine. You get the idea. That's just a guess, though.
Note: Based on my findings different wheel types will alter the Lateral value. Some types like Tuner increase it a lot and types like Offroads barely touch it. Because if you turn too much you'll lose traction again, explaining why Offroads feel as on-rails as they do even when turning fully. Also, a higher value means that it will take longer before you reach maximum traction, making a car feel a bit slidey/floaty at times.
fTractionSpringDeltaMax I'm not entirely sure what this is for. It's been commonly believed that it's for deciding when the wheel loses traction as it's leaving the ground. The reason I dont believe that is what it's used for is because the physics already use the upper and lower suspension limit for this. Going by the feel of the different cars and what this value is for them my best guess is that it's fake tyre flexing, a higher value is for more flexing. But on some cars it seems to be the other way around so this will need further testing to be confirmed.
Note:If I'm right different wheel types also mess with this value. As far as I can tell this is to give the player some room for error when accelerating/braking. This will increase the threshold in the form of a percentage.
Math: Max traction is roughly: (traction * (1 + deltaMax)).
fLowSpeedTractionLossMult oh man do I hate this with a passion. A higher value means you have less traction at low speed (roughly through the span of gear 1 and sometimes a little through gear 2). I personally wouldnt mind if this value ceased to exist, but maybe that's just me. This completely ruins torque tests where two cars try to push each other, so stop doing those... please... for everyone's sanity sake.
Math: The traction before distribution is: (traction / (1 + lossMult). 0 is full traction, 1 is half, 2 is a third etc.
fCamberStiffness this is 0 on cars but varies for bikes. Probably used to control how much traction is lost as the bike leans side to side, a way to fake the point where you start driving on the tyrewall. My best guess is that a higher value means it can lean more before losing traction. Not to be confused with how much you're turning. Again, dont shoot me if I'm wrong!
fTractionBias same thing as with the DriveBias and BrakeBias. How is the traction distributed? More to the front, the rear or balanced? 0.5 being perfectly balanced.
Note: Different spoilers do not tweak this value.
fTractionLossMult how much does the vehicle care about surface type changes? A higher value means it gets less traction when offroading. I will admit that I dont know if this also affects how much speed is lost on bad surfaces. There is a file stating all of the different surface materials somewhere... Maybe another day.
The Suspension Attributes
Now that we got the vehicle moving it might be a good idea to prevent it from scraping the floor. Time to install some suspension!
fSuspensionForce how stiff is the suspension? A low value is better for soaking bumps but makes weight shifting more sensitive. The vehicle naturally gets lowered when below 1.0 because it cant support itself. Also this is the total force which is then split across all wheels. So a 6-wheeled vehicle with a Bias of 0.5 gets 1/6 of the force per wheel.
Note: Wheel damage appears to lower this value slightly, hence why the suspension on the damaged wheels cave in so easily over bumps.
fSuspensionCompDamp the Compression Damping. Serves the same purpose as dampers in real life; to make the vehicle bounce less and feel more numb over bumps. This makes the suspension compress slower.
fSuspensionReboundDamp serves the same purpose as CompDamp but for when the suspension extends. This makes the suspension extend slower.
fUpperLimit & LowerLimit relative to the model's wheel node. When the suspension is compressed the UpperLimit sets the limit. When the suspension is extended the LowerLimit sets the max length. Add the absolute value of both together to find out what the total suspension travel is. If the vehicle uses McPherson suspension the camber angle is calculated based on this travel. More on that later.
fSuspensionRaise this value is 0 for all vehicles as far as I recall. This is probably used to lower the vehicle when fitted with suspension upgrades.
fSuspensionBias how is the stiffness distributed? Same case as with the previous Bias values. 0.5 is equal strength to the front and back.
fAntiRollBarForce keeping the car stable is important when driving, especially when racing. The higher this value is the more force is transmitted to the opposite side. For example if the front left wheel hits a bump it will make this wheel's suspension weaker and the opposide side stronger in an attempt to keep the car body upright.
Note: When a wheel is damaged this will cause the rollbar to malfunction, transmitting incorrent amounts of force, causing the suspension to either cave in on itself harder than normal or shake the entire car until the opposite wheel is also damaged.
fAntiRollBarBias is the rollbar stronger at the front, back or equal? 0.5 is equal stability for the front and rear.
fRollCentreHeightI have no clue what this is for... Could be used to specify another point where traction/suspension forces are applied.
This is used to fake the behaviour achieved by using different suspension geometry. In the game the geometry is purely visual so it's tweaked manually this way instead, hence why I call it "fake". To read up on what this is in real life, look here.
After comparing the values and model data of a few cars that roll over easily aswell as some that practically never flip, one would assume that the roll centre default (if 0.0 is given for both the front and rear) is around the same height as the middle of the wheel when stationary.
Note: This roll centre appears to always be the same relative height to the suspension, not the car body. This means that as you lower the car through suspension upgrades the roll centre will go closer to the CoG if not ending up above it, meaning that the car will refuse to roll. For example the Felon has really high CoG and roll centre placement in addition to insanely short suspension travel, making it flip over easily once on its side. On the contrary the Turismo R has both its CoG and roll centre just above the ground, about wheel centre height for both if not right below, probably making it just as stable as a Formula-1 car. So if you manage to roll over the Turismo, then you've truly succeeded!
Fun Fact: So if I understand this value correct, this means that if you make the roll centre really high you can make the car roll inwards when turning, just like in the Cars movies/game(s). And that is without theoreticly violating the laws of physics! Only problem is that constructing such a setup in real life is impossible because, unfortunately, suspension arms cant intersect without breaking or jamming.
Woah this post is becoming freaking huge! Are you still here? You dont have to stay for much longer, the most important stuff is now covered. BUT it's now time to delve into the final pieces of data that control things like damage, what suspension type to use and if the vehicle has ABS or not along with a bunch of other things. I wont cover certain combinations. Instead I'll explain how to read the data and show the most common setup for cars.
Ready for more? Here it comes!
Damage and Miscellaneous Attributes
So we got our vehicle moving and it's pretty fun to drive. But where's the risk & reward and fine tuning to truly specialize a vehicle's behaviour and visuals? It's right here!
Damage Attributes
If you've catched on that Mult is commonly used for multipliers, then this section wont need much explaining. For the damage mults 1.0 means it will take regular amount of damage. In the case of weapons, if a bullet does 10 damage it will deal 10 damage if the Mult is 1.0.
For collisions a value of 0 will negate any dents and the vehicle can only be scratched and windows/lights cracked. The Petrol & Oil Volume are only used in SinglePlayer as far as I'm aware. If a vehicle is left leaking petrol it will leave a flammable trail behind and eventually stall. If it's left leaking oil it will break down and either stall or set on fire. These volumes indicate for how long it can go before inevitably dying.
Note: When the engine has taken about 15-25% damage it will start rattling when letting off the throttle. After 50% it will start smoking, starting with light grey smoke and fading towards black before setting on fire or stalling. If you hear any rattling you can rest assured that you are now travelling slower because the engine is losing power. This type of damage was introduced in GTA IV and has been built upon for V to the point where if the engine is damaged beyond about 65-75% it will break down over time. More strain on the engine will make it break faster, covering all vehicle types (submarine has not been tested though).
Other Attributes
Read for some HEX code reading? No? Me either. But to get an understanding of why certain vehicles behave the way we do we have to decipher this seemingly random string of numbers.
X360 Handling Flags
PC Handling Flags (Incomplete, old)
Bear with me for a moment, we can solve this mess!
Alright, so the way to read these are a bit counter-intuitive. Lets take a common setup to help clarifying what dahell this is for.
When looking through all the vehicles in the game this is by far the most common setup.
The way to read these values are as follows:
1. how many numbers are present?
2. are there any numbers that are not 0?
If yes, then:
3. read the numbers backwards.
Here we see that each string of numbers go 1, 2, 4 and 8. The reason for this is that you wont ever get two indentical combos from two different setups. Now, time to see if we can figure out how this vehicle is set up.
EDIT: Credit to Pardonias for pointing out that a value over 8 is converted to letters, for example the Bus having an "A" in one of its flags. So it appears that they've made their HEX reader more sophisticated compared to before where it just kept stacking double digit numbers and still got it right. Also to clarify; each digit is the sum of the active flags, so "7" would mean that 1, 3 and 4 are used. Letters have number associations internally which is why they are used for larger numbers.
440010
We count 6 numbers. Alright, lets read it from the 6th line, starting with the input 4. We get "Axle_R_McPherson". Alright, makes sense. Lets decipher the rest the same way. The result is:
Axle_R_McPherson
Axle_F_McPherson
null
null
ABS_STD
null
Ehm... I dont think STD stands for Sexually Transmitted Disease, but with Rockstar you just never know. Honestly though, I think it's meant to be "Standard". So the majority of the vehicles do in fact have ABS of some sort. But then why did Broughy (aswell as myself that keep preaching the same thing) find that you need to brake a little less than max to get the most out of the traction? This is because, just like real life, ABS doesnt actually prevent the wheels from locking. What's actually happening is that the wheels lock and unlock in rapid succession, meaning that at one point you're sliding and the next you're barely braking. Each in-game tick is roughly 1/30th or 1/60th of a second, not entirely sure (with the exception of running below 25-30fps where it will start running in slow-mo). So if you start braking at tick 1, the wheels lock at tick 2 the game will stop braking at tick 3 and realize during tick 4 that it's fine to brake again. Repeat this really fast and you'll get quite stuttery behaviour during braking aswell as segmented skidmarks. Try braking hard in the rain and you'll hear the skid sound pulsing quickly aswell as the wheels locking briefly.
If you're really nerdy you can figure out how fast I was travelling by assuming my game was running at a stable 60fps at the time and knowing that each variation is 1 frame. One frame took about 0.016666... of a second to process. If the numbers become way too high just halve it. In that case the physics are running at 30Hz or about 0.033333... of a second per update.
Additional Math
Rear wheels use (1 - bias), front wheels just use (bias) as is.
Acceleration and speed logic & math
The gear ratios appear to be linear.
The threshold difference per gear is: (top speed / gears).
So for a car with 5 gears and a top speed of 150 the car is expected to change gear at:
gear 1: 0
gear 2: 30
gear 3: 60
gear 4: 90
gear 5: 120
The in-game speedometer only shows 3/4 of the actual speed (speed * 0.75), so these thresholds translate to:
gear 1: 0
gear 2: 22.5
gear 3: 45
gear 4: 67.5
gear 5: 90
When in max gear the speedometer will show 112.5 once you've reached max speed for this setup. In reality you will be travelling at 150 at this point. This was tested on Sandy Shores airfield and appeared to hold true with all cars I tested. The values above roughly resemble the Fugitive.
Note: The car will gear up earlier the more throttle you give, so it might change gear at, for example, 18 instead of the 22.5 I claimed above.
The acceleration wasnt measured exactly, but with some eyeballing it seems safe enough to assume that:
acceleration = ((driveForce * 10 * bias) / current gear) granted that the car isnt breaking traction.
likewise braking = (brakeForce * 4 * bias)
Final traction quantities
From my testing it appears that tractionMin is used for longitudal forces, accelerating/braking. And tractionMax is used for turning based on the degrees of travel vs. forward difference.
The resulting traction limit per wheel is:
* When moving: (traction * bias)
* When slow/stopped: (traction * bias) / (1 + lossMult)
Resulting traction limits & Launch control
So we know what the expected forces are going to be, but what's the end result? Also, is a "perfect launch" possible?
Lets grab some numbers from a car to make it easier to demostrate what's going on:
T20 because it's a car a lot of us have used and that is AWD/4WD which makes it a perfect candidate.
Bias: 0.3
AccelForce: 0.365
TractionMin: 2.55
LossMult: 1.3
Bias: 0.485
So in gear 1 the wheel with the most power will attempt to accelerate with a force of:
And if we assume that we're standing still our max longitudal traction is:
So we got our desired rate of acceleration and our traction limit. If we go full gas we can see that the acceleration value of 2.555 is a little bit higher than our traction threshold ~1.141. This means that we will experience wheelspin if we're not careful with the throttle.
And finally multiply the results by the mass of the vehicle to get the resulting physics force(s) that will be applied.
So how do we launch from a standstill without spinning the wheels?
Division is our friend. Lets see how much less traction we have compared to how much we want to accelerate
This value can also be seen as the amount of player input that should be given to stay within the limit.
After carefully checking the in-game rev-meter to find out where it redlines, it appears to be 9x1000rpm.
So to make sure we dont exceed how much traction we have the rev needle should point at:
But because of factors like suspension stress the traction might increase a little once we're moving, so having our rev needle at around 5-6 should still guarantee a good launch with minimal wheelspin. This is also keeping in mind that the TractionSpringDeltaMax (presumably) allows for a little room of error so it doesnt have to be exact.
So when standing on the starting grid of a race in a stock T20 giving about 50-70% of throttle or 6k RPM should theoreticly closely result in a perfect launch.
Holy cow this has got to be the longest first post I've ever written to date. If you did survive, then conglaturations sir or madam. Here's a cookie.
TL;DR
This is some black magic sh*t for sure, dude.
So for those that havent seen Broughy1322 video on Vehicle Stats or His SpreadSheet regarding the handling file data, go take a look at either or both! This thread is going to be for trying to figure out and explain what the different parameters are for, including that seemingly random string of numbers at the end of each line. So lets get started, shall we?
The New Format
Since the original release back in 2013 the handling file has changed. It went from being a tightly packed collection of handling lines, each line being a different vehicle, to a XML file. Why is this important? Because we lost some valuable info the devs had put in at the beginning of the file. But as always some files from the old system linger behind, letting us know about the recent changes to the file relative to the previous game. This file probably originates back to GTA 3 because the parameter order has stayed more or less the same since then.
The Old & The New
The Basic Bits
While the handling.meta article that was referred to on the spreadsheet is an alright source of information, it also saddens me that some of it is incomplete or wrong. I've been into modding the handling data of GTA since San Andreas so naturally I've decided to dig into the data of each new game. While I feel confident I got most things nailed down a thing or two might still need to be filled in. I'm open to your input.
Anyway, these are the units the devs are working with. Some of these are not used anymore (Levels, engine type and engine drive) but the rest is still in use. Here we see that the total mass for each vehicle is in kilograms, units in metres, velocity in KM/H and one of the most important things to note; acceleration/deceleration in ms^2 (metres per second squared). These are the most important parameters because if you leave out any one of these the vehicle will no longer be functional. That said though, all parameters have to be present or the game will freeze or crash because it hangs during the vehicle loading process.
So, those are the basics out of the way. Lets dig deeper, shall we? I'll split up the rest in the same categories as Broughy's sheet.
The Physical Attributes
Or to be more specific, the setup for the physical body of the vehicle itself. If you stripped the vehicle of its wheels and propellers, this is what you're left with. At this point the vehicle is as useful to us as if it was blown up
Time to try to explain what the parameters are for. From now on I'll explain them in the order as they appear along with their terminology.
fMass is the total mass of the vehicle object. This will be used for calculating collision forces.
fDragMult the file states "proportional to velocity squared" meaning that if you increase the speed, you'll experience more drag. This is a force acting in the opposite direction of travel relative to your current speed.
nPercentSubmerged how much of the vehicle is meant to sink before it is destroyed? A lower value = more floaty. So 100% would equal the bouyancy of a rock. I dont know what 0% would be like, though. Presumably like a boat.
CentreOfMass this is referred to as a "Vec" value on the sheet, I'll explain that in a moment. These 3 values are used for tweaking the point where gravity pulls the object down relative to the visual model. This is a lot faster way of fine tuning than having to reimport the models over and over.
Note: Suspension upgrades naturally lowers the car. As far as I can tell these values remain the same at all times.
"Vec" is short for Vector. In programming a Vector is used to store data in a "list" instead of individual values. In this case this refers to a Vector3 since it carries 3 values in it. a Vector1 is simply known as a "float", hence the "f" in front of some values. a "float" supports decimals. A Vector can hold any amount of values, but is commonly never above Vector4 (x, y, z, w). Usually used for position, rotation and direction data.
"f" Float is another variable type that can hold decimal values like 0.1, 0.01, 0.001 etc.
InertiaMultiplier you know how it's quite tough to instantly spin around in water? That's because your inertia is higher. These values (another Vector3) are for making it harder for the object to rotate around said axis. 1, 1, 1 would mean it's the expected toughness. Below this it will feel lighter and above this it will feel heavier. The primary use is to give the turning some weight to it, but in the case of the modern police car it just ends up behaving like a friggin boat.
Note: The suspension upgrades alter the Z value as far as I can tell. A higher upgrade (for example Competition) increases the inertia, thus making the car respond slower when starting or ending a turn.
The Transmission Attributes
This is what lets us move the vehicle in the first place, granted it has wheels to begin with.
nDriveBias this value goes to the front wheels. (1 - Bias) goes to the rear. So a value of 0 means it's 0% power to the front, the remainder to the rear. 0.5 is perfectly balanced all wheel drive.
nDriveGears how many gears should the vehicle have? The torque curves are generated in real-time based on this number along with nDriveForce.
fDriveForce the target acceleration in ms^2. The game will do its best to achieve this rate of acceleration by converting it to torque in real-time. This means that the fMass can be ruled out because it will be compensated for. This is why heavy vehicles with really bad engine power can push lighter cars and objects.
Math: The acceleration per wheel is: (fDriveForce * 10 * nDriveBias) / current gear.
fDriveInertia how quickly can it rev up? 0 is like a truck and 1 is like a F-1 engine.
fClutchChangeRateScale how quickly can it change gear up/down? A higher value means faster shifts.
fV the target Velocity. The game will use this value to calculate the torque curves before adding drag, which is why you'll never quite reach this speed unless going downhill.
Note: Contrary to common belief this speed is actually reached despite the huge amounts of drag. It is however possible to exceed this limit. It's even easier to exceed with performance upgrades. And bump/curb-boosting will in fact let you exceed this speed for a few seconds after boosting.
fBrakeForce as the file said at the top even deceleration is in ms^2, so this is how quickly it will slow down and not how much force is applied. That comes later.
Math: The braking per wheel is: (fBrakeForce * 4 * fBrakeBias).
fBrakeBias "Front / rear brake ratio" so another case of where 1 = only the front brakes, 0 = only the rear brakes, 0.5 = all wheels brake equally.
fSteeringLock how much will the inner wheel turn when stopped? This is in degrees, so if this was set to 90 and you turn right, the right front wheel will turn 90 degrees and vice versa. This of course isnt part of the performance of the car but hey, it seems silly to give a single parameters its own category.
The Wheel Traction Attributes
This is where it gets really interesting. Having wheels is quite essential to getting a car or bike moving, so this is one half of what makes a vehicle behave the way it does.
fTractionCurveMin, Max and Lateral / Longitudal.
You have to look at all 4 of these at the same time to understand how the traction works. inb4 wall of text!
As Broughy covered the game has a min and max value for the traction where the max is used when cornering. But that isnt the whole story.
This is sort of Rockstar's variant of a Pacejka friction model (google it). When standing still only the Min is used. When moving without accelerating or decelerating or turning only Min is used. But the moment you start changing your direction of movement the game will first take a look at the Lateral & Longitudal values. Are you turning? If so, by how many degrees? The closer to the Lateral you get when turning, the closer to Max you'll get. Likewise the moment you turn more than Lateral you will lose traction. I will admit that I'm not entirely sure what Longitudal is for, but I'd imagine it's to give acceleration/braking some room for error so you dont have to accelerate/brake that exact 47.53% to make full use of the traction. Instead accelerating/braking anywhere between 40% - 50% is fine. You get the idea. That's just a guess, though.
Note: Based on my findings different wheel types will alter the Lateral value. Some types like Tuner increase it a lot and types like Offroads barely touch it. Because if you turn too much you'll lose traction again, explaining why Offroads feel as on-rails as they do even when turning fully. Also, a higher value means that it will take longer before you reach maximum traction, making a car feel a bit slidey/floaty at times.
fTractionSpringDeltaMax I'm not entirely sure what this is for. It's been commonly believed that it's for deciding when the wheel loses traction as it's leaving the ground. The reason I dont believe that is what it's used for is because the physics already use the upper and lower suspension limit for this. Going by the feel of the different cars and what this value is for them my best guess is that it's fake tyre flexing, a higher value is for more flexing. But on some cars it seems to be the other way around so this will need further testing to be confirmed.
Note:
Math: Max traction is roughly: (traction * (1 + deltaMax)).
fLowSpeedTractionLossMult oh man do I hate this with a passion. A higher value means you have less traction at low speed (roughly through the span of gear 1 and sometimes a little through gear 2). I personally wouldnt mind if this value ceased to exist, but maybe that's just me. This completely ruins torque tests where two cars try to push each other, so stop doing those... please... for everyone's sanity sake.
Math: The traction before distribution is: (traction / (1 + lossMult). 0 is full traction, 1 is half, 2 is a third etc.
fCamberStiffness this is 0 on cars but varies for bikes. Probably used to control how much traction is lost as the bike leans side to side, a way to fake the point where you start driving on the tyrewall. My best guess is that a higher value means it can lean more before losing traction. Not to be confused with how much you're turning. Again, dont shoot me if I'm wrong!
fTractionBias same thing as with the DriveBias and BrakeBias. How is the traction distributed? More to the front, the rear or balanced? 0.5 being perfectly balanced.
Note: Different spoilers do not tweak this value.
fTractionLossMult how much does the vehicle care about surface type changes? A higher value means it gets less traction when offroading. I will admit that I dont know if this also affects how much speed is lost on bad surfaces. There is a file stating all of the different surface materials somewhere... Maybe another day.
The Suspension Attributes
Now that we got the vehicle moving it might be a good idea to prevent it from scraping the floor. Time to install some suspension!
fSuspensionForce how stiff is the suspension? A low value is better for soaking bumps but makes weight shifting more sensitive. The vehicle naturally gets lowered when below 1.0 because it cant support itself. Also this is the total force which is then split across all wheels. So a 6-wheeled vehicle with a Bias of 0.5 gets 1/6 of the force per wheel.
Note: Wheel damage appears to lower this value slightly, hence why the suspension on the damaged wheels cave in so easily over bumps.
fSuspensionCompDamp the Compression Damping. Serves the same purpose as dampers in real life; to make the vehicle bounce less and feel more numb over bumps. This makes the suspension compress slower.
fSuspensionReboundDamp serves the same purpose as CompDamp but for when the suspension extends. This makes the suspension extend slower.
fUpperLimit & LowerLimit relative to the model's wheel node. When the suspension is compressed the UpperLimit sets the limit. When the suspension is extended the LowerLimit sets the max length. Add the absolute value of both together to find out what the total suspension travel is. If the vehicle uses McPherson suspension the camber angle is calculated based on this travel. More on that later.
fSuspensionRaise this value is 0 for all vehicles as far as I recall. This is probably used to lower the vehicle when fitted with suspension upgrades.
fSuspensionBias how is the stiffness distributed? Same case as with the previous Bias values. 0.5 is equal strength to the front and back.
fAntiRollBarForce keeping the car stable is important when driving, especially when racing. The higher this value is the more force is transmitted to the opposite side. For example if the front left wheel hits a bump it will make this wheel's suspension weaker and the opposide side stronger in an attempt to keep the car body upright.
Note: When a wheel is damaged this will cause the rollbar to malfunction, transmitting incorrent amounts of force, causing the suspension to either cave in on itself harder than normal or shake the entire car until the opposite wheel is also damaged.
fAntiRollBarBias is the rollbar stronger at the front, back or equal? 0.5 is equal stability for the front and rear.
fRollCentreHeight
The distance between the roll center and the center of gravity is called the roll couple. ..... The roll couple is the lever arm that centrifugal force working on the CG uses to make a car lean over in a turn about the roll center.
Note: This roll centre appears to always be the same relative height to the suspension, not the car body. This means that as you lower the car through suspension upgrades the roll centre will go closer to the CoG if not ending up above it, meaning that the car will refuse to roll. For example the Felon has really high CoG and roll centre placement in addition to insanely short suspension travel, making it flip over easily once on its side. On the contrary the Turismo R has both its CoG and roll centre just above the ground, about wheel centre height for both if not right below, probably making it just as stable as a Formula-1 car. So if you manage to roll over the Turismo, then you've truly succeeded!
Fun Fact: So if I understand this value correct, this means that if you make the roll centre really high you can make the car roll inwards when turning, just like in the Cars movies/game(s). And that is without theoreticly violating the laws of physics! Only problem is that constructing such a setup in real life is impossible because, unfortunately, suspension arms cant intersect without breaking or jamming.
Woah this post is becoming freaking huge! Are you still here? You dont have to stay for much longer, the most important stuff is now covered. BUT it's now time to delve into the final pieces of data that control things like damage, what suspension type to use and if the vehicle has ABS or not along with a bunch of other things. I wont cover certain combinations. Instead I'll explain how to read the data and show the most common setup for cars.
Ready for more? Here it comes!
Damage and Miscellaneous Attributes
So we got our vehicle moving and it's pretty fun to drive. But where's the risk & reward and fine tuning to truly specialize a vehicle's behaviour and visuals? It's right here!
Damage Attributes
If you've catched on that Mult is commonly used for multipliers, then this section wont need much explaining. For the damage mults 1.0 means it will take regular amount of damage. In the case of weapons, if a bullet does 10 damage it will deal 10 damage if the Mult is 1.0.
For collisions a value of 0 will negate any dents and the vehicle can only be scratched and windows/lights cracked. The Petrol & Oil Volume are only used in SinglePlayer as far as I'm aware. If a vehicle is left leaking petrol it will leave a flammable trail behind and eventually stall. If it's left leaking oil it will break down and either stall or set on fire. These volumes indicate for how long it can go before inevitably dying.
Note: When the engine has taken about 15-25% damage it will start rattling when letting off the throttle. After 50% it will start smoking, starting with light grey smoke and fading towards black before setting on fire or stalling. If you hear any rattling you can rest assured that you are now travelling slower because the engine is losing power. This type of damage was introduced in GTA IV and has been built upon for V to the point where if the engine is damaged beyond about 65-75% it will break down over time. More strain on the engine will make it break faster, covering all vehicle types (submarine has not been tested though).
Other Attributes
Read for some HEX code reading? No? Me either. But to get an understanding of why certain vehicles behave the way we do we have to decipher this seemingly random string of numbers.
X360 Handling Flags
PC Handling Flags (Incomplete, old)
Bear with me for a moment, we can solve this mess!
Alright, so the way to read these are a bit counter-intuitive. Lets take a common setup to help clarifying what dahell this is for.
<strModelFlags>440010</strModelFlags>
<strHandlingFlags>0</strHandlingFlags>
<strDamageFlags>0</strDamageFlags>
When looking through all the vehicles in the game this is by far the most common setup.
The way to read these values are as follows:
1. how many numbers are present?
2. are there any numbers that are not 0?
If yes, then:
3. read the numbers backwards.
Here we see that each string of numbers go 1, 2, 4 and 8. The reason for this is that you wont ever get two indentical combos from two different setups. Now, time to see if we can figure out how this vehicle is set up.
EDIT: Credit to Pardonias for pointing out that a value over 8 is converted to letters, for example the Bus having an "A" in one of its flags. So it appears that they've made their HEX reader more sophisticated compared to before where it just kept stacking double digit numbers and still got it right. Also to clarify; each digit is the sum of the active flags, so "7" would mean that 1, 3 and 4 are used. Letters have number associations internally which is why they are used for larger numbers.
440010
We count 6 numbers. Alright, lets read it from the 6th line, starting with the input 4. We get "Axle_R_McPherson". Alright, makes sense. Lets decipher the rest the same way. The result is:
Axle_R_McPherson
Axle_F_McPherson
null
null
ABS_STD
null
Ehm... I dont think STD stands for Sexually Transmitted Disease, but with Rockstar you just never know. Honestly though, I think it's meant to be "Standard". So the majority of the vehicles do in fact have ABS of some sort. But then why did Broughy (aswell as myself that keep preaching the same thing) find that you need to brake a little less than max to get the most out of the traction? This is because, just like real life, ABS doesnt actually prevent the wheels from locking. What's actually happening is that the wheels lock and unlock in rapid succession, meaning that at one point you're sliding and the next you're barely braking. Each in-game tick is roughly 1/30th or 1/60th of a second, not entirely sure (with the exception of running below 25-30fps where it will start running in slow-mo). So if you start braking at tick 1, the wheels lock at tick 2 the game will stop braking at tick 3 and realize during tick 4 that it's fine to brake again. Repeat this really fast and you'll get quite stuttery behaviour during braking aswell as segmented skidmarks. Try braking hard in the rain and you'll hear the skid sound pulsing quickly aswell as the wheels locking briefly.
If you're really nerdy you can figure out how fast I was travelling by assuming my game was running at a stable 60fps at the time and knowing that each variation is 1 frame. One frame took about 0.016666... of a second to process. If the numbers become way too high just halve it. In that case the physics are running at 30Hz or about 0.033333... of a second per update.
Additional Math
Rear wheels use (1 - bias), front wheels just use (bias) as is.
Acceleration and speed logic & math
The gear ratios appear to be linear.
The threshold difference per gear is: (top speed / gears).
So for a car with 5 gears and a top speed of 150 the car is expected to change gear at:
gear 1: 0
gear 2: 30
gear 3: 60
gear 4: 90
gear 5: 120
The in-game speedometer only shows 3/4 of the actual speed (speed * 0.75), so these thresholds translate to:
gear 1: 0
gear 2: 22.5
gear 3: 45
gear 4: 67.5
gear 5: 90
When in max gear the speedometer will show 112.5 once you've reached max speed for this setup. In reality you will be travelling at 150 at this point. This was tested on Sandy Shores airfield and appeared to hold true with all cars I tested. The values above roughly resemble the Fugitive.
Note: The car will gear up earlier the more throttle you give, so it might change gear at, for example, 18 instead of the 22.5 I claimed above.
The acceleration wasnt measured exactly, but with some eyeballing it seems safe enough to assume that:
acceleration = ((driveForce * 10 * bias) / current gear) granted that the car isnt breaking traction.
likewise braking = (brakeForce * 4 * bias)
Final traction quantities
From my testing it appears that tractionMin is used for longitudal forces, accelerating/braking. And tractionMax is used for turning based on the degrees of travel vs. forward difference.
The resulting traction limit per wheel is:
* When moving: (traction * bias)
* When slow/stopped: (traction * bias) / (1 + lossMult)
Resulting traction limits & Launch control
So we know what the expected forces are going to be, but what's the end result? Also, is a "perfect launch" possible?
Lets grab some numbers from a car to make it easier to demostrate what's going on:
T20 because it's a car a lot of us have used and that is AWD/4WD which makes it a perfect candidate.
Bias: 0.3
AccelForce: 0.365
TractionMin: 2.55
LossMult: 1.3
Bias: 0.485
So in gear 1 the wheel with the most power will attempt to accelerate with a force of:
Max Accel: (0.365 * 10) = 3.65
Highest bias is the rear wheel, so: (1 - 0.3) = 0.7
Final Accel: 3.65 * 0.7 = 2.555
Accel result: 2.555
And if we assume that we're standing still our max longitudal traction is:
Traction @ rear wheel: 2.55 * (1 - 0.485) * 2 = 2.6265
//it's multiplied by 2 so that when evenly balanced the traction is: 0.5 * 2 = 1
//otherwise we'd only truly have half the traction stated per wheel
Low speed loss: (1 + 1.3) = 2.3
Resulting traction: 2.6265 / 2.3 = 1.14195652173913 or... lets say 1.141
Traction result: 1.141
So we got our desired rate of acceleration and our traction limit. If we go full gas we can see that the acceleration value of 2.555 is a little bit higher than our traction threshold ~1.141. This means that we will experience wheelspin if we're not careful with the throttle.
And finally multiply the results by the mass of the vehicle to get the resulting physics force(s) that will be applied.
So how do we launch from a standstill without spinning the wheels?
Division is our friend. Lets see how much less traction we have compared to how much we want to accelerate
Optimal throttle input: (1.141 / 2.555) = 0.4465753424657534 or... 0.446
Our result: 0.446
This value can also be seen as the amount of player input that should be given to stay within the limit.
After carefully checking the in-game rev-meter to find out where it redlines, it appears to be 9x1000rpm.
So to make sure we dont exceed how much traction we have the rev needle should point at:
Optimal rpm: (9 * 0.446) = 4.041
But because of factors like suspension stress the traction might increase a little once we're moving, so having our rev needle at around 5-6 should still guarantee a good launch with minimal wheelspin. This is also keeping in mind that the TractionSpringDeltaMax (presumably) allows for a little room of error so it doesnt have to be exact.
So when standing on the starting grid of a race in a stock T20 giving about 50-70% of throttle or 6k RPM should theoreticly closely result in a perfect launch.
Holy cow this has got to be the longest first post I've ever written to date. If you did survive, then conglaturations sir or madam. Here's a cookie.
TL;DR
This is some black magic sh*t for sure, dude.