Jump to content Jump to content

F1 2020 UDP Specification


Recommended Posts

17 hours ago, LonelyRacer said:

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.

good morning i also have a league www.plf1.com.br is a totally free league,
 it is mandatory to make public the telemetry data to play in our league
 and run applications that are requested by the administrators. 
I know that players use a cheat engine to access the data 
in the memory and inject data to increase the car's grip, 
can you make your code available to me ?,
 so I gain time in creating mine, another doubt will we be able to 
do something to detect this change directly in memory by installing
 some application on the client for detection?

 

 

thanks

 

 

 
 
 
  

image.png

Link to post
Share on other sites
  • 2 weeks later...

Hey guys,

i am writing an application to save race data to display them on a website.

Does anyone receives other m_tractioncontrol values then 0 and 2 in car status packets? Here there is only full and none TC and i think it's a bug.

Thanks in advance.

Link to post
Share on other sites

Hello,
for the 2021 release would it possible to have m_tyresAgeLaps public?

Since 2020 it's shown in the spectator menu, so it would make sense to have this property public also to telemetry data

thanks!

Edited by emln22
Link to post
Share on other sites

Hi all - does anybody know which teams/cars the team IDs 74 and 77 refer to? Sorry if this has been asked before, I couldn't find anything via search. Thanks in advance!

Link to post
Share on other sites
  • Codemasters Staff

Sorry - I probably need to update the original doc.

74

Dams ‘20

75

Uni-Virtuosi ‘20

76

MP Motorsport ‘20

77

Prema ‘20

78

Trident ‘20

79

BWT ‘20

80

Hitech ‘20

  • Thanks 1
Link to post
Share on other sites
  • Codemasters Staff
33 minutes ago, cjorgens79 said:

Hi @Hoo, just wondering if there has been any movement on the whole player names GDPR thing?

Thanks

It's still disabled in game, but is actively being discussed at the moment. 

  • Thanks 1
  • Agree 1
Link to post
Share on other sites
On 3/25/2021 at 8:36 PM, Hoo said:

Sorry - I probably need to update the original doc.

74

Dams ‘20

75

Uni-Virtuosi ‘20

76

MP Motorsport ‘20

77

Prema ‘20

78

Trident ‘20

79

BWT ‘20

80

Hitech ‘20

Thank you so much! It would be super useful if you could either update the original post, or share the full team ID table here. As an example, I'm a bit confused by what the other F2 '20 IDs are. Thank you in advance, I really appreciate the support 🙌 

Link to post
Share on other sites
On 3/20/2021 at 1:36 PM, Neospin_ said:

Hey guys,

i am writing an application to save race data to display them on a website.

Does anyone receives other m_tractioncontrol values then 0 and 2 in car status packets? Here there is only full and none TC and i think it's a bug.

Thanks in advance.

Hey there,

does nobody use this field?

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

Hey there,

does nobody use this field?

I am using it and haven't seen any problems so far. Maybe a bug in your code? It is hard to say without any of your code to look at. Can of course also be a bug in the game on whichever platform you're playing on.

Link to post
Share on other sites
On 3/27/2021 at 1:03 PM, cgfdoo said:

I am using it and haven't seen any problems so far. Maybe a bug in your code? It is hard to say without any of your code to look at. Can of course also be a bug in the game on whichever platform you're playing on.

Hey there,

thanks for your answer.
I am on PC, and i don't see any value with medium tractioncontrol even in raw data.
So i think its a bug. Are you on PC and can confirm?

Thanks in advance

Link to post
Share on other sites

Hi - two things you can maybe help with?

1. where can I find the official track map data? 

2. how long and wide is the car using the worldPosition XZ scale? Presumably that point is the centre of the car seen from above? 

Link to post
Share on other sites
  • 3 weeks later...

Hi!

I've been reading documentation and I didn't see any field about session or "in-menu" game. How can I "know" if we are in session (driving our car) or other part of the game (menu, my team, etc)?

 

Thank you

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

Hi!

I've been reading documentation and I didn't see any field about session or "in-menu" game. How can I "know" if we are in session (driving our car) or other part of the game (menu, my team, etc)?

 

Thank you

The m_driverStatus field of the LapData packet will tell you the status of the car (in garage, flying lap, in lap, out lap, on track) and the m_gamePaused field of the Session Data packet will tell you whether the game is currently paused.

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

The m_driverStatus field of the LapData packet will tell you the status of the car (in garage, flying lap, in lap, out lap, on track) and the m_gamePaused field of the Session Data packet will tell you whether the game is currently paused.

Oh thank you, I will check that info!

Link to post
Share on other sites
Just now, Kafumanto said:

