Jump to content
Bug Reporting - PLEASE FOLLOW RULES AND COMPLETE REPORTS Read more... ×
PC Forum Championship Season 4 F1 2020 | Sign Up Here Read more... ×
F1 2021 | BETA | Details and how to Apply Here Read more... ×

F1 2020 UDP Specification

Recommended Posts

Is anyone else seeing discrepancies with: 

float       m_fuelInTank; 

For me, the data received always seems higher than the actual value, eg 6.0 in the tank (and displayed in-game) comes through as 8.8 in the data. I'm on PS4. Thanks.

Share this post


Link to post
Share on other sites
On 1/4/2021 at 9:19 PM, DaveyGravy said:

Is anyone else seeing discrepancies with: 

 


float       m_fuelInTank; 

For me, the data received always seems higher than the actual value, eg 6.0 in the tank (and displayed in-game) comes through as 8.8 in the data. I'm on PS4. Thanks.

I have not seen the discrepancy. Are you sure you are getting data from the right car?

cheers.

Share this post


Link to post
Share on other sites
12 hours ago, LonelyRacer said:

I have not seen the discrepancy. Are you sure you are getting data from the right car?

cheers.

Thanks, that's a fair question, but yes, I'm looking at the correct car (I did just re-check this when you asked!). Interestingly, none of the 22 sets of car data are showing the same amount of fuel as the in-game dash so I'm not sure what's going on at all.

Share this post


Link to post
Share on other sites
3 hours ago, DaveyGravy said:

Thanks, that's a fair question, but yes, I'm looking at the correct car (I did just re-check this when you asked!). Interestingly, none of the 22 sets of car data are showing the same amount of fuel as the in-game dash so I'm not sure what's going on at all.

Hmm, interesting. I would check, all other data received is correct in the CarStatus per car, fuelMix, e.g. m_drsAllowed & m_tyreCompound and other data?

Cheers

Share this post


Link to post
Share on other sites
37 minutes ago, LonelyRacer said:

Hmm, interesting. I would check, all other data received is correct in the CarStatus per car, fuelMix, e.g. m_drsAllowed & m_tyreCompound and other data?

Cheers

Yeah everything else seems correct so I’m looking at the right player. I’m seeing this in the solo Grand Prix mode (not tested others). I’m on PS4, are you on PS4 as well?

Share this post


Link to post
Share on other sites
1 hour ago, DaveyGravy said:

Yeah everything else seems correct so I’m looking at the right player. I’m seeing this in the solo Grand Prix mode (not tested others). I’m on PS4, are you on PS4 as well?

I am on PC, latest Steam version 1.15. I see correct values. Tested with single race, set fuel to 29.0L and got the same value from the game.

I also noticed, if you do one-shot-quali, the game automatically adjusts your fuel load, i.e. you cannot set it yourself in the car settings.

Cheers.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 1/5/2021 at 7:19 AM, DaveyGravy said:

Is anyone else seeing discrepancies with: 

 


float       m_fuelInTank; 

For me, the data received always seems higher than the actual value, eg 6.0 in the tank (and displayed in-game) comes through as 8.8 in the data. I'm on PS4. Thanks.

I can't remember if the game lets you change the display units for fuel in game but are you aware that m_fuelInTank is in kilograms not litres?

Share this post


Link to post
Share on other sites
15 hours ago, LonelyRacer said:

I am on PC, latest Steam version 1.15. I see correct values. Tested with single race, set fuel to 29.0L and got the same value from the game.

I also noticed, if you do one-shot-quali, the game automatically adjusts your fuel load, i.e. you cannot set it yourself in the car settings.

Cheers.

I’ve only tested this (since the issue was raised) in game modes where the game sets the fuel level for you automatically, and that’s where I get the difference, perhaps this is where the bug is in the game.

6 hours ago, BernoAU said:

I can't remember if the game lets you change the display units for fuel in game but are you aware that m_fuelInTank is in kilograms not litres?

I did look for units for fuel but couldn’t find anything in the game. Yeah, I’m aware it’s in KG so I’m just showing the number on the dash direct from the feed - there’s no conversion required as far as I can tell...

Thanks

Share this post


Link to post
Share on other sites
37 minutes ago, DaveyGravy said:

I did look for units for fuel but couldn’t find anything in the game. Yeah, I’m aware it’s in KG so I’m just showing the number on the dash direct from the feed - there’s no conversion required as far as I can tell...

The in game wheel displays how many laps of fuel not kg.

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, BernoAU said:

The in game wheel displays how many laps of fuel not kg.

That'll be the confusion then! So we don't actually get the number shown on the in game dash, in the feed do we? We get:

float       m_fuelRemainingLaps;        // Fuel remaining in terms of laps (value on MFD)

which shows the delta number of laps/fuel +/-, but the number to it's left is not sent as far as I can tell, so needs to be calculated to replicate it exactly.

Thank you!

Share this post


Link to post
Share on other sites

Random question for everyone: has anyone seen cases where data from Xbox/PS4 simply does not arrive at the client listening for it? I've seen this happening where even with a simple UDP listener in C# the data is simply not received, no difference between Broadcast Mode/direct IP. I'll put together a sample project for a proper bug report but was curious to see if others have been seeing the same? Seems to be the case in both 2019 and 2020.

Share this post


Link to post
Share on other sites
1 hour ago, cgfdoo said:

Random question for everyone: has anyone seen cases where data from Xbox/PS4 simply does not arrive at the client listening for it? I've seen this happening where even with a simple UDP listener in C# the data is simply not received, no difference between Broadcast Mode/direct IP. I'll put together a sample project for a proper bug report but was curious to see if others have been seeing the same? Seems to be the case in both 2019 and 2020.

I've never seen this personally, at least not on PS4.

Share this post


Link to post
Share on other sites
4 hours ago, cgfdoo said:

Random question for everyone: has anyone seen cases where data from Xbox/PS4 simply does not arrive at the client listening for it? I've seen this happening where even with a simple UDP listener in C# the data is simply not received, no difference between Broadcast Mode/direct IP. I'll put together a sample project for a proper bug report but was curious to see if others have been seeing the same? Seems to be the case in both 2019 and 2020.

Yes, quite a few routers will block ports or Broadcasting by default for security reasons.

Up to the user to manually port forward or enable settings in the router. 

  • Thanks 1

Share this post


Link to post
Share on other sites
12 hours ago, BernoAU said:

Yes, quite a few routers will block ports or Broadcasting by default for security reasons.

Up to the user to manually port forward or enable settings in the router.

Queue Charles Leclerc team radio from Baku....I'm so stupid.... - I had a little look around after you replied, fired up Wireshark, all packets are there. Fired up a nodejs sample of someone else, worked. 

Turned out the Windows Defender Firewall, for whatever reason, decided that my app needs multiple entries with conflicting configurations (?) which most likely caused the issue. After enabling private and public for all the entries for my app it worked ¯\_(ツ)_/¯

Thanks for pushing me into the right direction @BernoAU, even though I checked the firewall as one of the first things it didn't occur to me that the multiple entries would cause any issues.

