The "Real" vehicle speed thread
#21

I can't see the incline having any real impact when the tests are not 100 percent accurate to begin with were dealing in terms of averages and probabilities were looking for a consistent pattern to approximate a formula that is where 181.5 came from.

Over many tests these results will be within a +/-5 tolerance which is expected the reinforcing factor is speed has little influence over the tolerance at low and high speeds and speeds between the two calculating systems would both follow a curve on a graph within the expected tolerance.
Reply
#22

It would be rather interesting to try to find out where the velocity values actually come from, then you could calculate the 100% exact multiplicator.
So samp uses meters as the default unit, gta probably also does. Using meters and yards internally at the same time would be a crappy waste of performance, so the velocity will also be some kind of meter value. The velocity values also will be used for something internally, would be a waste if they would be some value, just calculated for showing the speed. It would also be a more handy value then, like m/s m/millisecond or km/h, but it isnt.
So what could be the real use of these values?
Reply
#23

You guys do understand that speed is based on distance/time.

All you need to do is to get a vehicle top speed and check the distance it driven for 1 second and then all you have to do is devide the distance by the time passed or you could just use this simple tool: www.unitarium.com/speed-calculator

I based the distance unit on kilometers as GTA SA was developd by Rockstar North which are from the UK that are part of Europe which use metric system

Anyway the magic number I found to be the perfect magic number is : 191
Reply
#24

Quote:
Originally Posted by Edix
View Post
You guys do understand that speed is based on distance/time.

All you need to do is to get a vehicle top speed and check the distance it driven for 1 second and then all you have to do is devide the distance by the time passed or you could just use this simple tool: www.unitarium.com/speed-calculator

I based the distance unit on kilometers as GTA SA was developd by Rockstar North which are from the UK that are part of Europe which use metric system

Anyway the magic number I found to be the perfect magic number is : 191
I don't think so, look at all the tests I did if I put in 191 the results would be completely out to lunch lets see how out to lunch your "magic number" is

The results of 191

(All Numbers are in km/h)
Jester: Top Speed: 188.3 Average Speed: 176.70 Tolerance: 11.6
Tug: Top Speed: 90.4 Average Speed: 85.41 Tolerance: 5.0

Obviously this fails the tolerance criteria of +/-5 which is to compensate for lag and any other precision loss.

[ame]http://www.youtube.com/watch?v=jLRcIhYQaBo[/ame]
Reply
#25

Quote:
Originally Posted by [uL]Pottus
View Post
I don't think so, look at all the tests I did if I put in 191 the results would be completely out to lunch lets see how out to lunch your "magic number" is

The results of 191

(All Numbers are in km/h)
Jester: Top Speed: 188.3 Average Speed: 176.70 Tolerance: 11.6
Tug: Top Speed: 90.4 Average Speed: 85.41 Tolerance: 5.0

Obviously this fails the tolerance criteria of +/-5 which is to compensate for lag and any other precision loss.

http://www.youtube.com/watch?v=jLRcIhYQaBo
Speed is calculated by distance/time, thats how you actually get speed.
Reply
#26

Quote:
Originally Posted by Edix
View Post
Speed is calculated by distance/time, thats how you actually get speed.
You obviously didn't read how the test works.... the average speed in the results is a distance/time calculation calculated over 500 meters the top speed is taken from velocity calculation using GetVehicleVelocity() which is an immediate calculation.
Reply
#27

So....What is the magic number?

Why donґt you separate by bikes, cars, planes...?
Reply
#28

Quote:
Originally Posted by [uL]Pottus
View Post
(All Numbers are in km/h)
Jester: Top Speed: 188.3 Average Speed: 176.70 Tolerance: 11.6
Tug: Top Speed: 90.4 Average Speed: 85.41 Tolerance: 5.0
Where did you find that Jester's top speed is 188 and Tug's is 90?
Reply
#29

Quote:
Originally Posted by Edix
Посмотреть сообщение
Where did you find that Jester's top speed is 188 and Tug's is 90?
Look at all the tests in earlier posts the first tests is done with 181.5 as the "magic number" 191 is the second test done which clearly does not conform to a tolerance of +/-5 kilometers per hour regardless of speed. Then we have Gamer_Z's troll formula below.


Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
Here is my magic number from here:

pawn Код:
stock Float:GetSpeedInKPH(Float:VelocityX,Float:VelocityY,Float:VelocityZ)
{
    return (VelocityX*VelocityX+VelocityY*VelocityY+VelocityZ*VelocityZ)*(427833329/9449044);
}
which is basicly

