Results 1 to 9 of 9

Thread: Memory Mapped File gives incorrect Lap Number for Online events?

  1. #1
    Kart Driver
    Join Date
    Oct 2017
    Posts
    9
    Platform
    PC

    Memory Mapped File gives incorrect Lap Number for Online events?

    Hi folks,

    I've noticed when trying to read the PC2 format Memory Mapped File (MMF) that when running online events the lap number does not always change on crossing the line.

    I would post an example, but apparently I'm not allowed links. So check the "Vintage Spring" event on the "UnstopaPaul" youtube channel at 3m28s to see this occurring.

    you can see that lap 3 only registers in the last corner before lap 4 - almost a full lap later. On other tracks (e.g. Sakitto) it generally seems to register about 2 corners in.

    • This problem does not occur with offline events.
    • All other telemetry data lines up with what was happening at the time (e.g. current lap time)
    • I'm taking Lap Number straight from telemetry like every other piece of data.


    I'm trying to work around this by using the resetting of lap time to indicate the change of lap. This works ok, but means I lose the ability for the app to be launched mid session and understand which lap it is truly on.

    Any of the devs want to help a guy out here? Is this a confirmed issue?

  2. #2
    GT4 Pilot
    Join Date
    Jul 2017
    Posts
    2,627
    Platform
    PC
    Are you absolutely sure you are reading the lap number for the correct car and not from another one? It could explain the problem if you are accidentally reading the current lap for another car and the info updates at the time that car passes the finish line.

    I will also have an eye open in my next online races to see if this value updates correctly.

    Edit: thinking more about it, this must be it. You are always reading the current lap from mParticipantInfo[0], right? This works fine in offline, because there the user's car is always the first in the list, but online it can be anywhere, so you need to locate the correct entry first.
    Last edited by cpcdem; 15-05-2018 at 02:58.
    The following 2 users likes this Post: blinkngone, cluck


  3. #3
    WMD Member Shepard2603's Avatar
    Join Date
    Sep 2012
    Location
    Bedburg
    Posts
    234
    Platform
    PC
    Got your 6 Paul! Here is the link:
    Last edited by Shepard2603; 15-05-2018 at 07:54.
    Rig: Intel Core i5 4670K - Gigabyte GTX1060 G1 Gaming 6G - Gigabyte GA-Z97P-D3 - 16GB A-Data 2133 - Fanatec CSL Elite Base - Fanatec CSL P1 Wheel - Fanatac CLS Elite Pedals LC - Windows 10


    Member of Revolution Sim Racing

  4. #4
    Kart Driver
    Join Date
    Oct 2017
    Posts
    9
    Platform
    PC
    Quote Originally Posted by cpcdem View Post
    Are you absolutely sure you are reading the lap number for the correct car and not from another one? It could explain the problem if you are accidentally reading the current lap for another car and the info updates at the time that car passes the finish line.

    I will also have an eye open in my next online races to see if this value updates correctly.

    Edit: thinking more about it, this must be it. You are always reading the current lap from mParticipantInfo[0], right? This works fine in offline, because there the user's car is always the first in the list, but online it can be anywhere, so you need to locate the correct entry first.
    OMG. THis is what happens when you write and wrap some code up then leave your project for 2 weeks . That is an amazing shout. I can confirm I'm doing that (there's even a comment beside that code to come back and verify it is always participant 0). I will try that change, but it already sounds like the winner. Hopefully I can confirm this evening

    Thank you so much!

    (PS. I'm guessing [0] is the first person into lobby then?)
    The following 2 users likes this Post: blinkngone, cpcdem


  5. #5
    Superkart Pilot MaXyM's Avatar
    Join Date
    Nov 2011
    Location
    Prague
    Posts
    990
    Platform
    PC
    Please also note the array might be reordered in case participants are joining/leaving the session. It's at least what I've heard from another developer.
    Use unique identifier to match particular driver.
    MSI Z270 Tomahawk | i5 7600K@4.9GHz | 16GB RAM | Scythe Mugen 4 PCGH | MSI GTX1080Ti + Accelero Xtreme IV | HTC Vive | TX+custom wheel+t3pa Pro | custom cockpit

  6. #6
    GT4 Pilot
    Join Date
    Jul 2017
    Posts
    2,627
    Platform
    PC
    Quote Originally Posted by RacingSaul View Post
    OMG. THis is what happens when you write and wrap some code up then leave your project for 2 weeks . That is an amazing shout. I can confirm I'm doing that (there's even a comment beside that code to come back and verify it is always participant 0). I will try that change, but it already sounds like the winner. Hopefully I can confirm this evening

    Thank you so much!

    (PS. I'm guessing [0] is the first person into lobby then?)
    Glad I could help! I'm pretty sure I was caught by the same thing, too, before I realized it's not always my car first in the array.
    About [0] being the first person in the lobby, that's my guess, too, but I have not checked it, I am always reordering based on current race position anyway, so it did not make a difference to me.
    The following user likes this Post: blinkngone


  7. #7
    Kart Driver
    Join Date
    Oct 2017
    Posts
    9
    Platform
    PC
    Quote Originally Posted by MaXyM View Post
    Please also note the array might be reordered in case participants are joining/leaving the session. It's at least what I've heard from another developer.
    Use unique identifier to match particular driver.
    So for safety always look up the array based on player name? Thanks for the tip

  8. #8
    Kart Driver
    Join Date
    Oct 2017
    Posts
    9
    Platform
    PC
    SOLVED

    Superstars all of you. Thanks so much!

    I'm now using data.mParticipantData[data.mViewedParticipantIndex].mCurrentLap to find player, and this seems to work on some recorded data. (I'm feeling smug for having a debug logger that just dumps every raw PC2 MMF frame sample to disk so I can replay it in tests through my parser )

    I haven't checked, but as mViewedParticipantIndex comes through with every frame, I'd expect it to update with leavers/joiners.

  9. #9
    GT4 Pilot
    Join Date
    Jul 2017
    Posts
    2,627
    Platform
    PC
    Quote Originally Posted by RacingSaul View Post
    So for safety always look up the array based on player name? Thanks for the tip
    That's what I always do. For me it's simple, because I am the only one who uses my apps, so I have hard coded the name

Similar Threads

  1. PC2Info, a PC program that shows most stats the game provides over UDP
    By Sampo in forum Third-Party Apps & API Discussion
    Replies: 53
    Last Post: 18-08-2018, 22:42
  2. Number of players online
    By demadou in forum Project CARS 2 on Playstation 4
    Replies: 5
    Last Post: 03-03-2018, 16:19
  3. Quick question: Yellow number online?
    By TheBaldReverend in forum General Discussion
    Replies: 2
    Last Post: 23-01-2018, 10:40
  4. Solved: Mapped keys not working with Logitech MOMO force feedback wheel
    By Paulblack71 in forum Technical Help & Support (PC)
    Replies: 5
    Last Post: 23-10-2017, 20:56
  5. Replies: 2
    Last Post: 07-10-2017, 12:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •