The "Real" vehicle speed thread
#1

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):

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
"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.

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);
}
We get the following result (these will vary ofcourse, but the calculations will always have the same result):

pawn Код:
X = 1.072348
Y = 0.008095
Z = 0.000000
We can than calculate the magic number when the final speed equals 324:

pawn Код:
= 1.072348 * 1.072348 = 1.149930233104
= 0.008095 * 0.008095 = 0.000065529025
= 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.
Reply
#2

Well I use 250.666667 for kmph and 199,4166672 for mph as the magic number but there are even more calculation needed to get the most of the accuracy. My formula is the same as yours and for everyone else. From where did you get this number 180.0?
Reply
#3

Quote:
Originally Posted by Arca
Посмотреть сообщение
Well I use 250.666667 for kmph and 199,4166672 for mph as the magic number but there are even more calculation needed to get the most of the accuracy. My formula is the same as yours and for everyone else. From where did you get this number 180.0?
Top speeds seemed to make sense somehow when I used 180.0
Reply
#4

The unit of the coordinates is known as meters, so for the best matching GTA properties you can just compare the travelled distance to the velocity. Most accurate on a straight and plane are.
Reply
#5

The max speed of every vehicle is listed in the handling.cfg data file. The Infernus is listed as the fastest vehicle with a top speed of 240 Km/h. To achieve this, I multiply with 195.12. It doesn't work for every vehicle though. There must be another factor involved. Some roads seem to affect speed as well. Try getting to top speed on The Strip; it just doesn't work.

Код:
; > UNITS <
; ---------
; vehicle identifier 14 characters max
; dimensions in metres
; mass in Kg
; velocity in Km/h
; acceleration/deceleration in ms-2
; multipliers x1.0 is default
; angles in degrees
; Levels :- (L)ow, (M)edium, (H)igh
; buoyancy = percent submerged (> 100% vehicle sinks)
; engine type :- (P)etrol, (D)iesel, (E)lectric
; engine drive :- (F)ront, ®ear, (4)-wheel drive
Reply
#6

Bikes are extremely unrealistic in this game. I wouldn't worry about them to much, also most vehicles have unrealistic speeds, this is probably done to keep the game fun. I wouldn't want to drive in a realistic bus, or fly in a fighter jet that reaches mach 2.
Reply
#7

I determined my magic number by simply forcing the velocity of a vehicle to X: 1, Y: 0, Z: 0. Then I measured the speed through distance over time. I don't remember the number I came up with. I think it was on average 192
Reply
#8

Which is pretty much consistent with the 195.12 I came up with.
Reply
#9

Everybody see this info:

http://projectcerbera.com/gta/sa/tutorials/acceleration

http://projectcerbera.com/gta/sa/tutorials/handling
Reply
#10

I like the acceleration part, i was trying to measure it itself, but this is more precise. This might become handy for RNPC vehicles.
Reply
#11

Of the handling.cfg archive:


Код:
		             		

                                     ------- CARS --------

        NAME           |      MAX. VEL (Km/h)       |              ACELERATION (m/sІ)        |