(Speed^2)*45.28
Well, I don't know where you came up with that formula but it's complete bullshit unless i'm missing something here this is just returning absolute non-sense values 40km/h top speed for a jester for instance and 70km/h for a Infernus. I don't know what your thinking with this there is no need for a video because your formula is that silly.
Reply
#30

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
you are doing something wrong, infernus should be 145 km or 125 (or mp/h), don't remeber, ask MP2, he decided what speeds the max's should be for each vehicle, and I created the formula.

and the max speeds are actually based on the fact that a bicycle goes max 25km/h (or mp/h) and infernus, like I said, 125 or 145 or something.

For details see the release topic of the include.
I've looked through it already and I know that is the complete wrong approach your basically pretending what the speeds are which has nothing to do with your actual velocity. I don't see how I could do something wrong I used that formula exactly how you have it written unless there is more to it at any rate it's completely wrong even if I did get the output you claim.
Reply
#31

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
depends on personal needs, MP wanted to have a bike go 25mph ma and the infernus at another speed. The difference was not linear so I needed to come up with a formula which approaches the wanted values and this arised.

a full discussion is here: https://sampforum.blast.hk/showthread.php?tid=446342

/\ Y - "Real World Speed"
>X - GTA Velocity



This graph shows how the function approches the wishes (and very clearly shows there is NO way to make a direct-linear formula to the values), I could even make a formula to take a hydra into account to make it go at max anything above infernus speed.

you could get a linear formula by calculating the F' of the function F, but meh, it works.

So basicly, all the formulas which are linear may, for example, be only correct for sports cars, or only bikes, or only planes, but this formula covers like, "all-in-one".

If you need adjusted speeds drop me a PM and I will give you values to use with the formula.
For the best approximation I need the following values:

MAX Real World Speed in KM/H or MP/H corresponding to the vehicle AND the vehicle's MAX GTA Velocity
Please use "f1.6%" precision for the GTA speed.

Like:

Vehicle NameMax World SpeedMax GTA speed
Bike250.025000
Infernus1750.090000
Hydra3000.120000
(code:[remove dot from [ ttable]])
Код:
[.ttable]
[tr][td]Vehicle Name[/td][td]Max World Speed[/td][td]Max GTA speed[/td][/tr]
[tr][td]Bike[/td][td]25[/td][td]0.025000[/td][/tr]
[tr][td]Infernus[/td][td]175[/td][td]0.090000[/td][/tr]
[tr][td]Hydra[/td][td]300[/td][td]0.120000[/td][/tr]
[/ttable]
Or if you want to do it yourself:

Exponential Regression

Edit:

Well, I just got to make other functions with other real speeds:
pawn Код:
//velocity - velX*velX+velY*velY+velZ*velZ
//bike- 40KMH, infernus- 180KMH, Hydra- 346KMH
stock Float:GetSpeedInKPHlo(Float:velocity)
{
    return (11.211*floatpower(velocity,2.0))+(128.55*velocity);
}

//bike- 48KMH, infernus- 321KMH, Hydra- 949KMH
stock Float:GetSpeedInKPHhia(Float:velocity)
{
    return (35.564*floatpower(velocity,3.0))+(44.432*floatpower(velocity,2.0))+(142.15*velocity);
}

//bike- 40KMH, infernus- 180KMH, Hydra- 500KMH
stock Float:GetSpeedInKPHhib(Float:velocity)
{
    return (35.564*floatpower(velocity,3.0))-(44.432*floatpower(velocity,2.0))+(142.15*velocity);
}

//bike- 40KMH, infernus- 280KMH, Hydra- 1200KMH
stock Float:GetSpeedInKPHhic(Float:velocity)
{
    return (113.53*floatpower(velocity,3.0))-(83.693*floatpower(velocity,2.0))+(146.89*velocity);
}
also my max velocity measurements:
Bike - 0.303138
Infernus - 1.261432
Hydra - 2.250000
pawn Код:
new Float:maxspeed = 0.0;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/reset", true) == 0) {
        maxspeed = 0.0;
        return 1;
    }

    return 0;
}

public OnPlayerUpdate(playerid)
{
    if(GetPlayerVehicleID(playerid))
    {
        new Float:vec[4];
        GetVehicleVelocity(GetPlayerVehicleID(playerid),vec[0],vec[1],vec[2]);
        vec[3] = vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2];
        if(vec[3] > maxspeed)
            maxspeed = vec[3];
        new string[64];
        format(string,64,"Max speed: %1.6f",maxspeed);
        SendClientMessage(playerid,-1,string);
    }
    return 1;
}
and IMHO, a simple formula with speed*magic number is complete bullshit for real (world) speeds.
You cant just base the whole vehicles speed on the bike speed thats just wrong.
Reply
#32