Hi @Hoo,

accordingly to @BarryBL it appears that a beta program for F1 2021 is not confirmed at this time. If an official beta will not be run this time, I hope some sort of closed beta for devs working on third-party tools could be planned to give us the opportunity to have integrations ready on day-one.

Would definitely be cool, I would even be fine with only getting updated docs for the fields ahead of time to be honest, that would at least allow us to write some of the code ahead of time - anyways, there is still plenty of time until July to run a (public) beta program so I wouldn't sweat it just yet.

Link to post
Share on other sites
Just now, Kafumanto said:

Hi @Hoo,

accordingly to @BarryBL it appears that a beta program for F1 2021 is not confirmed at this time. If an official beta will not be run this time, I hope some sort of closed beta for devs working on third-party tools could be planned to give us the opportunity to have integrations ready on day-one.

I want be part of the beta program.  but the beta program is not here to help you to have your program ready, but it's made to be sure they will have NO bugs.

We have some bugs on telemetry and we need beta to fix them. (last bug found, the traction control never display intermediate, only full or off)

I was already angry against some of you who are selfish on beta 2020 and think more to their app than to found bug. So please. Think for the developer's community  before think to your personnal app.

Thanks

  • Disagree 1
Link to post
Share on other sites
13 hours ago, ThibaudPHP said:

I want be part of the beta program.  but the beta program is not here to help you to have your program ready, but it's made to be sure they will have NO bugs.

We have some bugs on telemetry and we need beta to fix them. (last bug found, the traction control never display intermediate, only full or off)

I was already angry against some of you who are selfish on beta 2020 and think more to their app than to found bug. So please. Think for the developer's community  before think to your personnal app.

Thanks

Last time I checked it was mutually beneficial for the Codemasters devs to have third party app developers testing and consuming updates to the UDP data during beta?
We have found and reported many bugs in the data for all the betas I've been involved in since 2017. Bugs remain in the data usually due to lack of time and resources for them to be fixed not due to lack of reporting.

Also the developers community includes users of our apps many of whom expect our apps to be ready and working with the games release on day 1.
This isn't going to happen if we don't get early access to the structure. Not sure how this is selfish?

  • Agree 1
Link to post
Share on other sites

+1 for this answer, such a thing is always mutually beneficial. We find bugs while developing and our programs may bring more people to the game or keep them here longer. But nowadays game devs tend to give influencers earlier access than 3rd party devs 🤷‍♂️

On another note, here are the additional IDs for F2 2020 that @Hoo was unable to add to the docs yet:

Teams:

	70:  ART Grand Prix
	71:  Campos Racing
	72:  Carlin
	73:  Charouz Racing System
	74:  DAMS
	75:  UNI-Virtuosi Racing
	76:  MP Motorsport
	77:  Prema Racing
	78:  Trident
	79:  BWT HWA Racelab
	80:  Hitech Grand Prix

Drivers:

	91:  Dan Ticktum
	92:  Marcus Armstrong
	93:  Christian Lundgaard
	94:  Yuki Tsunoda
	95:  Jehan Daruvala
	96:  Guilherme Samaia
	97:  Pedro Piquet
	98:  Felipe Drugovich
	99:  Robert Shwartzman
	100: Roy Nissany
	101: Marino Satō

Visual Tyre Compound:

	23: supersoft
	24: soft
	25: medium
	26: hard

 

  • Thanks 1
Link to post
Share on other sites
12 hours ago, e1smann said:

+1 for this answer, such a thing is always mutually beneficial. We find bugs while developing and our programs may bring more people to the game or keep them here longer. But nowadays game devs tend to give influencers earlier access than 3rd party devs 🤷‍♂️

On another note, here are the additional IDs for F2 2020 that @Hoo was unable to add to the docs yet:

Teams:


	70:  ART Grand Prix
	71:  Campos Racing
	72:  Carlin
	73:  Charouz Racing System
	74:  DAMS
	75:  UNI-Virtuosi Racing
	76:  MP Motorsport
	77:  Prema Racing
	78:  Trident
	79:  BWT HWA Racelab
	80:  Hitech Grand Prix

Drivers:


	91:  Dan Ticktum
	92:  Marcus Armstrong
	93:  Christian Lundgaard
	94:  Yuki Tsunoda
	95:  Jehan Daruvala
	96:  Guilherme Samaia
	97:  Pedro Piquet
	98:  Felipe Drugovich
	99:  Robert Shwartzman
	100: Roy Nissany
	101: Marino Satō

Visual Tyre Compound:


	23: supersoft
	24: soft
	25: medium
	26: hard

 

I didn't check everything, but in my experience, driver #100 is used to represent the player in My Team mode. Figured it out when I witnessed I was appearing as Roy Nissany when playing in My Team mode using my telemetry app :)

Could #100 be used to mean different drivers depending on the context? That would not be cool since I'm not sure the type of game (career, My Team, championship etc.) can be inferred from the raw telemetry data...

Link to post
Share on other sites

Hi, I just started to play around with the data you receive from the game. I wonder if there is a possibility to show the delta of the current lap to the session fastest.

Like in TT in the game but also for other sessions e. g. race.

Link to post
Share on other sites
On 11/13/2020 at 2:00 PM, codeslave said:

So for sure the first proposed solution remain the best, with somes improvement (array in place of multiple declarations).

 


struct PacketHeader
{
    uint16_t    m_packetFormat;             // 2020
    uint8_t     m_gameMajorVersion;         // Game major version - "X.00"
    uint8_t     m_gameMinorVersion;         // Game minor version - "1.XX"
    uint8_t     m_packetVersion;            // Version of this packet type, all start from 1
    uint8_t     m_packetId;                 // Identifier for the packet type, see below
    uint16_t    m_sessionUID[4];            // Unique identifier for the session
    uint16_t    m_sessionTime[2];           // Session timestamp
    uint16_t    m_frameIdentifier[2];       // Identifier for the frame the data was retrieved on
    uint8_t     m_playerCarIndex;           // Index of player's car in the array
   // ADDED IN BETA 2: 
    uint8_t     m_secondaryPlayerCarIndex;  // Index of secondary player's car in the array (splitscreen)
};

struct CarTelemetryData
{
    uint16_t    m_speed;                         // Speed of car in kilometres per hour
    uint16_t    m_throttle[2];                   // Amount of throttle applied (0.0 to 1.0)
    uint16_t    m_steer[2];                      // Steering (-1.0 (full lock left) to 1.0 (full lock right))
    uint16_t    m_brake[2];                      // Amount of brake applied (0.0 to 1.0)
    uint8_t     m_clutch;                        // Amount of clutch applied (0 to 100)
    int8_t      m_gear;                          // Gear selected (1-8, N=0, R=-1)
    uint16_t    m_engineRPM;                     // Engine RPM
    uint8_t     m_drs;                           // 0 = off, 1 = on
    uint8_t     m_revLightsPercent;              // Rev lights indicator (percentage)
    uint16_t    m_brakesTemperature[4];          // Brakes temperature (celsius)
    uint8_t     m_tyresSurfaceTemperature[4];    // Tyres surface temperature (celsius)
    uint8_t     m_tyresInnerTemperature[4];      // Tyres inner temperature (celsius)
    uint16_t    m_engineTemperature;             // Engine temperature (celsius)
    uint16_t    m_tyresPressure[8];              // Tyres pressure (PSI)
    uint8_t     m_surfaceType[4];                // Driving surface, see appendices
};

struct PacketCarTelemetryData
{
    PacketHeader      m_header;           // Header

    CarTelemetryData  m_carTelemetryData[22];

    uint16_t          m_buttonStatus[2];  // Bit flags specifying which buttons are being pressed
                                          // currently - see appendices

    // Added in Beta 3:
    uint8_t           m_mfdPanelIndex;    // Index of MFD panel open - 255 = MFD closed
                                          // Single player, race – 0 = Car setup, 1 = Pits
                                          // 2 = Damage, 3 =  Engine, 4 = Temperatures
                                          // May vary depending on game mode
    uint8_t           m_mfdPanelIndexSecondaryPlayer;   // See above
    int8_t            m_suggestedGear;    // Suggested gear for the player (1-8)
                                          // 0 if no gear suggested
};

#include <WiFi.h>
#include <WiFiUdp.h>

static const int servoPin = 13;

const char* ssid = "XXXXXXXXXX";
const char* password =  "XXXXXXXXXX";

WiFiUDP Udp;
unsigned int localUdpPort = 20777;  // local port to listen on

WiFiClient espClient;
 
void setup() {
  Serial.begin(115200);
  
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi..");
  }
  Serial.println("Connected to the WiFi network");
 
  Udp.begin(localUdpPort);
  Serial.println(sizeof(PacketHeader));
  Serial.printf("Now listening at IP %s, UDP port %d\n", WiFi.localIP().toString().c_str(), localUdpPort);
  delay(2000);
}
 
void loop() {
 int packetSize = Udp.parsePacket();
  
  //If we received something.
  if(packetSize) {
       char packetBuffer[packetSize];
       //Serial.printf("Received %d bytes from %s, port %d\n", packetSize, Udp.remoteIP().toString().c_str(), Udp.remotePort());
       Udp.read(packetBuffer, packetSize);
       
         
       int idPacket = int(packetBuffer[5]);
 //    Serial.printf(" %d",idPacket);
       if (idPacket==6){
          PacketCarTelemetryData *tmp_pckt = (PacketCarTelemetryData *) packetBuffer;
          
          Serial.printf("%u %u %u %u %u %u %u %u %u %u speed %d acc %f \n",tmp_pckt->m_header.m_packetFormat,
                                                  tmp_pckt->m_header.m_gameMajorVersion,
                                                  tmp_pckt->m_header.m_gameMinorVersion,
                                                  tmp_pckt->m_header.m_packetVersion,
                                                  tmp_pckt->m_header.m_packetId,
                                                  tmp_pckt->m_header.m_sessionUID[0],
                                                  tmp_pckt->m_header.m_sessionTime[0],
                                                  tmp_pckt->m_header.m_frameIdentifier[0],
                                                  tmp_pckt->m_header.m_playerCarIndex, 
                                                  tmp_pckt->m_header.m_secondaryPlayerCarIndex,
                                                  tmp_pckt->m_carTelemetryData[tmp_pckt->m_header.m_playerCarIndex].m_speed,
                                                  *(float *)&tmp_pckt->m_carTelemetryData[tmp_pckt->m_header.m_playerCarIndex].m_throttle[0]
                                                  );
         }
       }
  }

 

 

 

Let me know if the solutions proposed solve your problem and I will appreciate tips.

 

Bye

I know the post is old but i wanna say that the solution proposed by codeslave is working ! Thank you a lot. I also tried to replicate the same thing with te carStatusData but with no result. I added this piece of code

 else if (idPacket==7){

  PacketCarStatusData *tmp_pckt2 = (PacketCarStatusData *) packetBuffer;
          
          Serial.printf("%u %u %u %u %u %u %u %u %u %u traction %u antilock %u fuelmix %u \n",tmp_pckt2->m_header.m_packetFormat,
                                                  tmp_pckt2->m_header.m_gameMajorVersion,
                                                  tmp_pckt2->m_header.m_gameMinorVersion,
                                                  tmp_pckt2->m_header.m_packetVersion,
                                                  tmp_pckt2->m_header.m_packetId,
                                                  tmp_pckt2->m_header.m_sessionUID[0],
                                                  tmp_pckt2->m_header.m_sessionTime[0],
                                                  tmp_pckt2->m_header.m_frameIdentifier[0],
                                                  tmp_pckt2->m_header.m_playerCarIndex, 
                                                  tmp_pckt2->m_header.m_secondaryPlayerCarIndex,
                                                  tmp_pckt2->m_carStatusData[tmp_pckt2->m_header.m_playerCarIndex].m_tractionControl,
                                                  tmp_pckt2->m_carStatusData[tmp_pckt2->m_header.m_playerCarIndex].m_antiLockBrakes,
                                                  tmp_pckt2->m_carStatusData[tmp_pckt2->m_header.m_playerCarIndex].m_fuelMix
                                                  //*(float *)&tmp_pckt2->m_carStatusData[tmp_pckt2->m_header.m_playerCarIndex].m_throttle[0]
                                                  );


                                                  Serial.println(tmp_pckt2->m_carStatusData[tmp_pckt2->m_header.m_playerCarIndex].m_fuelMix);

       
  }  

Can someone please tell me why its not working? it gives me all zerso for the values of traction, antilock and fuelmix

Link to post
Share on other sites
On 4/24/2021 at 2:27 PM, Poulpix said:

I didn't check everything, but in my experience, driver #100 is used to represent the player in My Team mode. Figured it out when I witnessed I was appearing as Roy Nissany when playing in My Team mode using my telemetry app 🙂

Could #100 be used to mean different drivers depending on the context? That would not be cool since I'm not sure the type of game (career, My Team, championship etc.) can be inferred from the raw telemetry data...

Yeah you're right. Also in multiplayer 101, 102 etc are used for other players. Not a smart move from the game devs, but you can separate them pretty good. In my code I have some conditionals which don't look pretty, but work fine for me:

- if AI controlled lookup name by driver ID
- if it's a local game (e.g. My Team) use the Name in the Participants packet - but this is uppercase, so with first & last name you have to handle it correctly (which I don't do yet)
- if it's a network game just use "Player {ID}" (how can it take so long to just send the username in telemetry data?)

Hope this helps!

@luis8h In the event packet you can select "Fastest lap" events, store the time and compare it to other lap times afterwards.

  • Agree 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...