F1Sharp 1.1.0
See the version list below for details.
dotnet add package F1Sharp --version 1.1.0
NuGet\Install-Package F1Sharp -Version 1.1.0
<PackageReference Include="F1Sharp" Version="1.1.0" />
paket add F1Sharp --version 1.1.0
#r "nuget: F1Sharp, 1.1.0"
// Install F1Sharp as a Cake Addin #addin nuget:?package=F1Sharp&version=1.1.0 // Install F1Sharp as a Cake Tool #tool nuget:?package=F1Sharp&version=1.1.0
F1Sharp
Receive and parse the telemetry packets from the F1® 23 game, and hopefully future ones too.
Current UDP specification can be found here.
Since the specification changed from last year's game, this library is only compatible with F1® 23 for the moment.
Installing
This package is available on NuGet now.
Usage
Enabling telemetry
UDP telemetry must be turned on in your game for this library to work. You can find the telemetry settings in Options > Settings > Telemetry Settings
(F1® 23).
By default the UDP Telemetry
option it's off, so you have to turn it on. While you're here you can also change the UDP Port
setting if needed. The default is 20777
.
Instancing client
For receiving the events you have to create an instance of TelemetryClient
.
// Instance the client listening on port 20777 (the default)
TelemetryClient client = new TelemetryClient(20777);
This instance has events that you can hook into for managing the data updates coming from the game.
// Hook a method to the OnCarTelemetryDataReceive event
// This event represents whenever a packet is received that involves car telemetry (current speed, throttle or brake applied, engine RPM, etc.)
client.OnCarTelemetryDataReceive += Client_OnCarTelemetryDataReceive;
private void Client_OnCarTelemetryDataReceive(CarTelemetryPacket packet)
{
// Get the player index from the list of cars in the session
int playerIndex = packet.header.playerCarIndex;
// Select the player's car from the list of car telemetries
CarTelemetryData carTelemetryData = packet.carTelemetryData[playerIndex];
// Write to console the engine RPM
Console.WriteLine($"Engine RPM: {carTelemetryData.engineRPM}");
}
Data binding
I included ViewModels for a few of the data types for making it easier to use in GUI projects (I'm doing one of my own 😉). I'll add a few more if my project gets more interesting and requires more ViewModels.
The ones included for now are:
- Car Damage
- Car Setup
- Car Status
- Car Telemetry
Aknowledgements
Thanks a lot to @thomz for coding the library that inspired this one.
Legal notice
F1® 23 Game - an official product of the FIA Formula One World Championship™.
The F1 Formula 1 logo, F1 logo, Formula 1, F1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trademarks of Formula One Licensing BV, a Formula 1 company. © 2023 Cover images Formula One World Championship Limited, a Formula 1 company. Licensed by Formula One World Championship Limited. The F2 FIA Formula 2 CHAMPIONSHIP logo, FIA Formula 2 CHAMPIONSHIP, FIA Formula 2, Formula 2, F2 and related marks are trademarks of the Federation Internationale de l’Automobile and used exclusively under licence. All rights reserved. The FIA and FIA AfRS logos are trademarks of Federation Internationale de l’Automobile. All rights reserved.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- CommunityToolkit.Mvvm (>= 8.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added start/stop methods
- Added ViewModel exclusive for player related data
- Added ViewModels for Session, SessionHistory and LapData packets
- Refactor of included ViewModels
- Minor bug fixes