-----------------------|----------------------------|----------------------------------------|   
	LANDSTAL     		160.0 					25.0 
	BRAVURA     		160.0 					15.0 
	BUFFALO      		200.0 					28.0 
	LINERUN      		120.0 					25.0 
	PEREN        		150.0 					18.0 
	SENTINEL     		165.0 					24.0 
	DUMPER       		110.0 					25.0 
	FIRETRUK     		170.0 					27.0 
	TRASH        		110.0 					20.0 
	STRETCH      		180.0 					18.0 
	MANANA       		160.0 					19.0
	INFERNUS     		240.0 					30.0 
	VOODOO       		160.0 					23.0 
	PONY         		160.0 					15.0 
	MULE         		140.0 					18.0 
	CHEETAH      		230.0 					30.0 
	AMBULAN      		155.0 					24.0 
	MOONBEAM     		150.0 					15.0 
	ESPERANT     		160.0 					18.0 
	TAXI         		180.0 					19.0 
	WASHING      		180.0 					21.0 
	BOBCAT       		165.0 					20.0 
	MRWHOOP      		145.0 					14.0
	BFINJECT     		170.0 					30.0 
	PREMIER     		200.0 					22.0 
	ENFORCER     		170.0 					20.0 
	SECURICA     		170.0 					15.0 
	BANSHEE      		200.0 					33.0 
	BUS          		130.0 					14.0 
	RHINO        		80.0  					40.0 
	BARRACKS     		180.0 					20.0 
	HOTKNIFE     		200.0 					28.0 
	ARTICT1      		120.0 					18.0 
	PREVION      		160.0 					18.0 
	COACH        		160.0					18.0 
	CABBIE       		160.0 					24.0 
	STALLION     		160.0 					23.0 
	RUMPO        		160.0 					18.0 
	RCBANDIT     		75.0  					35.0 
	ROMERO       		150.0 					16.0 
	PACKER       		150.0 					13.0 
	MONSTER      		110.0 					45.0 
	ADMIRAL      		165.0 					22.0 
	TRAM         		150.0 					25.0 
	AIRTRAIN     		140.0 					24.0 
	ARTICT2      		120.0 					18.0 
	TURISMO      		240.0 					30.0 
	FLATBED      		140.0 					25.0 
	YANKEE       		160.0 					14.0 
	GOLFCART    		160.0 					15.0 
	SOLAIR      		165.0 					20.0 
	TOPFUN       		160.0 					15.0 
	GLENDALE     		160.0 					22.0 
	OCEANIC      		160.0 					16.0
	PATRIOT      		170.0 					25.0 
	HERMES       		160.0 					18.0 
	SABRE        		160.0 					24.0 
	ZR350        		200.0 					28.0 
	WALTON       		150.0 					14.0 
	REGINA       		165.0 					16.0 
	COMET       		200.0 					30.0 
	BURRITO      		150.0 					25.0 
	CAMPER       		120.0 					16.0 
	BAGGAGE      		160.0 					20.0 
	DOZER        		100.0 					35.0 
	RANCHER      		170.0 					20.0 
	FBIRANCH     		170.0 					22.0 
	VIRGO        		160.0 					18.0 
	GREENWOO     		160.0 					20.0 
	HOTRING      		220.0 					26.0 
	SANDKING     		170.0 					28.0 
	BLISTAC      		200.0 					26.0 
	BOXVILLE     		140.0 					14.0 
	BENSON       		140.0 					14.0 
	MESA         		160.0 					24.0 
	BLOODRA      		160.0 					24.0 
	BLOODRB      		160.0 					26.0 	
	SUPERGT      		230.0 					26.0 	
	ELEGANT      		165.0 					20.0 
	JOURNEY      		140.0 					14.0 	
	PETROL       		120.0 					25.0 
	RDTRAIN      		120.0 					25.0 
	NEBULA       		165.0 					20.0 
	MAJESTIC     		165.0 					22.0 
	BUCCANEE     		160.0 					24.0 
	CEMENT       		110.0 					20.0 
	TOWTRUCK     		160.0 					25.0 
	FORTUNE      		160.0 					20.0 
	CADRONA      		160.0 					20.0 
	FBITRUCK     		170.0 					25.0 
	WILLARD      		160.0 					18.0 
	FORKLIFT     		60.0 					20.0 
	TRACTOR      		70.0 					20.0 
	COMBINE      		140.0 					25.0
	FELTZER      		200.0 					28.0 
	REMINGTN     		160.0 					23.0 
	SLAMVAN      		160.0 					40.0 
	BLADE	     		160.0 					24.0 
	FREIGHT      		110.0 					20.0
	STREAK       		110.0 					20.0 
	VINCENT      		160.0 					18.0 
	BULLET       		230.0 					30.0  
	CLOVER       		160.0 					24.0 
	SADLER       		165.0 					25.0 
	RANGER       		160.0 					20.0 
	HUSTLER      		160.0 					22.0 
	INTRUDER     		160.0 					18.0 
	PRIMO        		160.0 					18.0 
	TAMPA        		160.0 					24.0 
	SUNRISE      		160.0 					17.0 
	MERIT        		165.0 					22.0 
	UTILITY      		160.0 					18.0 
	YOSEMITE     		170.0 					25.0
	WINDSOR      		180.0 					30.0 
	MTRUCK_A     		110.0 					45.0 
	MTRUCK_B     		110.0 					45.0 
	URANUS       		200.0 					20.0 
	JESTER       		200.0 					28.0 
	SULTAN       		200.0 					28.0
	STRATUM      		200.0 					20.0 
	ELEGY        		200.0 					28.0 
	RCTIGER      		75.0  					35.0 		
	FLASH        		200.0 					24.0 
	TAHOMA      		160.0 					24.0 
	SAVANNA      		160.0 					24.0 
	BANDITO      		170.0 					35.0
	FREIFLAT     		110.0 					20.0 
	CSTREAK      		110.0 					20.0 
	KART         		90.0					18.0 
	MOWER        		60.0 					12.0 
	DUNE         		110.0 					35.0 
	SWEEPER      		60.0 					12.0 
	BROADWAY     		160.0					20.0 
	TORNADO      		160.0 					20.0 
	DFT30        		110.0					20.0 
	HUNTLEY      		160.0 					25.0 
	STAFFORD     		165.0 					24.0
	NEWSVAN      		160.0 					15.0
	TUG	         	170.0 					15.0 
	PETROTR      		120.0 					18.0 
	EMPEROR      		165.0 					21.0 
	FLOAT        		110.0 					20.0 
	EUROS        		200.0 					24.0 
	HOTDOG	     		140.0 					14.0 
	CLUB	     		200.0 					30.0
	ARTICT3      		120.0 					18.0 
	RCCAM	     		60.0 					50.0 
	POLICE_LA    		200.0 					25.0 
	POLICE_SF    		200.0 					25.0 
	POLICE_VG    		200.0 					25.0 
	POLRANGER    		160.0 					30.0 
	PICADOR      		165.0 					25.0 
	SWATVAN      		110.0 					24.0 
	ALPHA        		200.0 					23.0 
	PHOENIX      		200.0 					26.0 
	BAGBOXA      		160.0 					20.0 
	STAIRS 		 	160.0 					20.0 
	BOXBURG      		140.0 					14.0 
	FARM_TR1     		160.0 					20.0
	UTIL_TR1     		60.0  					20.0 
	ROLLER	     		160.0 					15.0 
												
		              ------- BIKES & MOTOR BIKES --------

        NAME           |      MAX. VEL (Km/h)       |              ACELERATION (m/sІ)        |
