While programming the modules that handle the race results for my league website I've come up with some unusual cases that I was curious about how LFS would deal with them. It's about time addition penalties.
The question is: how one driver with a time penalty compares to another one without any penalty but finishes a lap behind.
First test (prueba.mpr attached):
On a 3 laps race with mandatory pitstop, 2 drivers, the leader receives a +30 seconds penalty during his pitstop for speeding in the pitlane. This guy goes on and laps the other driver and finishes the 3 laps race length with his penalty (at this moment the "laps and laptime indicator" in the OSD turns orange). After him the other driver crosses the finish line with 2 laps and no penalty. What happens now? In this case it's quite confussing as the results table doesn't get filled. It only shows the first guy with the '?' in the position. The second driver who crossed the line doesn't appear, he crossed the line after the leader but didn't finish the race yet! This second driver must complete another lap, his third, and then LFS will generate the IS_RES packets for both drivers and sort them accordingly.
Results:
1st: the first guy who received the +30s penalty, with 3 laps and 3:25 total time (+30s added).
2nd: the other guy with no penalty, 3 laps and 3:52 total time.
I think this is OK, but confusing, because the second driver thinks he has finished when he crosses the line after the leader because the laps in the top right corner are orange. The truth is, given the leaders penalty, when he crosses the finish line LFS doesn't consider that the race has finished and so any other driver must complete the race length before comparing times.
Second test (prueba2.mpr attached):
This one is trickier! Now we have 3 cars and 2 laps (no pitstop). Driver A is issued a +45 seconds penalty by the admin (he could have made a jump start and the result would be the same). Driver B runs like hell and catches up to both A and C. When driver B finishes his second lap the order is this: A (+45s) -> B -> C. The time difference between A and C is about 4 seconds at this point. The race is won by B with 2 laps and 1:54 total time. After him C finishes in '?' pos with 1 lap and 1:57 (IS_RES pending for him). Driver A completes his second lap and finishes with 2 laps and 3:29 total time.
Results:
1st: B, 2 laps, 1:54 time.
2nd: A, 2 laps, 3:29 time (+45 added).
3rd: C, 1 lap, 1:57 time.
How does this look? Consider that drivers A and C were 4 seconds apart when B finished the race, with the difference that A was ahead of B and completed a second lap, and C was behind and finished with +1 lap.
If A had been lapped by B he had finished with +1 lap, and with the +45 seconds he would have gone 41 seconds behind C, final results being B -> C -> A.
If C hadn't been lapped by B, both A and C would have done the second lap, and probably the 4 seconds gap wouldn't have grown to more than 45 seconds in that lap. The final result would have been also B -> C -> A.
What happens here is that drivers are sorted first on the number of laps completed, and second on the time elapsed to complete those laps. Driver A has completed one more lap than C, and the +45s penalty doesn't mean any harm to him.
If it had been a stop&go instead of a +45s the thing would change, because at some point he would have needed to complete the penalty and the 4 seconds gap to C would have vanished. And there's no possibility to complete a stop&go on the last lap because you get automatically disqualified for that.
Any thoughts on this? I'm trying to make an automated system that handles penalties well, but I don't know what to do in these situations! What I do know is that I don't like these time addition penalties because they lead to weird consequences like the ones described
The question is: how one driver with a time penalty compares to another one without any penalty but finishes a lap behind.
First test (prueba.mpr attached):
On a 3 laps race with mandatory pitstop, 2 drivers, the leader receives a +30 seconds penalty during his pitstop for speeding in the pitlane. This guy goes on and laps the other driver and finishes the 3 laps race length with his penalty (at this moment the "laps and laptime indicator" in the OSD turns orange). After him the other driver crosses the finish line with 2 laps and no penalty. What happens now? In this case it's quite confussing as the results table doesn't get filled. It only shows the first guy with the '?' in the position. The second driver who crossed the line doesn't appear, he crossed the line after the leader but didn't finish the race yet! This second driver must complete another lap, his third, and then LFS will generate the IS_RES packets for both drivers and sort them accordingly.
Results:
1st: the first guy who received the +30s penalty, with 3 laps and 3:25 total time (+30s added).
2nd: the other guy with no penalty, 3 laps and 3:52 total time.
I think this is OK, but confusing, because the second driver thinks he has finished when he crosses the line after the leader because the laps in the top right corner are orange. The truth is, given the leaders penalty, when he crosses the finish line LFS doesn't consider that the race has finished and so any other driver must complete the race length before comparing times.
Second test (prueba2.mpr attached):
This one is trickier! Now we have 3 cars and 2 laps (no pitstop). Driver A is issued a +45 seconds penalty by the admin (he could have made a jump start and the result would be the same). Driver B runs like hell and catches up to both A and C. When driver B finishes his second lap the order is this: A (+45s) -> B -> C. The time difference between A and C is about 4 seconds at this point. The race is won by B with 2 laps and 1:54 total time. After him C finishes in '?' pos with 1 lap and 1:57 (IS_RES pending for him). Driver A completes his second lap and finishes with 2 laps and 3:29 total time.
Results:
1st: B, 2 laps, 1:54 time.
2nd: A, 2 laps, 3:29 time (+45 added).
3rd: C, 1 lap, 1:57 time.
How does this look? Consider that drivers A and C were 4 seconds apart when B finished the race, with the difference that A was ahead of B and completed a second lap, and C was behind and finished with +1 lap.
If A had been lapped by B he had finished with +1 lap, and with the +45 seconds he would have gone 41 seconds behind C, final results being B -> C -> A.
If C hadn't been lapped by B, both A and C would have done the second lap, and probably the 4 seconds gap wouldn't have grown to more than 45 seconds in that lap. The final result would have been also B -> C -> A.
What happens here is that drivers are sorted first on the number of laps completed, and second on the time elapsed to complete those laps. Driver A has completed one more lap than C, and the +45s penalty doesn't mean any harm to him.
If it had been a stop&go instead of a +45s the thing would change, because at some point he would have needed to complete the penalty and the 4 seconds gap to C would have vanished. And there's no possibility to complete a stop&go on the last lap because you get automatically disqualified for that.
Any thoughts on this? I'm trying to make an automated system that handles penalties well, but I don't know what to do in these situations! What I do know is that I don't like these time addition penalties because they lead to weird consequences like the ones described