fork of nlhans work
SCS has kindly released a SDK that allows developers and users to stream telemetry data from the game to any 3rd party applications. An example program was provided (and often used) which enabled streaming data by using text files stored on the users harddisk. This puts unnecessary stress on the users harddrive (not the mention the number of re-writes that would hurt SSDs), and moreover requires the user to manually configure the telemetry data source.
This SDK plug-in transports the telemetry stream via a Memory Mapped File. This is a special Windows (file)stream which resides completely in RAM and can be read from multiple applications.
Actually you need to build this branch yourself. I will add a release later. Stay tuned for more information.
Installation is easy inside Euro Truck Simulator 2. Place the acquired DLL inside bin/win_x64/plugins/ of your ETS2/ATS installation. It is possible the plugins directory doesn't exists yet (as with every default installation). In that case you need to create the plugins folder. Place the DLL inside the plugins folder.
You will now notice that each time ETS2/ATS now starts it prompts the SDK has been activated. Unfortunately you have to press OK to this message every time, but it's a small price to pay for the added features that are possible via the SDK.
There is also an Documentation. It tells a lot about the values. An installation, build , etc. guide will also follow. Should there still be questions, feature request or other changes visit the discord server linked at the top.
Sadly the usage of the documentation generating syntax leads to a lot of warnings
, while compiling the c# part. That's because the documentation use <
and >
. But that's no valid xml. Therefore the compiler cry's ๐ข and give the warning about invalid xml. With the help of #pragma
it wont show up.
This plug-in stores it's data inside a Memory Mapped File, or "Shared Memory". This allows it to operate without any access to harddrive, or configuration hassle by the user to locate the memory map.
Rev Numbers shows big changes on the shared memory and sometimes on the C# object. That means Rev 10 wont work with Rev 9. Doesn't matter which side is not updated. Sub Versions that you can see in changelog.md should work with small errors or completely without. The C# object is mostly not changed. Only if needed, because of new values (most of the cases) or structure changes (less the case). If this occurs i will notice that. (See changelog.md. If you directly access the shared memory you will find an overview about the changes here.)
Lower SDK Version means there are less values / values that are zero. To get an overview which values that are look at the list at the middle of this document. Note to the SDK Version: SDK 1.13 is not the same like the sdk version of ETS2 or ATS. Both games have an own SDK version. See list under ATS.
Game Version | SDK Version | Plugin State |
---|---|---|
1.26 and before | 1.12 and before | Not Tested, could work with errors |
1.27 - 1.34 | 1.13 | Should work |
1.35 | 1.14 | Should work |
1.36 | 1.15 | Should work |
- 1.40 | 1.16 | Should work |
1.41 | 1.17 | Works, Test Version |
Game Version | SDK Version | Plugin State |
---|---|---|
1.34 and before | 1.0 | Should work |
1.35 | 1.01 | Should work |
1.36 | 1.02 | Should work |
- 1.40 | 1.03 | Should work |
1.41 | 1.04 | Works, Test Version |
SDK VERSION | ETS2 SDK Version | ATS SDK VERSION |
---|---|---|
1_1 | 1.07 | - |
1_2 | 1.08 | - |
1_4 | 1.10 | - |
1_5 | 1.12 | - |
1_9 | 1.13 | 1.00 |
1_10 | 1.14 | 1.01 |
1_11 | 1.15 | 1.02 |
1_12 | 1.16 | 1.03 |
1_13 | 1.17 | 1.04 |
The following telemetry fields are supported, structure is similar the C# object. Starting with sdk 1.10, game patch 1.35 and ETS2 1.14, ATS 1.01 code for some part of the need different versions of the sdk. The plugin handles this. If a game lower than 1.35 is used, only the values without (1.14/1.01) are possible:
Edit: for better overview it is now (ETS2 SDK/ATS SDK/Game Version). I added the game version, because it is the same for ats and ets2 and most of you probably doesn't know the specific Game SDK Version.
Changes are marked with the deleted Tag.
New stuff is marked with the inserted Tag.
Game Values (V.1.11): โ โโโ Telemetry Timestamp (not the in-game time, only for usage in code, see documentation for more information #todo add link) (now ulong) โ โโโ Simulation Timestamp โ โโโ Render Timestamp โ โโโ Paused, game state โ โโโ SCSGame identifier as enum, currently ets2/ats/unknown โ โโโ GameVersion and Game Telemetry Version (major.minor) โ โโโ Dll version (usage in code) โ โโโ TelemetryVersion โ โโโ Substances โ โโโ Common Values: โ โ โโโ Scale โ โ โโโ Game Time (Time object with in-game minutes and datetime object) โ โ โโโ NextRestStop (Frequency object, more a time span) โ โ โโโ NextRestStopTime (Specific date, calculated) โ โโโ Truck Values (Contains 2 big parts, and a small one): โ โ โโโ Constants/Configs (Values that barely change): โ โ โ โโโ Motor Values: โ โ โ โ โโโ Forward Gear Count โ โ โ โ โโโ Reverse Gear Count โ โ โ โ โโโ Retarder Step Count โ โ โ โ โโโ Selector Count โ โ โ โ โโโ Engine RPM Max โ โ โ โ โโโ Differential Ration โ โ โ โ โโโ Gear Ratios Forward โ โ โ โ โโโ Gear Ratios Reverse โ โ โ โ โโโ Shifter Type Value (Enum) โ โ โ โ โโโ SlotGear โ โ โ โ โโโ SlotHandlePosition โ โ โ โ โโโ SlotSelectors โ โ โ โโโ Capacity Values: โ โ โ โ โโโ Fuel โ โ โ โ โโโ Adblue โ โ โ โโโ Warning Factors: โ โ โ โ โโโ Fuel โ โ โ โ โโโ Adblue โ โ โ โ โโโ Air Pressure โ โ โ โ โโโ Air Pressure Emergency โ โ โ โ โโโ Oil Pressure โ โ โ โ โโโ Water Temperature โ โ โ โ โโโ Battery Voltage โ โ โ โโโ Wheels: โ โ โ โ โโโ Count โ โ โ โ โโโ Radius โ โ โ โ โโโ Simulated โ โ โ โ โโโ Powered โ โ โ โ โโโ Liftable โ โ โ โ โโโ Steerable โ โ โ โโโ Brand Id (code) โ โ โ โโโ Brand โ โ โ โโโ Id (code) โ โ โ โโโ Name โ โ โ โโโ LicensePlate (1.14/1.01/1.35) โ โ โ โโโ LicensePlateCountryId (1.14/1.01/1.35) โ โ โ โโโ LicensePlateCountry (1.14/1.01/1.35) โ โ โโโ Current Values (Values that change a lot): โ โ โ โโโ Electric Enabled โ โ โ โโโ Engine Enabled โ โ โ โโโ LiftAxle (1.17/1.04/1.41) โ โ โ โโโ LiftAxleIndicator (1.17/1.04/1.41) โ โ โ โโโ TrailerLiftAxle (1.17/1.04/1.41) โ โ โ โโโ TrailerLiftAxleIndicator (1.17/1.04/1.41) โ โ โ โโโ Motor Values: โ โ โ โ โโโ Gear Values: โ โ โ โ โ โโโ HShifterSlot โ โ โ โ โ โโโ Selected โ โ โ โ โ โโโ HShifterSelector โ โ โ โ โโโ Brake Values: โ โ โ โ โโโ RetarderLevel โ โ โ โ โโโ Air Pressure โ โ โ โ โโโ Temperature โ โ โ โ โโโ Parking Brake โ โ โ โ โโโ Motor Brake โ โ โ โโโ Dashboard: โ โ โ โ โโโ Fuel Values: โ โ โ โ โ โโโ Amount โ โ โ โ โ โโโ Average Consumption โ โ โ โ โ โโโ Range (estimated range with current amount of fuel) โ โ โ โ โโโ Warnings: โ โ โ โ โ โโโ Air Pressure โ โ โ โ โ โโโ Air Pressure Emergency โ โ โ โ โ โโโ Fuel warning โ โ โ โ โ โโโ Adblue โ โ โ โ โ โโโ oil pressure โ โ โ โ โ โโโ adblue โ โ โ โ โ โโโ water temperature โ โ โ โ โ โโโ battery voltage โ โ โ โ โโโ Gear Dashboards โ โ โ โ โโโ Speed (m/s,km/h,mph) โ โ โ โ โโโ CruiseControlSpeed (m/s,km/h,mph) โ โ โ โ โโโ Adblue amount โ โ โ โ โโโ Oil Pressure โ โ โ โ โโโ Oil Temperature โ โ โ โ โโโ Water Temperature โ โ โ โ โโโ BatteryVoltage โ โ โ โ โโโ RPM โ โ โ โ โโโ Odometer โ โ โ โ โโโ Wipers โ โ โ โ โโโ Cruise Control ("special field", same like `CruiseControlspeed == 0`) โ โ โ โโโ Acceleration: โ โ โ โ โโโ Linear Velocity โ โ โ โ โโโ Angular Velocity โ โ โ โ โโโ Linear Acceleration โ โ โ โ โโโ Angular Acceleration โ โ โ โ โโโ Cabin Angular Velocity โ โ โ โ โโโ Cabin Angular Acceleration โ โ โ โโโ Lights: โ โ โ โ โโโ Aux Front (enum for 3 states) โ โ โ โ โโโ Aux Roof (enum for 3 states) โ โ โ โ โโโ Dashboard Backlight โ โ โ โ โโโ Blinker Left Active โ โ โ โ โโโ Blinker Right Active โ โ โ โ โโโ Blinker Left On โ โ โ โ โโโ Blinker Right On โ โ โ โ โโโ Parking โ โ โ โ โโโ Beam Low โ โ โ โ โโโ Beam High โ โ โ โ โโโ Beacon โ โ โ โ โโโ Brake โ โ โ โ โโโ Reverse โ โ โ โ โโโ HazardWarningLights (1.17/1.04/1.41) โ โ โ โโโ Wheels: โ โ โ โ โโโ Substance โ โ โ โ โโโ SuspDeflection โ โ โ โ โโโ Velocity โ โ โ โ โโโ Steering โ โ โ โ โโโ Rotation โ โ โ โ โโโ Lift โ โ โ โ โโโ Lift Offset โ โ โ โ โโโ on ground โ โ โ โ โโโ position โ โ โ โโโ Damage: โ โ โ โ โโโ Engine โ โ โ โ โโโ Transmission โ โ โ โ โโโ Cabin โ โ โ โ โโโ chassis โ โ โ โ โโโ wheels (avg. of all wheels) โ โ โ โโโ Position (position in world space with position and orientation) โ โ โโโ Positioning: โ โ โโโ Cabin (vehicle space) โ โ โโโ Head (cabin space) โ โ โโโ Hook (vehicle space) โ โ โโโ Head Offset โ โ โโโ Cabin Offset โ โ โโโ Contains "more fields" see at the bottom of the list โ โโโ Trailer Values (will be set to 0, false, etc. if you have no trailer, while on job or with trailer ownership detached wont reset the values)[0-9] (array starting with 1.14/1.01 so 0 for 1 trailer or version lower than that): โ โ โโโ Attached โ โ โโโ Hook โ โ โโโ Position โ โ โโโ Wheel Values: โ โ โ โโโ Substance โ โ โ โโโ SuspDeflection โ โ โ โโโ Velocity โ โ โ โโโ Steering โ โ โ โโโ Rotation โ โ โ โโโ On Ground โ โ โ โโโ Lift โ โ โ โโโ LiftOffset โ โ โโโ WheelsConstants: โ โ โ โโโ Count โ โ โ โโโ Radius โ โ โ โโโ Simulated โ โ โ โโโ Powered โ โ โ โโโ Liftable โ โ โ โโโ Steerable โ โ โโโ Acceleration: โ โ โ โโโ Linear Velocity โ โ โ โโโ Angular Velocity โ โ โ โโโ Linear Acceleration โ โ โ โโโ Angular Acceleration โ โ โโโ DamageValues: โ โ โ โโโ Cargo (1.14/1.01/1.35) โ โ โ โโโ Wheels โ โ โ โโโ Chassis โ โ โโโ Chassis (code) โ โ โโโ Id (code) โ โ โโโ Name โ โ โโโ CargoAccessoryId โ โ โโโ BodyType (1.14/1.01/1.35) โ โ โโโ BrandId (1.14/1.01/1.35) โ โ โโโ Brand (1.14/1.01/1.35) โ โ โโโ Name (1.14/1.01/1.35) โ โ โโโ ChainType (1.14/1.01/1.35) โ โ โโโ LicensePlate (1.14/1.01/1.35) โ โ โโโ LicensePlateCountryId (1.14/1.01/1.35) โ โ โโโ LicensePlateCountry (1.14/1.01/1.35) โ โโโ Job Values(will be reset after the job finished flag is disappeared): โ โ โโโ Delivery Time (time object -> in-game minutes and datetime object) โ โ โโโ Remaining Delivery Time (calculated) โ โ โโโ CargoLoaded (1.14/1.01/1.35) โ โ โโโ SpecialJob (1.14/1.01/1.35) โ โ โโโ Market (1.14/1.01/1.35) โ โ โโโ City Destination Id (code) โ โ โโโ City Destination โ โ โโโ Company Destination Id (code) โ โ โโโ Company Destination โ โ โโโ City Source Id (code) โ โ โโโ City Source โ โ โโโ Company Source Id (code) โ โ โโโ Company Source โ โ โโโ Income โ โ โโโ Planned Distance Km (1.15/1.02/1.36) โ โ โโโ Cargo Values: โ โ โโโ Mass โ โ โโโ Name (code) โ โ โโโ Id (1.14/1.01/1.35) โ โ โโโ UnitCount (1.14/1.01/1.35) โ โ โโโ UnitMass (1.14/1.01/1.35) โ โ โโโ CargoDamage (1.14/1.01/1.35) โ โโโ Control Values: โ โ โโโ User Input: โ โ โ โโโ Steering โ โ โ โโโ Throttle โ โ โ โโโ Brake โ โ โ โโโ Clutch โ โ โโโ Game Values: โ โ โโโ Steering โ โ โโโ Throttle โ โ โโโ Brake โ โ โโโ Clutch โ โโโ Navigation Values: โ โ โโโ Navigation Distance โ โ โโโ Navigation Time โ โ โโโ Speed Limit โ โโโ SpecialEvents: โ โ โโโ On Job โ โ โโโ Job Cancelled (1.14/1.01/1.35) (may not work atm?) โ โ โโโ Job Delivered (1.14/1.01/1.35) โ โ โโโ Fined (1.14/1.01/1.35) โ โ โโโ Tollgate (1.14/1.01/1.35) โ โ โโโ Ferry (1.14/1.01/1.35) โ โ โโโ Train (1.14/1.01/1.35) โ โ โโโ Refuel Start โ โ โโโ Refuel End (Fired on refuel stop) โ โ โโโ Refuel Payed (Fired on refuel end/engine start) โ โโโ GameplayEvents (1.14/1.01/1.35): โ โโโ Refuel: โ โ โโโ Amount (No Version note) (see changelog update 10.4 for some notes to that) โ โโโ Cancelled: โ โ โโโ Started (This value could be wrong if profile is closed or game is restarted, see changelog update 10.4) โ โ โโโ Finished โ โ โโโ Penalty โ โโโ Delivered: โ โ โโโ Started (This value could be wrong if profile is closed or game is restarted, see changelog update 10.4) โ โ โโโ Finished> โ โ โโโ StartedBackup (See changelog update 10.4 and documentation for notes to that property) โ โ โโโ AutoLoaded โ โ โโโ AutoParked โ โ โโโ CargoDamage โ โ โโโ DeliveryTime โ โ โโโ DistanceKm โ โ โโโ EarnedXp โ โ โโโ Revenue โ โโโ Fined: โ โ โโโ Amount โ โ โโโ Offence โ โโโ Tollgate: โ โ โโโ PayAmount โ โโโ Transport: โ โโโ PayAmount โ โโโ SourceId โ โโโ SourceName โ โโโ TargetId โ โโโ TargedName
Also there are a few more fields you can use:
Truck.Positioning:
- Head position in Cabin Space
- Head position in Vehicle Space
- Head position in World Space
- Head Position in World Space
- Cabin Position in World Space
- Hook Position in World Space
Methods:
- In-game Minutes to Date(Time)
- Add 2 FVectors
- Add a FVector and a DVector
- Rotate: Rotates specified vector by specified orientation
May I forgot something or there is a missing version information. When you found missing values or something else create an issue that would be great.
The fields are updated as fast as ETS2/ATS can and will do, as this is how the SDK has been designed by SCS. When a telemetry value has changed the SDK will immediately call a handler. This plug-in implements this handler which stores the data to the right field inside the data structure. There is no "sample ticker" yet. This must be done at the client side, by regularly checking if the timestamp has been updated.
Actually I'm not fully happy with the actual demo. But I didn't reached my plan that works like the old one. Later I will change the current demo so that they will be a lot times better.
If you want to use javascript have a look here Kniffen TruckSim-Telemetry.
For other languages you need to create/find a library that can open and read MemoryMapped files. The data storage format is binary and can be found in "scs-telemetry/inc/scs-telemetry-common.hpp". The shared memory map name is "Local\SCSTelemetry". I will add some more documentary in this header later.
There will be some upcoming changes. One changes will probably linux support, which will using tcp on windows and linux. So shared memory would be dropped. Additional, also to still achieve a better performance, changes to when data will be send will be done. Currently data is partly updated and fully parsed on c# side. That will change. The c# side will not parse the full object each time when the changes going live.