• Welcome to PiBoSo Official Forum. Please login or sign up.
 
March 28, 2024, 09:58:06 PM

News:

GP Bikes beta21c available! :)


Bug in RaceClassification ?

Started by HornetMaX, June 28, 2016, 09:09:37 PM

Previous topic - Next topic

HornetMaX

@Piboso: we did a short test race tonight to test some plugin stuff. I think Ive found something fishy.

We were 5, we started and did a first lap: all the 5 crossed the finish line ans we stopped right after.
Here's a pretty-print of the RaceClassification data at that point (should be self explanatory to you), all good:

@RaceClassification
  : Session = Race [2/4, State = 16, Time = 145787]
  01) # 87 (0) [144209  39.93 1] [1 laps, gap = 0 (+0 laps)] 0 0
  02) # 58 (0) [144821  40.99 1] [1 laps, gap = 611 (+0 laps)] 0 0
  03) # 90 (0) [145135  41.69 1] [1 laps, gap = 925 (+0 laps)] 0 0
  04) # 17 (0) [145300  38.82 1] [1 laps, gap = 1091 (+0 laps)] 0 0
  05) # 92 (0) [145734  41.61 1] [1 laps, gap = 1525 (+0 laps)] 0 0
@END RaceClassification


The I asked two riders (87 and 90) to completed another lap and stop after crossing the finish line, while the other riders didn't move.
At that point the 3 other riders are essentially lapped, but as they haven't yet crossed the finish line again, their gap laps are not updated (still 0):

@RaceClassification
  : Session = Race [2/4, State = 16, Time = 278627]
  01) # 87 (0) [133822  68.43 2] [2 laps, gap = 0 (+0 laps)] 0 0
  02) # 90 (0) [133431  53.84 2] [2 laps, gap = 534 (+0 laps)] 0 0
  03) # 58 (0) [144821  40.99 1] [1 laps, gap = 611 (+0 laps)] 0 0
  04) # 17 (0) [145300  38.82 1] [1 laps, gap = 1091 (+0 laps)] 0 0
  05) # 92 (0) [145734  41.61 1] [1 laps, gap = 1525 (+0 laps)] 0 0
@END RaceClassification


Now form there, all the 5 riders completed another lap, crossed the finish ine and stopped there.
And here's the weird stuff:

@RaceClassification
  : Session = Race [2/4, State = 16, Time = 463007]
  01) # 87 (0) [133822  68.43 2] [3 laps, gap = 0 (+0 laps)] 0 0
  02) # 90 (0) [133431  53.84 2] [3 laps, gap = 818 (+0 laps)] 0 0
  03) # 17 (0) [145300  38.82 1] [2 laps, gap = 184066 (+0 laps)] 0 0
  04) # 58 (0) [144821  40.99 1] [2 laps, gap = 184503 (+0 laps)] 0 0
  05) # 92 (0) [145734  41.61 1] [2 laps, gap = 184908 (+0 laps)] 0 0
@END RaceClassification


As you can see above, the 3 "other riders" (17, 58 and 92) are lapped but their gap laps are still at zero.
Their gap time however is "somehow correct', in the sense it's more than one lap.

It seems to me there's something wrong in the counting of m_iGapLaps: it looks like m_iGapLaps is 1 only when the difference between te laps made by the leader and the laps made by the "other" rider is 2. Example here below: from the previous situation, all the riders did another lap; when the 1st rider crosses the finish line and the others have not yet crossed it, I get:

@RaceClassification
  : Session = Race [2/4, State = 16, Time = 630047]
  01) # 90 (0) [133431  53.84 2] [4 laps, gap = 0 (+0 laps)] 0 0
  02) # 87 (0) [133822  68.43 2] [3 laps, gap = 0 (+0 laps)] 0 0
  03) # 17 (0) [145300  38.82 1] [2 laps, gap = 0 (+1 laps)] 0 0
  04) # 58 (0) [144821  40.99 1] [2 laps, gap = 0 (+1 laps)] 0 0
  05) # 92 (2) [145734  41.61 1] [2 laps, gap = 0 (+1 laps)] 0 1
@END RaceClassification


So now riders 17 and 58 (92 was in the pit by then) are shown with a 1 lap gap, but that's just because the haven;t yet crossed the line, as soon as they do we get:

@RaceClassification
  : Session = Race [2/4, State = 16, Time = 633587]
  01) # 90 (0) [133431  53.84 2] [4 laps, gap = 0 (+0 laps)] 0 0
  02) # 87 (0) [133822  68.43 2] [4 laps, gap = 289 (+0 laps)] 0 0
  03) # 58 (0) [144821  40.99 1] [3 laps, gap = 173918 (+0 laps)] 0 0
  04) # 17 (0) [145300  38.82 1] [3 laps, gap = 175426 (+0 laps)] 0 0
  05) # 92 (2) [145734  41.61 1] [2 laps, gap = 0 (+1 laps)] 0 1
@END RaceClassification




HornetMaX


PiBoSo

Quote from: HornetMaX on July 03, 2016, 10:09:49 PM
Bug ? No bug ?

Not a bug. The gap is calculated on the last same lap, unless the race is over and the riders behind cannot complete a new lap anymore.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

HornetMaX

Quote from: PiBoSo on July 03, 2016, 11:14:11 PM
Quote from: HornetMaX on July 03, 2016, 10:09:49 PM
Bug ? No bug ?

Not a bug. The gap is calculated on the last same lap, unless the race is over and the riders behind cannot complete a new lap anymore.
For the m_iGapTime that's OK, but if player A (leader) crosses the line completing his 5th lap and after that player B crosses the line completing his 4th lap, then player B's m_iGapLap should be 1 I think: you do know player B has been lapped.

Side question: RaceClassification is called with a relatively high frequency: why ? The classification data seems to be updated only when a rider crosses the finish line ...

PiBoSo

Quote from: HornetMaX on July 03, 2016, 11:32:35 PM
Quote from: PiBoSo on July 03, 2016, 11:14:11 PM
Quote from: HornetMaX on July 03, 2016, 10:09:49 PM
Bug ? No bug ?

Not a bug. The gap is calculated on the last same lap, unless the race is over and the riders behind cannot complete a new lap anymore.
For the m_iGapTime that's OK, but if player A (leader) crosses the line completing his 5th lap and after that player B crosses the line completing his 4th lap, then player B's m_iGapLap should be 1 I think: you do know player B has been lapped.

This is a probably a bug.
Thank you for the report.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

HornetMaX


HornetMaX

Forgot that:

Quote from: HornetMaX on July 03, 2016, 11:32:35 PM
Side question: RaceClassification is called with a relatively high frequency: why ? The classification data seems to be updated only when a rider crosses the finish line ...