-----------------------|----------------------------|----------------------------------------|    
	BIKE         		190.0 					50.0 
	MOPED        		190.0 					30.0 
	DIRTBIKE     		190.0 					50.0 
	FCR900       		190.0 					50.0 
	NRG500       		190.0 					60.0 
	HPV1000      		190.0 					50.0 
	BF400        		190.0 					50.0 
	WAYFARER     		190.0 					40.0 
	QUADBIKE     		160.0 					25.0 
	BMX          		120.0 					18.0 
	CHOPPERB     		120.0 					18.0 
	MTB          		140.0 					25.0 
	FREEWAY      		190.0 					40.0


		                   ------- BOATS --------

        NAME           |      MAX. VEL (Km/h)       |              ACELERATION (m/sІ)        |
-----------------------|----------------------------|----------------------------------------|   
	PREDATOR     		190.0					1.7  
	SPEEDER      		190.0 					2.5  
	REEFER       		190.0 					0.7  
	RIO          		190.0 					0.5  
	SQUALO       		190.0 					3.0  
	TROPIC       		190.0 					1.4 
	COASTGRD     		190.0 					1.6  
	DINGHY       		190.0 					1.2  
	MARQUIS      		190.0 					0.5  
	CUPBOAT      		190.0 					3.0  
	LAUNCH       		190.0 					1.5  




                                   ------- PLANES --------

         NAME          |      MAX. VEL (Km/h)       |              ACELERATION (m/sІ)        |
-----------------------|----------------------------|----------------------------------------|           
	SEAPLANE                200.0  					1.7  
	VORTEX       		150.0  					2.0  
	RUSTLER      		200.0 					16.0  
	BEAGLE       		200.0 					16.0 
	CROPDUST     		200.0 					16.0  
	STUNT        		200.0					16.0  
	SHAMAL       		200.0 					16.0 	
	HYDRA        		200.0 					16.0 
	NEVADA       		200.0 					16.0 
	AT400        		200.0 					16.0 
	ANDROM       		200.0 					16.0 
	DODO	     		200.0 					16.0 
	SPARROW      		200.0 					16.0 
	SEASPAR      		200.0 					16.0 
	MAVERICK     		200.0 					16.0 
	COASTMAV     		200.0 					16.0 
	POLMAV       		200.0 					16.0 
	HUNTER       		200.0 					16.0 	
	LEVIATHN     		200.0 					16.0 
	CARGOBOB     		200.0 					16.0
	RAINDANC     		200.0 					16.0 
	RCBARON      		75.0  					1.0 
	RCGOBLIN     		75.0  					35.0 
	RCRAIDER     		75.0  					35.0