For anyone else coming across this, here is what I did to make this work:

  1. Go to "Windows Defender Firewall"
  2. Click on "Allow an app or feature through Windows Defender Firewall"
  3. Click on "Change Settings"
  4. Locate all entries for the app you're having problems with
  5. Select Private and Public (only "Private" may work as well, didn't try) for all entries for the app
  6. Profit

Share this post


Link to post
Share on other sites

hi i have done the code to capture the data from udp port, but the result is it, can you help me?

here is my code to capture and the result.

c# language

using System;
using System.Net;
using System.Net.Sockets;
using System.Text;

public class UDPListener
{
    private const int listenPort = 20777;

    private static void StartListener()
    {
        UdpClient listener = new UdpClient(listenPort);
        IPEndPoint groupEP = new IPEndPoint(IPAddress.Any, listenPort);
        float m_brake=0;
        try
        {
            while (true)
            {
                Console.WriteLine("Waiting for broadcast");
                byte[] bytes = listener.Receive(ref groupEP);

                Console.WriteLine($"Received broadcast from {groupEP} :");
                Console.WriteLine($" {Encoding.Unicode.GetString(bytes, 0, bytes.Length)}");
            }
        }
        catch (SocketException e)
        {
            Console.WriteLine(e);
        }
        finally
        {
            listener.Close();
        }
    }

    public static void Main()
    {
        StartListener();
    }
}

 

result 

image.thumb.png.9526a32c2e2a4743a5f5ba3e780da7ba.png

Share this post


Link to post
Share on other sites

DarkSuLL, you have to read the packet byte for byte, here my Java-Code for the first values:

 

public int readOneByteIntoInt(byte[] bytes, int index) {
        if (bytes != null) {
            int value = 0;
            value += (bytes[index] & 0x000000FF);
            return value;
        }
        return INVALID_DATA;
    }

    public long readTwoBytesIntoLong(byte[] bytes, int index) {
        if (bytes != null) {
            long value = 0;
            value += (bytes[index+1] & 0x000000FF) << 8;
            value += (bytes[index] & 0x000000FF);
            return value;
        }
        return INVALID_DATA;
    }
        

    // Get UDP-Data for F1 2018
    private void getF1v2018Data() {
        myDatastore.setPacketHeaderMpacketFormat ( readTwoBytesIntoLong(buffer, 0) );
        myDatastore.setPacketHeaderMpacketVersion ( readOneByteIntoInt(buffer, 2) );
        myDatastore.setPacketHeaderMpacketId ( readOneByteIntoInt(buffer, 3) );
....
    } 
 

 

Kind regards,

Mark

Share this post


Link to post
Share on other sites
12 hours ago, markundsteffi said:

DarkSuLL, you have to read the packet byte for byte, here my Java-Code for the first values:

 

public int readOneByteIntoInt(byte[] bytes, int index) {
        if (bytes != null) {
            int value = 0;
            value += (bytes[index] & 0x000000FF);
            return value;
        }
        return INVALID_DATA;
    }

    public long readTwoBytesIntoLong(byte[] bytes, int index) {
        if (bytes != null) {
            long value = 0;
            value += (bytes[index+1] & 0x000000FF) << 8;
            value += (bytes[index] & 0x000000FF);
            return value;
        }
        return INVALID_DATA;
    }
        

    // Get UDP-Data for F1 2018
    private void getF1v2018Data() {
        myDatastore.setPacketHeaderMpacketFormat ( readTwoBytesIntoLong(buffer, 0) );
        myDatastore.setPacketHeaderMpacketVersion ( readOneByteIntoInt(buffer, 2) );
        myDatastore.setPacketHeaderMpacketId ( readOneByteIntoInt(buffer, 3) );
....
    } 
 

 

Kind regards,

Mark

thanks i will study your code and try it.

Share this post


Link to post
Share on other sites
23 hours ago, markundsteffi said:

DarkSuLL, you have to read the packet byte for byte, here my Java-Code for the first values:

 

public int readOneByteIntoInt(byte[] bytes, int index) {
        if (bytes != null) {
            int value = 0;
            value += (bytes[index] & 0x000000FF);
            return value;
        }
        return INVALID_DATA;
    }

    public long readTwoBytesIntoLong(byte[] bytes, int index) {
        if (bytes != null) {
            long value = 0;
            value += (bytes[index+1] & 0x000000FF) << 8;
            value += (bytes[index] & 0x000000FF);
            return value;
        }
        return INVALID_DATA;
    }
        

    // Get UDP-Data for F1 2018
    private void getF1v2018Data() {
        myDatastore.setPacketHeaderMpacketFormat ( readTwoBytesIntoLong(buffer, 0) );
        myDatastore.setPacketHeaderMpacketVersion ( readOneByteIntoInt(buffer, 2) );
        myDatastore.setPacketHeaderMpacketId ( readOneByteIntoInt(buffer, 3) );
....
    } 
 

 

Kind regards,

Mark

I recently finished college. 
I managed to read bytes 1 by 1, but what does each index mean? 

thanks for help.

image.thumb.png.ee320b1222ee7bbea06dffe77dc63f31.png

Edited by DarkSuLL

Share this post


Link to post
Share on other sites
39 minutes ago, DarkSuLL said:

I recently finished college. 
I managed to read bytes 1 by 1, but what does each index mean? 

thanks for help.

image.thumb.png.ee320b1222ee7bbea06dffe77dc63f31.png

That's what the specification is for in the 1st post by Codies.  It's up to you to figure out the size of a data item and read it properly.

Share this post


Link to post
Share on other sites

Hi, DarkSuLL

as bn880 wrote you have to read the first page of this thread to interpret this data.

As example:

On the first page you can read, that each packet has a packet header. In the description for the packet header, you see, that the first value is:

uint16 m_packetFormat;

uint16 are 2 bytes. And the data are in Little Endian.

Your first bytes are:

228 -> E4 hex

07 -> 07 hex

Because of First Endian the value for the Packet-Format is:

07E4 hex -> 2020 dec

Kind regards,

Mark

Edited by markundsteffi

Share this post


Link to post
Share on other sites
21 hours ago, markundsteffi said:

Hi, DarkSuLL

as bn880 wrote you have to read the first page of this thread to interpret this data.

As example:

On the first page you can read, that each packet has a packet header. In the description for the packet header, you see, that the first value is:

uint16 m_packetFormat;

uint16 are 2 bytes. And the data are in Little Endian.

Your first bytes are:

228 -> E4 hex

07 -> 07 hex

Because of First Endian the value for the Packet-Format is:

07E4 hex -> 2020 dec

Kind regards,

Mark

ok thanks a lot, now i am starting understanding and will do tests with this datas.

image.thumb.png.38fc4b29239944969d89e53b28e58bdf.png

Share this post


Link to post
Share on other sites

anybody know a hexadecimal to decimal little endian order converter that i could use UINT64 type?

i have used it one, but no UNIT64 option.

 

 

image.png

Share this post


Link to post
Share on other sites
Posted (edited)

Hi friends

what are the relationships between grip and data ?

i would like to do a anti cheat app.

or have you another idea to do a anti cheat?

 

Edited by DarkSuLL

Share this post


Link to post
Share on other sites
Posted (edited)
22 hours ago, DarkSuLL said:

Hi friends

what are the relationships between grip and data ?

i would like to do a anti cheat app.

or have you another idea to do a anti cheat?

 

I did few years ago a "league admin" version of my tool, where I collected statistics of key parameters of the cars and then displayed them in a way, which let league admins to check, if people were using cheats. This included odd g-forces, odd tire wear values, odd ERS usage etc. But this work got bit of a cold shower, when in F1 2019 and F1 2020 the telemetry data got mostly hidden, unless a person makes it available. You can still do some of that stuff (and my tool is still doing that), but it is bit harder, when you e.g. don't get the fuel usage and tire wear data from the other cars.

Cheers.

Edited by LonelyRacer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×