Codemasters.F1_2020 4.3.0

Resources for deserializing UDP data from the F1 2020 video game by Codemasters.

Install-Package Codemasters.F1_2020 -Version 4.3.0
dotnet add package Codemasters.F1_2020 --version 4.3.0
<PackageReference Include="Codemasters.F1_2020" Version="4.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Codemasters.F1_2020 --version 4.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Codemasters.F1_2020, 4.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Codemasters.F1_2020 as a Cake Addin
#addin nuget:?package=Codemasters.F1_2020&version=4.3.0

// Install Codemasters.F1_2020 as a Cake Tool
#tool nuget:?package=Codemasters.F1_2020&version=4.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Codemasters.F1_2020

A package of resources for deserializing and analyzing UDP telemetry data from the F1 2020 video game by Codemasters.

The F1 2020 video game will provide to you a UDP data package in the form of a byte array (byte[]). There are several different types of data packets that the game will broadcast. Import the following namespace to use the basic resources for reading data:

using Codemasters.F1_2020;

Every packet type derives from the same base class, Packet. The Packet class contains the following properties:

PacketFormat - Describes the game the packet is from (F1 2020)
GameMajorVersion - The major version of the game at the time of broadcast
GameMinorVersion - The minor version of the game at the time of broadcast
PacketVersion
PacketType - The type of packet this data is (i.e. Telemetry, status, lap data, etc.)
UniqueSessionId - The unique ID of your session.
SessioTime - The timestamp of the current session when this packet was recorded and broadcasted.
FrameIdentifier - Which grouping of packets this data belongs to.
PlayerCarIndex - The index of the player's car in field arrays in all corresponding packets.
SecondaryPlayerCarIndex - If you are playing two player (split screen), this will be player 2's index in the field array.

To tell what type of packet any array of bytes that was provided to you is, use the CodemastersToolkit. The bytes variable below would come from your telemetry broadcast, or from a deserialized file if you saved telemetry on disk.

byte[] bytes; //Your telemetry data package
PacketType pt = CodemastersToolkit.GetPacketType(bytes);
Console.WriteLine(pt.ToString());

Console output of the above: "CarTelemetry"
Since we know that this particular data package is a telemetry packet, we can create a telemetry package:

TelemetryPacket tp = new TelemetryPacket();
tp.LoadBytes(bytes);

The TelemetryPacket class contains an array of CarTelemetryData, one for each car in the field.
As an exmaple, the below code will print the throttle pressure that every driver is applying at the moment this data was broadcasted.

foreach (TelemetryPacket.CarTelemetryData ctd in tp.FieldTelemetryData)
{
    Console.WriteLine(ctd.Throttle.ToString());
}

Many of the packets follow a similar format as is seen above with the TelemetryPacket.

Converting all telemetry to packets

You can convert all of the byte array packages that you received. Example:

List<byte[]> telemetry;
Packet[] packets = CodemastersToolkit.BulkConvertByteArraysToPackets(telemetry);

You can then convert each packet from the returned array of packets. For example, converting a Packet to the TelemetryPacket:

foreach (Packet p in packets)
{
    if (p.PacketType == PacketType.CarTelemetry)
    {
        TelemetryPacket telpack = (TelemetryPacket)p;
    }
}

Getting a related packet

You may need to, for example, find the accompanying CarStatusPacket for a particular TelemetryPacket. To do this:

TelemetryPacket telpack;
CarStatusPacket csp = (CarStatusPacket)telpack.GetRelatedPacket(packets, PacketType.CarStatus);

**If you previously used the Codemasters.F1_2020.Analysis namespace and now find it missing: The analysis namespace has been moved under the ApexVisual.F1_2020 NuGet package (https://www.nuget.org/packages/ApexVisual.F1_2020/)

Codemasters.F1_2020

A package of resources for deserializing and analyzing UDP telemetry data from the F1 2020 video game by Codemasters.

The F1 2020 video game will provide to you a UDP data package in the form of a byte array (byte[]). There are several different types of data packets that the game will broadcast. Import the following namespace to use the basic resources for reading data:

using Codemasters.F1_2020;

Every packet type derives from the same base class, Packet. The Packet class contains the following properties:

PacketFormat - Describes the game the packet is from (F1 2020)
GameMajorVersion - The major version of the game at the time of broadcast
GameMinorVersion - The minor version of the game at the time of broadcast
PacketVersion
PacketType - The type of packet this data is (i.e. Telemetry, status, lap data, etc.)
UniqueSessionId - The unique ID of your session.
SessioTime - The timestamp of the current session when this packet was recorded and broadcasted.
FrameIdentifier - Which grouping of packets this data belongs to.
PlayerCarIndex - The index of the player's car in field arrays in all corresponding packets.
SecondaryPlayerCarIndex - If you are playing two player (split screen), this will be player 2's index in the field array.

To tell what type of packet any array of bytes that was provided to you is, use the CodemastersToolkit. The bytes variable below would come from your telemetry broadcast, or from a deserialized file if you saved telemetry on disk.

byte[] bytes; //Your telemetry data package
PacketType pt = CodemastersToolkit.GetPacketType(bytes);
Console.WriteLine(pt.ToString());

Console output of the above: "CarTelemetry"
Since we know that this particular data package is a telemetry packet, we can create a telemetry package:

TelemetryPacket tp = new TelemetryPacket();
tp.LoadBytes(bytes);

The TelemetryPacket class contains an array of CarTelemetryData, one for each car in the field.
As an exmaple, the below code will print the throttle pressure that every driver is applying at the moment this data was broadcasted.

foreach (TelemetryPacket.CarTelemetryData ctd in tp.FieldTelemetryData)
{
    Console.WriteLine(ctd.Throttle.ToString());
}

Many of the packets follow a similar format as is seen above with the TelemetryPacket.

Converting all telemetry to packets

You can convert all of the byte array packages that you received. Example:

List<byte[]> telemetry;
Packet[] packets = CodemastersToolkit.BulkConvertByteArraysToPackets(telemetry);

You can then convert each packet from the returned array of packets. For example, converting a Packet to the TelemetryPacket:

foreach (Packet p in packets)
{
    if (p.PacketType == PacketType.CarTelemetry)
    {
        TelemetryPacket telpack = (TelemetryPacket)p;
    }
}

Getting a related packet

You may need to, for example, find the accompanying CarStatusPacket for a particular TelemetryPacket. To do this:

TelemetryPacket telpack;
CarStatusPacket csp = (CarStatusPacket)telpack.GetRelatedPacket(packets, PacketType.CarStatus);

**If you previously used the Codemasters.F1_2020.Analysis namespace and now find it missing: The analysis namespace has been moved under the ApexVisual.F1_2020 NuGet package (https://www.nuget.org/packages/ApexVisual.F1_2020/)

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Codemasters.F1_2020:

Package Downloads
ApexVisual.F1_2020
Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
4.3.0 164 12/18/2020
4.2.0 85 12/16/2020
4.1.0 165 12/4/2020
4.0.0 147 11/29/2020
3.0.0 301 11/6/2020
2.0.3 148 10/29/2020
2.0.2 147 9/24/2020
2.0.1 307 9/19/2020
2.0.0 137 9/15/2020
1.4.0 141 9/15/2020
1.3.0 123 9/6/2020
1.2.3 193 8/17/2020
1.2.2 509 8/15/2020
1.2.1 188 8/12/2020
1.2.0 198 8/12/2020
1.1.0 225 8/3/2020
1.0.0 202 8/2/2020
0.5.0 273 7/21/2020
0.4.1 149 7/21/2020
0.4.0 176 7/20/2020
0.3.0 170 7/18/2020
0.2.0 174 7/17/2020
0.1.1 154 7/15/2020
0.1.0 179 7/14/2020