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

Thread: C# Udp V2 library

  1. #21
    WMD Member Sampo's Avatar
    Join Date
    Jun 2012
    Location
    Finland
    Posts
    640
    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 i5 3570K @ 4.2 GHz | Motherboard Asus P8Z77-V LK | RAM 16GB 1600MHz DDR3 | GPU nVidia GTX980 4GB (390.77) | Audio Realtek 5.1 on MB | Screen AOC U3477PQU | OS Windows 7 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
    389
    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, 2 pedals, Firmware 54, Xbox One X since Aug -18, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.

  3. #23
    Superkart Pilot Zeratall's Avatar
    Join Date
    Oct 2017
    Posts
    290
    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
    389
    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, 2 pedals, Firmware 54, Xbox One X since Aug -18, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.
    The following user likes this Post: cpcdem


  5. #25
    Superkart Pilot Zeratall's Avatar
    Join Date
    Oct 2017
    Posts
    290
    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
    GT4 Pilot
    Join Date
    Jul 2017
    Posts
    2,517
    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
    389
    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 20:07. Reason: Error - public instead of private
    Thrustmaster TX, Italia 458 wheel, 2 pedals, Firmware 54, Xbox One X since Aug -18, 24" 1080 monitor
    Don't miss Yorkie065's excellent videos: Ep26-LiveTrack pt1. Ep 27-LiveTrack pt2.

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, 21: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, 16: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
  •