The online racing simulator
Draft checking with IS_MCI: help wanted
I have number of questions about it:
  • How close should the catching car be to have the slipstream?
  • How wide the slipstream is?
  • At what speeds does it come into play?
  • Are there variations for different cars?
  • What is reasonable vertical margin if cars move on a sloping surface?
Any help would be appreciated -- links, your experience, source code (any language).
For example LFSLazy checks for cars that are 0.3s ahead and within 10° of car's direction.
Quote from DANIEL-CRO :For example LFSLazy checks for cars that are 0.3s ahead and within 10° of car's direction.

0.3s is time gap here, isn't it?
Yep.
If cars are traveling at speed of 180 km/h (50 m/s), it means that car ahead has to be 15 m or closer. Also there is requirement that draft lasts for at least 2 s, so laps aren't invalidated immediately.
I'm not saying that this algorithm is perfect, but I believe it's a good basis. Main purpose is to invalidate drafted laps of course, at it does that much better than some other InSim's that just check for cars near regardless of their speed or direction ...
If you are interested I can provide you my code and you can improve it even further.
Quote from DANIEL-CRO :
If you are interested I can provide you my code and you can improve it even further.

That would be very nice of you Smile
This is basically the loop that checks drafting. Modified it for easier understanding, hope nothing is messed up Big grin

for (int i = 0; Car[i].PLID && i<_countof(Car); i++)
{
if (Car[i].Info&CCI_LAG) continue;
if (Car[i].PLID == myPLID) continue;

float Dist = PointDistance(Car[i].X, Car[i].Y, Car[myCar].X, Car[myCar].Y);
if (Dist / 65536 / my.speed < 0.3) //find cars within 0.3s
{
float Angle = -atan2f((float)(Car[myCar].X - Car[i].X), (float)(Car[myCar].Y - Car[i].Y));
float Heading = (float)Car[myCar].Heading * PI / 32768 - PI;
if (fabs(atan2(sin(Angle - Heading), cos(Angle - Heading))) < DtoR(10) /*degrees to radians*/)
{
DraftingThis = 1;
if (clkDraftStart == 0) clkDraftStart = clock();
else if (clock() - clkDraftStart > 2000)
{
echo(L_SND_ERROR, "Invalid lap (draft)");
SaveLap = 0;
clkDraftStart = 0;
}
}
}
}

Thanks Daniel, it seems to be pretty easy to integrate into my project. And I would have spent days figuring out those formulas Smile

FGED GREDG RDFGDR GSFDG