______________
Reply
#12

I just use vX^2,vY^2,vZ^2 * 100 because it has pretty nice speeds...It has most vehicles going around 130 mph - infernus getting in the upper 100s...Which I think is a pretty good speed. Before that, I had it at around *140 (using the sqrt method) because it didn't feel like you were going nearly as fast as it was saying. The other method feels better though
Reply
#13

I found out that the magic number is 191.
The way I found it is by checking the distance the car passes at its max speed over 1 second.
I found out that with Sabre you drive 51 meters over 1 second and using a simple converter I found out that the max speed is 183 km/h.
I also did the same test on a Sultan which drives about 50.25 meters over 1 second at top speed wich is 180 km/h and so the magic number of 191 worked perfectly fine for me.
Reply
#14

Quote:
Originally Posted by Edix
Посмотреть сообщение
I found out that the magic number is 191.
The way I found it is by checking the distance the car passes at its max speed over 1 second.
I found out that with Sabre you drive 51 meters over 1 second and using a simple converter I found out that the max speed is 183 km/h.
I also did the same test on a Sultan which drives about 50.25 meters over 1 second at top speed wich is 180 km/h and so the magic number of 191 worked perfectly fine for me.
Except the bump of an old thread, you stated something and my answer is pretty much what someone above said "GTA Logic". How is that even possible, sabre being faster than sultan?
Reply
#15

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
Except the bump of an old thread, you stated something and my answer is pretty much what someone above said "GTA Logic". How is that even possible, sabre being faster than sultan?
There's nothing wrong with bumping a thread if you have some sort of contribution towards it.

I wouldn't doubt if Sabre was faster than Sultan. Sultans are actually really slow but favored among communities.
Reply
#16

You guys have probably missed my ultimate test I'll post it here where it belongs.

pawn Код:
new Float:vx, Float:vy, Float:vz, Float:vel;
vel = GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
vel = (floatsqroot(((vx*vx)+(vy*vy))+(vz*vz))* 181.5);
Here is the golden nugget direct proof of concept.

Notes:

- Velocity calculation is not accurate
- We are looking to compare two different velocity calculations which are "average speed" in km/h vs immediate speed through GetVehicleVelocity()
- There should be a reasonable tolerance of around +/-5km/h between these comparisons regardless of velocity
- The average speed is taken over a distance of 500 meters

Here are the results of the test:

(All Numbers are in km/h)
Infernus: Top Speed: 223 Average Speed: 219.298 Tolerance: 3.702
Jester: Top Speed: 179 Average Speed: 176.71 Tolerance: 2.29
Tug: Top Speed: 86 Average Speed: 85.20 Tolerance: 0.8

Ignore the speedometer on the last test it isn't consistent when using speed boost the settings are as follows. Were looking to see how well the speed boost which uses GetVehicleVelocity() can compensate by maintaining the designated top speed. This test is not particularly accurate the Infernus will get a higher top speed it's mainly to demonstrate general consistency even in more extreme cases which increases confidence in the overall consensus of the velocity tests.

Key Poll Update: 200ms timer (Not timerfix corrected)
Acceleration Factor: 1.2x
Max Speed: 400 km/h
Average Speed: 404.67 km/h

Documented video testing
[ame]http://www.youtube.com/watch?v=qbZhMxsr8G0[/ame]
Reply
#17

Looks good. You should maybe try a road that is completely flat. Anyone up to get all vehicle's top speeds?
Reply
#18

Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
Looks good. You should maybe try a road that is completely flat. Anyone up to get all vehicle's top speeds?
He did..

Also the incline there is perfect, it gives the vehicle a little extra at the beginning. You know most stuff here is inaccurate...
Reply
#19

Quote:
Originally Posted by Kar
View Post
He did..

Also the incline there is perfect, it gives the vehicle a little extra at the beginning. You know most stuff here is inaccurate...
incline road != completely flat. Even if it's a small incline, it could still throw off the speed even by a little.
Reply
#20

Apparently you don't understand how vehicles here work. I didnt said an incline is flat.

If you want to correct it, do it yourself. I saw his tests in-game, he showed me. There is a reason behind everything.

Also how does the incline even disrupt the calculations? the vehicle would reach the speed anyway.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)