Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39

Thread: C# Udp V2 library

  1. #21
    WMD Member Sampo's Avatar
    Join Date
    Jun 2012
    Location
    Finland
    Posts
    749
    Platform
    PC
    Remember that the PacketBase contains 3 important values. mPartialPacketIndex, mPartialPacketNumber, mPacketType. Without those you can't decipher the udp packets correctly. Unless your library does that for the user, of course.
    CPU Intel i7-9700K @ 4.9 GHz all cores | Motherboard Gigabyte Z390 Aorus Pro | RAM 16GB DDR4 3200MHz | GPU nVidia RTX2070 Super 8GB (451.48) | Audio Realtek 5.1 on MB | Screen AOC U3477PQU | OS Windows 10 Pro 64-bit | Wheel Logitech G27
    In-game settings: 3440x1440 | Texture Resolution HIGH | AF 16x | VSync ON (adaptive) | AA None | Reflections HIGH | Envmap HIGH | Vehicle HIGH | World HIGH | Shadows HIGH | Motion Blur NO | Render Frames Ahead 1 | Particles HIGH/HIGH/HIGH

    PC2Info, a PC program that shows most stats the game provides over UDP
    "Dunning–Kruger effect is strong in simracing."

  2. #22
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    Location
    Sweden
    Posts
    682
    Platform
    XBOX1 X
    Thanks, it makes more and more sense to me. I enjoy tampering with things like this, but sometimes it's a bit overwhelming.
    Thrustmaster TX, Italia 458 wheel, T3PA-Pro, Firmware 54, Xbox One X, public OS, 28" 4K monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - proper PC2 leaderboards for console - Forum thread

  3. #23
    Superkart Pilot Zeratall's Avatar
    Join Date
    Oct 2017
    Location
    Arizona
    Posts
    357
    Platform
    PC
    Quote Originally Posted by Sampo View Post
    Remember that the PacketBase contains 3 important values. mPartialPacketIndex, mPartialPacketNumber, mPacketType. Without those you can't decipher the udp packets correctly. Unless your library does that for the user, of course.
    It does that for them currently in the object definition.

  4. #24
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    Location
    Sweden
    Posts
    682
    Platform
    XBOX1 X
    Thanks @cpcdem, I could actually get it to work! My understanding of arrays has gone from 3% to at least 12%
    Thrustmaster TX, Italia 458 wheel, T3PA-Pro, Firmware 54, Xbox One X, public OS, 28" 4K monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - proper PC2 leaderboards for console - Forum thread
    The following user likes this Post: cpcdem


  5. #25
    Superkart Pilot Zeratall's Avatar
    Join Date
    Oct 2017
    Location
    Arizona
    Posts
    357
    Platform
    PC
    Updated the library added, timing (split times) and then participant info, so you can get the following attributes now.

    for (int i = 0; i < 32; i++)
    {
    ParticipantInfo[i, 0] = Convert.ToDouble(binaryReader.ReadInt16()); //WorldPosition
    ParticipantInfo[i, 1] = Convert.ToDouble(binaryReader.ReadInt16()); //WorldPosition
    ParticipantInfo[i, 2] = Convert.ToDouble(binaryReader.ReadInt16()); //WorldPosition
    ParticipantInfo[i, 3] = Convert.ToDouble(binaryReader.ReadInt16()); //Orientation
    ParticipantInfo[i, 4] = Convert.ToDouble(binaryReader.ReadInt16()); //Orientation
    ParticipantInfo[i, 5] = Convert.ToDouble(binaryReader.ReadInt16()); //Orientation
    ParticipantInfo[i, 6] = Convert.ToDouble(binaryReader.ReadUInt16()); //sCurrentLapDistance
    ParticipantInfo[i, 7] = Convert.ToDouble(binaryReader.ReadByte()) - 128; //sRacePosition
    byte Sector_ALL = binaryReader.ReadByte();
    var Sector_Extracted = Sector_ALL & 0x0F;
    ParticipantInfo[i, 8] = Convert.ToDouble(Sector_Extracted+1); //sSector
    ParticipantInfo[i, 9] = Convert.ToDouble(binaryReader.ReadByte()); //sHighestFlag
    ParticipantInfo[i, 10] = Convert.ToDouble(binaryReader.ReadByte()); //sPitModeSchedule
    ParticipantInfo[i, 11] = Convert.ToDouble(binaryReader.ReadUInt16());//sCarIndex
    ParticipantInfo[i, 12] = Convert.ToDouble(binaryReader.ReadByte()); //sRaceState
    ParticipantInfo[i, 13] = Convert.ToDouble(binaryReader.ReadByte()); //sCurrentLap
    ParticipantInfo[i, 14] = Convert.ToDouble(binaryReader.ReadSingle()); //sCurrentTime
    ParticipantInfo[i, 15] = Convert.ToDouble(binaryReader.ReadSingle()); //sCurrentSectorTime
    }

    Just keep in mind the index is not equal to race position. however if you just want the data for yourself (lets say your "Current Sector Time" for your car your object called would look like this . MyCurrentSectorTime = uDP.ParticipantInfo[uDP.ViewedPlayerIndex,15].
    The following 3 users likes this Post: ermo, Maskmagog, ZeDuncan


  6. #26
    GT3 Pilot
    Join Date
    Jul 2017
    Posts
    4,403
    Platform
    PC
    Quote Originally Posted by Zeratall View Post
    Just keep in mind the index is not equal to race position. however if you just want the data for yourself (lets say your "Current Sector Time" for your car your object called would look like this . MyCurrentSectorTime = uDP.ParticipantInfo[uDP.ViewedPlayerIndex,15].
    Thanks, that's very helpful information!

  7. #27
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    Location
    Sweden
    Posts
    682
    Platform
    XBOX1 X
    Hey Zeratall and other smart people: I would like some help decoding TrackLocation. My current project is a grand plan, with the final goal to get proper leaderboards to the console people! But one thing at the time. I have almost all UDP data I need through this library, except Track Location and Track Variation. I'll be really happy if someone could help me. Here's my best attempt:

    In PCars2_UDP.cs I have the following:
    Code:
    const int TRACKNAME_LENGTH_MAX = 64;
    Code:
    private char[] _TrackLocation;
    Later in same file:
    Code:
    TrackLocation = binaryReader.ReadChars(TRACKNAME_LENGTH_MAX);
    And further down in the same file:
    Code:
     public char[] TrackLocation
            {
                get
                {
                    return _TrackLocation;
                }
                set
                {
                    _TrackLocation = value;
                }
            }

    In program.cs file I try to retrieve it like this:
    Code:
    Console.WriteLine("Track is " + uDP.TrackLocation);
    Running this a get something about "Exception: Can't read beyond end of stream" or similar.
    Last edited by Maskmagog; 29-10-2018 at 19:07. Reason: Error - public instead of private
    Thrustmaster TX, Italia 458 wheel, T3PA-Pro, Firmware 54, Xbox One X, public OS, 28" 4K monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - proper PC2 leaderboards for console - Forum thread

  8. #28
    Superkart Pilot Killg0re NL's Avatar
    Join Date
    Sep 2017
    Location
    Netherlands
    Posts
    173
    Platform
    PS4 Pro
    Quote Originally Posted by Sampo View Post
    Remember that the PacketBase contains 3 important values. mPartialPacketIndex, mPartialPacketNumber, mPacketType. Without those you can't decipher the udp packets correctly. Unless your library does that for the user, of course.
    When i am using protocol version 1 (UDP size 1367), and i turn off/on the headlight in game, the carFlags the light flag is set instantly.

    So when i am using the version 2 protocol, (UDP size 559) it takes a while before the carFlags (cfLight flag) is set. (about 4 sec)
    Could it be that i am missing what 559 packet it is?

  9. #29
    WMD Member Sampo's Avatar
    Join Date
    Jun 2012
    Location
    Finland
    Posts
    749
    Platform
    PC
    I'm not sure what you mean. If the PacketBase struct at the start of the packet (sBase) has mPacketType of eCarPhysics (0), it should give you the current light state in sCarFlags. The length of the eCarPhysics struct type (sTelemetryData) is 556, btw. Have you tried changing the PC2 protocol update speed in the game settings?

    Ouch. Just noticed that this thread is about the C# lib from Zeratall.
    Last edited by Sampo; 27-03-2019 at 22:54. Reason: noticing
    CPU Intel i7-9700K @ 4.9 GHz all cores | Motherboard Gigabyte Z390 Aorus Pro | RAM 16GB DDR4 3200MHz | GPU nVidia RTX2070 Super 8GB (451.48) | Audio Realtek 5.1 on MB | Screen AOC U3477PQU | OS Windows 10 Pro 64-bit | Wheel Logitech G27
    In-game settings: 3440x1440 | Texture Resolution HIGH | AF 16x | VSync ON (adaptive) | AA None | Reflections HIGH | Envmap HIGH | Vehicle HIGH | World HIGH | Shadows HIGH | Motion Blur NO | Render Frames Ahead 1 | Particles HIGH/HIGH/HIGH

    PC2Info, a PC program that shows most stats the game provides over UDP
    "Dunning–Kruger effect is strong in simracing."

  10. #30
    Rookie
    Join Date
    Dec 2016
    Posts
    1
    Platform
    PC
    Sorry to reanimate such an old thread,

    but I'd like to use your C# UDP library to gather some race data, Zeratall.
    (btw, thanks for the RST software! It made my racing so much better!)

    I'd like to see information about the AI drivers, but I am stuck at a very early state. As a proof of concept, I'd like to read out the position of every driver, so what I'm trying is:

    Code:
    for (int i = 0; i < 32; i++)
                   {     
                    Console.WriteLine(uDP.ParticipantInfo[i,7]);          
                   }
    However, only zeroes appear. I can read out my own position however via:

    Code:
    Console.WriteLine(uDP.ParticipantInfo[uDP.ViewedParticipantIndex,7]);
    Any idea what I am doing wrong?

Similar Threads

  1. Simresults.net - a webbased result reader & PHP library
    By Mauserrifle in forum Multiplayer
    Replies: 123
    Last Post: 19-10-2018, 12:40
  2. Interest in GTE championship?
    By p66pittfan in forum Project CARS 2 on XBOX One
    Replies: 1
    Last Post: 19-02-2018, 20:08
  3. Project Cars closed, but keeps running in steam library
    By Kunal_Racedriver in forum PC - Technical Help & Support
    Replies: 2
    Last Post: 14-02-2016, 15:41
  4. Aug old vs new DLC not showing under Library/DLC in steam
    By Kobus Maree in forum General Discussion
    Replies: 6
    Last Post: 30-08-2015, 23:02
  5. highlight video to capture library question
    By BORIStheBLADE1 in forum PS4 - Technical Help & Support
    Replies: 1
    Last Post: 19-05-2015, 02:03

Posting Permissions

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