Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

Thread: C# Udp V2 library

  1. #21
    WMD Member Sampo's Avatar
    Join Date
    Jun 2012
    Location
    Finland
    Posts
    677
    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.8 GHz | Motherboard Gigabyte Z390 Aorus Pro | RAM 16GB DDR4 3200MHz | GPU nVidia GTX980 4GB (430.64) | Audio Realtek 5.1 on MB | Screen AOC U3477PQU | OS Windows 10 Pro 64-bit | Wheel Logitech G27
    In-game settings: 2560x1080 / 3440x1440 | Texture Resolution HIGH | AF 16x | VSync ON | AA None | Reflections MED | Envmap MED | Vehicle HIGH | World HIGH | Shadows MED | Motion Blur NO | Render Frames Ahead 1 | Particles MED/MED/MED

    PC2Info, a PC program that shows most stats the game provides over UDP

  2. #22
    Superkart Pilot Maskmagog's Avatar
    Join Date
    Sep 2017
    Posts
    516
    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, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - unified leaderboards - Forum thread

  3. #23
    Superkart Pilot Zeratall's Avatar
    Join Date
    Oct 2017
    Location
    Arizona
    Posts
    327
    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
    Posts
    516
    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, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - unified leaderboards - Forum thread
    The following user likes this Post: cpcdem


  5. #25
    Superkart Pilot Zeratall's Avatar
    Join Date
    Oct 2017
    Location
    Arizona
    Posts
    327
    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 2 users likes this Post: Maskmagog, ZeDuncan


  6. #26
    GT3 Pilot
    Join Date
    Jul 2017
    Posts
    3,461
    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
    Posts
    516
    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, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    Project CALC - unified leaderboards - Forum thread

  8. #28
    Superkart Pilot Killg0re NL's Avatar
    Join Date
    Sep 2017
    Location
    Netherlands
    Posts
    167
    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
    677
    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.8 GHz | Motherboard Gigabyte Z390 Aorus Pro | RAM 16GB DDR4 3200MHz | GPU nVidia GTX980 4GB (430.64) | Audio Realtek 5.1 on MB | Screen AOC U3477PQU | OS Windows 10 Pro 64-bit | Wheel Logitech G27
    In-game settings: 2560x1080 / 3440x1440 | Texture Resolution HIGH | AF 16x | VSync ON | AA None | Reflections MED | Envmap MED | Vehicle HIGH | World HIGH | Shadows MED | Motion Blur NO | Render Frames Ahead 1 | Particles MED/MED/MED

    PC2Info, a PC program that shows most stats the game provides over UDP

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
  •