29.07.2012, 17:54
There's been a lot of discussion about what the actual max. speed should be when it comes to SA-MP vehicles. This thread discusses this.
I think, though, I have found the most accurate max. speed possible. As we know, the max. speed of any vehicle can be calculated using the following formula (KM/H):
"the magic number" Is the number everyone has been looking for. Some people have proven that around 180.0 should give a fairly accurate result (which makes the max. speed of the Infernus, the fastest vehicle in the game, around 223 KM/H). We will now try to prove this correct.
Fact: Most of the cars in SA-MP are derived from real life vehicles. The Turismo is clearly a Ferrari F40 so we will use this as the base for our calculations.
Ferrari F40:
Turismo:
The max. speed of a Ferrari F40 is equal to 324 KM/H. (Source: http://en.wikipedia.org/wiki/Ferrari_F40)
Running the following code in a very fast loop, we can determine what the highest possible velocity is when a Turismo in SA-MP reaches his max. speed. This was done on a straight road and without nitrous.
We get the following result (these will vary ofcourse, but the calculations will always have the same result):
We can than calculate the magic number when the final speed equals 324:
So the "magic number" is equal to 302.13 (see test above), this though makes the top speed of the other vehicles out of proportion... A bus suddenly goes over 250KM/H!! I guess this issue is unsolvable and we need to search for an acceptable number somewhere in the middle.
I think, though, I have found the most accurate max. speed possible. As we know, the max. speed of any vehicle can be calculated using the following formula (KM/H):
pawn Код:
// vX = X velocity of the vehicle
// vY = Y velocity of the vehicle
// vZ = Z velocity of the vehicle
STEP1 = vXІ + vYІ + vZІ (Law of Pythagoras)
STEP2 = SQUARE ROOT of STEP 1
STEP3 = STEP2 * magic number
Fact: Most of the cars in SA-MP are derived from real life vehicles. The Turismo is clearly a Ferrari F40 so we will use this as the base for our calculations.
Ferrari F40:
Turismo:
The max. speed of a Ferrari F40 is equal to 324 KM/H. (Source: http://en.wikipedia.org/wiki/Ferrari_F40)
Running the following code in a very fast loop, we can determine what the highest possible velocity is when a Turismo in SA-MP reaches his max. speed. This was done on a straight road and without nitrous.
pawn Код:
// vid = current vehicle we are in
// Model 451 = Turismo
if(GetVehicleModel(vid) == 451) {
new
Float:speed_x,
Float:speed_y,
Float:speed_z
;
GetVehicleVelocity(vid,speed_x,speed_y,speed_z);
printf("[Velocity] X=%f, Y=%f, Z=%f", speed_x, speed_y, speed_z);
}
pawn Код:
X = 1.072348
Y = 0.008095
Z = 0.000000
pawn Код:
XІ = 1.072348 * 1.072348 = 1.149930233104
YІ = 0.008095 * 0.008095 = 0.000065529025
ZІ = 0.000000 * 0.000000 = 0.000000000000
SQUARE ROOT (1.149930233104 + 0.000065529025 + 0.000000000000) = 1.0723785535569983
324 = 1.0723785535569983 * mN
mN = [B]302.13[/B]
So the "magic number" is equal to 302.13 (see test above), this though makes the top speed of the other vehicles out of proportion... A bus suddenly goes over 250KM/H!! I guess this issue is unsolvable and we need to search for an acceptable number somewhere in the middle.