Somehow I dont get why you want the "real world speed" with quadratic or cubic calculation ingame. It might look nice when used for a speedmeter or whatever, but it actually doesnt tell anything about the speed of the vehicle. Velocity is a linear value that resembles the speed of the vehicle in the gta world. Moving with doubled speed also means the velocity doubles, and so the ingame kmh/mph doubles. Some polynomial speed value would be rather confusing: You double the ingame speed, but the speedmeter just goes up like 50%. The speedmeter then doesnt give you any hint about how fast you are moving, but just about how fast you would be IRL. I dont get why you would want that.
Reply
#33

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Somehow I dont get why you want the "real world speed" with quadratic or cubic calculation ingame. It might look nice when used for a speedmeter or whatever, but it actually doesnt tell anything about the speed of the vehicle. Velocity is a linear value that resembles the speed of the vehicle in the gta world. Moving with doubled speed also means the velocity doubles, and so the ingame kmh/mph doubles. Some polynomial speed value would be rather confusing: You double the ingame speed, but the speedmeter just goes up like 50%. The speedmeter then doesnt give you any hint about how fast you are moving, but just about how fast you would be IRL. I dont get why you would want that.
I have to agree with you 100% with what you explaining and I would like to add that velocity should be based off the unit measurement in GTA which is meant to simulate real world measurements. If you want to get a vehicle to show the "real world" velocity you need to adjust the velocity of the object it's self to be accurate.
Reply
#34

I've taken care of that issue and here is my solution:

I used the LS airport runway and mapped 100 of them behind each other above the sea to get a perfectly flat, long straight road. I placed the Infernus at the beginning of the track and ran this code:

pawn Код:
new Float:oldvel;
new Float:startX, Float:startY, Float:startZ;
new Float:endX, Float:endY, Float:endZ;

//This function is called every 250 milliseconds (4 times a second)
public Speedo(playerid)
{
    new Float:newX, Float:newY, Float:newZ;
    if(IsPlayerInAnyVehicle(playerid)) //Player is inside a vehicle
    {
        GetVehicleVelocity(GetPlayerVehicleID(playerid), newX, newY, newZ); //Gets the X Y and Z velocity of the vehicle
        new Float:newvel = floatsqroot(floatmul(newX, newX) + floatmul(newY, newY) + floatmul(newZ, newZ)); //Calculates the velocity of the vehicle
        if(newvel > oldvel) //The newly recorded velocity is bigger than the perviously recorded velocity (At the very beginning oldvel is 0.0 obviously).
        {
            new msg[128];
            format(msg, sizeof(msg), "Velocity: %.4f", newvel);
            oldvel = newvel; //The old velocity is new the newly recorded velocity. This is saved to use the value again the next time the velocity is checked
            SendClientMessage(playerid, -1, msg);
        }
        else if(newvel <= oldvel) //The newly recorded velocity is smaller or equal to the previously recorded velocity, which means the vehicle topped out and will not gain any more velocity. It's arrived at it's topspeed
        {
            KillTimer(timer); //The timer is stopped
            timetimer = SetTimerEx("Time", 1000, false, "i", playerid); //Sets up a timer that calls "Time" after 1 second.
            GetPlayerPos(playerid, startX, startY, startZ); //Saves the position of the vehicle
            SendClientMessage(playerid, -1, "Starting to record");
           
        }
    }
    return 1;
}

public Time(playerid)
{
    GetPlayerPos(playerid, endX, endY, endZ); //Saves the new position of the vehicle (1 second after it was saved the first time)
    new Float:distance = floatsub(startX, endX); //Calculates the distance between the 1st and 2nd saved position of the vehicle. I can simply subtract the X coordinates because the vehicle drove perfectly parallel to the X-axis.
    //We now have the distance the vehicle travelled in 1 second with topped out speed (max. velocity). The unit is m/s
    new Float:speed = floatmul(distance, 3.6); //Converts m/s in km/h
    new msg[128];
    format(msg, 128, "You travelled %.4f m in 1 second, that makes %.4f km/h", distance, speed);
    SendClientMessage(playerid, -1, msg);
    KillTimer(timetimer);
    return 1;
}
What I basically did is I accelerated the Infernus until it didn't get any faster. I then saved it's position and did it again after 1 second. I can now calculate the distance the vehicle travelled in this second. Since the GTA: SA distance unit is meter, the unit is m/s.
Having this done, the Infernus topped at 247.5km/h.
For the sake of it I also tested the DFT-30 and Rumpo. They topped out at 145km/h and 122km/h, which, to be fair, seems pretty legit to me.

