Shared memory online opponent laptimes

Discussion in 'Community Workshop' started by mr_belowski, Jan 8, 2018.

  1. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,307 / 0 / -0
    Ayup folks,

    This is a bit of a heads-up and a bit of a bug report.

    After lots and lots of faffing and fiddling, I've come to the conclusion that the data in DriverData.SectorTimePreviousSelf.Sector3 is often incorrect in online races.

    The slot contains the last recorded sector 3 time (cumulative sector 3 time, so it's actually the laptime) of a participant. When the car crosses the start line, I'd expect this to contain the lap time of the lap he just completed - I think that's the intention.

    When racing the AI this behaves as expected - as soon as a car's current sector number changes from 3 to 1 I know he's finished a lap, so I get this value and it contains the lap time and it's correct.

    When racing online, this value is generally incorrect. It usually contains the time of the lap before - it's usually 1 lap out of date. So when a car crosses the line if I look in this slot for his lap time, it's actually got the lap time of the lap before the lap he just finished. There's no (as far as I can see) alternative source of this information - the participant lap time is simply unavailable.

    I've had to work around this by calculating the lap time using the Player.GameSimulationTime at the point when the participant crossed the line to start his lap, and the Player.GameSimulationTime when he finishes the lap. I can get reasonably accurate results (within about 0.01s) by correcting the GameSimulationTime by subtracting the DriverData.LapTimeCurrentSelf (this is generally less than 0.1 seconds, and subtracting it gives the actual time the opponent crossed the line regardless of lag, delay reading shared memory, etc).

    So it's not a major issue, but has been the source of all of the bollocks opponent lap time and sector 3 delta times that CC has been spewing out over the last few months.

    If anyone is using the DriverData.SectorTimePreviousSelf.Sector3 in the same way as I was, I recommend taking a closer look at the data it contains and maybe implementing a similar workaround.


    Jim
     
    • Useful Useful x 3
    Last edited: Jan 8, 2018
  2. Nir Tal

    Nir Tal Well-Known Member

    Joined:
    Aug 29, 2016
    Ratings:
    +53 / 0 / -0
    I get correct data but im not using SectorTimePreviousSelf - im using LapTimePreviousSelf to show the lap time of the lap i just finished.
    For the sector times im using SectorTimesCurrentSelf.SectorX for each of the sectors. After finishing the lap, SectorTimesCurrentSelf.Sector3 is correct meaning it shows the sec3 time of the lap i just finished. but i dont use it as a last lap time.
     
  3. mr_belowski

    mr_belowski Well-Known Member Beta tester

    Joined:
    Apr 23, 2015
    Ratings:
    +1,307 / 0 / -0
    Sorry, I should have been clearer. The issue only applies for opponent data (not the local player) when online
     
  4. Nir Tal

    Nir Tal Well-Known Member

    Joined:
    Aug 29, 2016
    Ratings:
    +53 / 0 / -0
    Ohh missed that
    So no LapTimePreviousSelf in DriverData...right
    And did u try to see whats the DriverData.SectorTimeCurrentSelf.Sector3 holds after lap finish ?
    I didnt check it but it make sense if the PreviousSelf shows the lap before last - then Current should shows the last (untill the started lap Sec1 is finished i guess)