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.
Because the memset in the shutdown function of the c++ code seems sometimes leads to long closing times of ets2/ats this function is removed.
That means at the moment that while the shared memory is open, closing the game will not erase the shared memory values. To identify if the sdk is loaded
use the SdkActive
field of the SCSTelemetry object. The Dll to Rev 10 Update 4 does not contains the fix that set the value to 0 if the game is closed.
If you do not want to build the dll by yourself you could use the Timestamp
field. That should be reseted when the game is started.
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 11 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 | Work |
1.35 | 1.14 | Works |
1.36 | 1.15 | Works, Test Version |
Game Version | SDK Version | Plugin State |
---|---|---|
1.34 and before | 1.0 | Should Work |
1.35 | 1.01 | Works |
1.36 | 1.02 | 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 |
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 most (every) time the same and most of you doesn't now the specific Game SDK Version.
Changes are marked with the deleted Tag.
New stuff is marked with the inserted Tag.
Game Values (V.1.10.5): β βββ 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 β β β βββ 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 β β β βββ 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.