SA-MP Forums The "Real" vehicle speed thread
 New Account Members List Search Today's Posts Mark Forums Read

 29/07/2012, 06:54 PM #1 Sinner Gangsta     Join Date: Aug 2010 Location: On This Mortal Coil Posts: 815 Reputation: 292 The "Real" vehicle speed thread 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 Code: `// vX = X velocity of the vehicle// vY = Y velocity of the vehicle// vZ = Z velocity of the vehicleSTEP1 = vX² + vY² + vZ² (Law of Pythagoras)STEP2 = SQUARE ROOT of STEP 1STEP3 = 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 Code: `// vid = current vehicle we are in// Model 451 = Turismoif(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 Code: `X = 1.072348Y = 0.008095Z = 0.000000` We can than calculate the magic number when the final speed equals 324: pawn Code: `X² = 1.072348 * 1.072348 = 1.149930233104Y² = 0.008095 * 0.008095 = 0.000065529025Z² = 0.000000 * 0.000000 = 0.000000000000SQUARE ROOT (1.149930233104 + 0.000065529025 + 0.000000000000) = 1.0723785535569983324 = 1.0723785535569983 * mNmN = [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. __________________ Please use the search feature before asking a question.
 29/07/2012, 09:13 PM #2 Arca Big Clucker     Join Date: Jul 2012 Location: Plano, Texas, United States Posts: 173 Reputation: 33 Re: The "Real" vehicle speed thread 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? __________________ Code:
30/07/2012, 08:31 AM   #3
Sinner
Gangsta

Join Date: Aug 2010
Location: On This Mortal Coil
Posts: 815
Reputation: 292
Re: The "Real" vehicle speed thread

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
__________________

 30/07/2012, 10:34 AM #4 Mauzen Banned   Join Date: Jun 2007 Location: Western Germany Posts: 5,093 Reputation: 1597 Re: The "Real" vehicle speed thread 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.
 30/07/2012, 01:06 PM #5 Vince Spam Machine     Join Date: Sep 2007 Location: Belgium Posts: 10,964 Reputation: 2649 Re: The "Real" vehicle speed thread 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. Code: ```; > 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, (R)ear, (4)-wheel drive``` __________________ [Tutorial] Database normalization: Vehicle components - Weapon data - GeoIP and rangebans - Association tables Useful: How NOT to store passwords
 04/08/2012, 06:46 PM #6 [HLF]Southclaw High-roller     Join Date: Apr 2009 Location: England Posts: 4,960 Reputation: 1549 Re: The "Real" vehicle speed thread Ooh I was going to open a topic like this! Just the other day I was testing this, I even scripted a never-ending-road to test it on! First I found the number to convert it to meters per second, by using the old method (Get the position each second, compare the distance) then got the right "magic number" to get the GetVehicleVelocity numbers to meters per second. I will try and find my results Edit: pawn Code: `speed = floatsqroot( (vx*vx)+(vy*vy)+(vz*vz) ) * MAGIC_NUMBER_FOR_METERS_PER_SECOND;` Meters per second seems to be 57.0, multiply this by 3.6 to get Km/h. That is game unit correct as far as I know, meters per second is based on the GTA units which are pretty much meters. It shows the Infernus top speed as 253.3Km/h which seems about right (Ignore the handling.cfg values) however it shows a push-bike going at 100Km/h (which is fine if you're a professional cycle racer, but this is a mountain bike, and the animation looks more like a relaxing Sunday ride!) __________________ Tools: Plugins: Links: Last edited by [HLF]Southclaw; 04/08/2012 at 07:25 PM.
 05/08/2012, 04:20 AM #7 Xentiarox Big Clucker     Join Date: Jun 2012 Location: Tilburg, NL Posts: 116 Reputation: 30 Re: The "Real" vehicle speed thread that is why you don't search for 'the magic number' but categorize the vehicles, other magic numbers for each category, for bikes * 20, for cars * 150, for planes * 210 (if using km/h). __________________ Professional scripting for low price. PM for details. Pure Nederlandse DM [img]http://*******/aYXdL[/img]
 06/08/2012, 07:23 PM #8 playbox12 High-roller     Join Date: Feb 2010 Location: Netherlands Posts: 1,667 Reputation: 216 Re: The "Real" vehicle speed thread 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.
 06/08/2012, 07:56 PM #9 [HLF]Southclaw High-roller     Join Date: Apr 2009 Location: England Posts: 4,960 Reputation: 1549 Re: The "Real" vehicle speed thread I do wish planes would go a bit faster tbh, but mach 2 would take about 8 seconds to cross the entire map __________________ Tools: Plugins: Links:
 06/08/2012, 09:03 PM #10 Joe Staff High-roller     Join Date: Aug 2007 Posts: 2,787 Reputation: 375 Re: The "Real" vehicle speed thread 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 __________________ Big bottom girls make this rockin' world go 'round.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Deal-or-die Scripting Help 6 01/05/2012 01:08 PM Donya Help Archive 4 11/06/2011 10:20 PM Rubennnnn Help Archive 1 02/12/2009 07:08 PM ssflsnoob General 2 23/11/2008 07:06 PM

All times are GMT. The time now is 05:51 AM.

 -- (EN) English -- (RU) Русски Contact Us - SA-MP - Archive - Top