Dividing max. velocity/associated speed gives me ~199, which pretty much confirms previous calculations here.
Which leads to: Speed in km/h = sqrt(max X velocity^2 + max Y velocity^2 + max Z velocity^2) * 199
To get an accurate value all vehicles should be tested though.
Reply
#35

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Dude your number is still completely out to lunch look at my tests your test completely fails even Drebin got closer although still off furthermore where are your proofs? videos? and code?

Anyways your results are in MPH so I calcuated the results I'm getting with the Turismo and I'm getting.

120.8 mph approx with the other two tests within a mile or two, your close but still because of your method of calculation your losing a lot of accuracy which is bringing your results out of line. That is why I think your test fails to make a adequate calculation however it is definitely better than a lot of others.
My proof is in my post. I used SetPlayerVelocity for a consistent velocity, and a timer at an interval of 2 seconds, using Slice's timer fix, which is very accurate if you check the link in my post. Further, I made sure to only measure the one axis. I made sure that it was facing that the vehicle was facing that axis perfectly, so that it only traveled along that axis. Consistent velocity on a single axis + precise timers = accurate measurement of distance traveled per time.
Reply
#36

How can you possibly verify that the distance your getting is accurate?
How is anyone supposed to know what all your values mean? Write out vehicles used and the results from each.
Where is your code so others can try and verify your results?
Where is comparisons against other systems to verify results?
Why calculate in miles per hour? GTA uses meters calculate for meters first then convert to miles and makes it a pain in the ass to compare results.

Please answer all these questions.

Also consider eliminating the need for SetVehicleVelocity() use only native top speeds.
Reply
#37

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
How can you possibly verify that the distance your getting is accurate?
I use a consistent velocity, a single axis, and Slice's timer fix.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
How is anyone supposed to know what all your values mean? Write out vehicles used and the results from each.
They are labelled appropriately. It does not matter what vehicle I used.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Where is your code so others can try and verify your results?
I could post it and I may well still but I have outlined the process in my post. If anybody would like to verify my results, they should feel free to follow the instructions stated in my post.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Where is comparisons against other systems to verify results?
The system I am using is sufficient. The process is supported by mathematical theory. Other systems would be inferior.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Why calculate in miles per hour? GTA uses meters calculate for meters first then convert to miles and makes it a pain in the ass to compare results.
If that's a suggestion, I already calculate in meters per second as stated and then convert to miles. I use miles because that's the appropriate unit of measurement in my country and so it makes the most sense to me.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Also consider eliminating the need for SetVehicleVelocity() use only native top speeds.
My use of SetVehicleVelocity is not supposed to emulate the top speed of the vehicle. It does not matter what speed I am going at. SetVehicleVelocity is used to maintain a consistent velocity along a single axis.
Reply
#38

Ok, I did some more verifying and I apologize your MPH output was fucking me up anyways here are the results.

Your result
Speed: 104.809150 mph - Velocity: 0.929587, 0.000102, 0.000000 - Magic Number: 112.747978

My Result using Sultan (Approx same velocity)
Speed: 170km/h or 105.633mph
Velocity: 0.938

So actually our results are very much in line, I want to ask you if you could please do two more tests using a Tug and a Infernus to compare high / low values against our systems thanks of course only show the top speed outputs of each vehicle.

This is good because now we have 4 different systems returning the approximate same result 4 different ways, I think that boosts confidence in the magic number chosen.
Reply
#39

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Ok, I did some more verifying and I apologize your MPH output was fucking me up anyways here are the results.

Your result
Speed: 104.809150 mph - Velocity: 0.929587, 0.000102, 0.000000 - Magic Number: 112.747978

My Result using Sultan (Approx same velocity)
Speed: 170km/h or 105.633mph
Velocity: 0.938

So actually our results are very much in line, I want to ask you if you could please do two more tests using a Tug and a Infernus to compare high / low values against our systems thanks of course only show the top speed outputs of each vehicle.

This is good because now we have 4 different systems returning the approximate same result 4 different ways, I think that boosts confidence in the magic number chosen.
After running the tests, I fucked around with the system a bunch without making a backup and now the values are off. I don't really have time to fix it at the moment but if I'll try and figure out what I messed up and then I'll post the results in the future. Sorry about that. I'm getting the same magic number but somehow achieving how higher velocities in the cars than I was previously able to.
Reply
#40

It's okay, I'm just happy that someone actually came up with very similar results.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)