The online racing simulator
Searching in All forums
(266 results)
Telemetry
Bokujishin
S3 licensed
I am working on a telemetry tool to record and display charts with various data, based on my Godot InSim library. Here's an example screenshot of recorded data:


This tool allows you to record full laps and display the data, or just arbitrary bits of driving by starting and stopping the recording. It uses OutSim and OutGauge for recording, which require either cockpit view or custom view to work properly. This also means you can only record your own car while driving, or any car in an SPR replay (no recording is possible in MPR).

You can find more info and download links on the GitHub repository.

Feel free to give it a try and give some feedback! Please do note that this is still a work in progress though.

Quick guide:
Use the Recording tab to connect to InSim and record data. There is a help button to explain the settings, you can leave everything blank as long as you set the appropriate values in the cfg.txt file.
The app saves .tlm files for each completed lap (incomplete laps work too). After recording, you can use the Telemetry tab to open up to 2 laps (main and reference), the reference lap will appear in gray.

For now I would recommend official layouts for lap comparison, as the charts are plotted against OutSim's indexed distance (the official track length), and as custom layouts lack this indexed distance, they use the distance traveled by the car instead, which varies from lap to lap. I am working on a way to recompute the indexed distance from a .pth file (this part works), and also considering a way to generate a .pth file from a recorded lap (not sure how feasible this one is).

Note that there is no real-time display of telemetry at this time, I'm not sure I will add this.
Right now telemetry does not display in real time, you first record a session, and then display it in the telemetry tab by loading a tlm file ( a file is created when you start recording and each time you cross the finish line).

Note: tlm files are recorded by default to %appdata%\Godot\app_userdata\LFSTelemetry\tlm, and the file dialog should open there when you try to load a file.

Small gotcha if you record a hotlap replay: crossing the finish line to start the first hotlap does not trigger a new lap event from InSim, so if you start recording "too early", the line will jump across the entire chart. I suggest either waiting for the lap to start (losing a few data points in the process) or slowing the replay down to catch the start of the lap, then resuming normal speed (you can even record in fast forward with no issue as long as your computer manages).


Disclaimer: I took some heavy inspiration from MoTeC screenshots I found here and there for chart display.
Last edited by Bokujishin, .
Bokujishin
S3 licensed
Entry number : 21
Entry name : Pourquoi Pas
Car: XRT
Entered driver (Ingame name / LFSW name / Country) : Cyk / Bokujishin / France
Bokujishin
S3 licensed
Oh, never thought about comment spacing, good thing I included the script Big grin
Removing the extra space does work, thanks for the workaround.
/run fails to assign buttons with ctrl_fXX and alt_fXX commands
Bokujishin
S3 licensed
I created 2 scripts to run when I change wheels, so I can quickly reassign buttons.
All standard functions work fine (pit_speed, flash, etc.), but the script throws errors for all ctrl_f10, alt_f10 and such lines:
wheel_formula : line 10 - Unknown button function

This is what my script looks like:
// Fanatec wheel with Button Module Endurance

/button 7 left_view
/button 1 right_view
/button 8 horn
/button 12 flash
/button 3 pit_speed
/button 4 tc_disable
/button 10 ignition
/button 23 ctrl_f9 // Indicator left
/button 24 ctrl_f10 // Indicator right
/button 11 ctrl_f11 // Hazard lights
/button 9 ctrl_f12 // Indicators off
/button 2 alt_f1 // toggle headlights
/button 49 alt_f2 // Front ARB +5
/button 50 alt_f3 // Front ARB -5
/button 37 alt_f5 // Rear ARB +5
/button 38 alt_f6 // Rear ARB -5
/button 27 alt_f9 // Status next
/button 32 alt_f10 // Status prev
/button 33 alt_f11 // Brake bal +1
/button 31 alt_f12 // Brake bal -1

Bokujishin
S3 licensed
I'm going to report myself because that was stupid.

Session AND SERVER of Incident: Race 1
Lap AND MPR timecode of incident (or session time or UTC Time of Day): Lap 1, MPR timecode 2:20
Car(s) involved: 21, 19, collateral damage 51 and 54
Location of Incident: Turn 1
Brief Description of Incident: 21 dives on the inside and collides with 19.
Bokujishin
S3 licensed
Bokujishin/Read and Understood
Bokujishin
S3 licensed
GodotInSim is now feature complete after I added InSimRelay and fixed more bugs, so I released version 1.0.0 on GitHub.
If you are interested, you can take a look at this simple demo.
Bokujishin
S3 licensed
Okay, so as per usual, it turns out I did make a mistake (though I don't fully understand it): when I refactored my connection code, I changed the PacketPeerUDP socket's bind() method to connect_to_host(); this works perfectly fine for InSim itself, but not for OutGauge, OutSim and the NLP/MCI packets sent via UDP. On the other hand, using bind() triggers an error when connecting InSim (this is the part I don't get), but it works for the others.
I solved this a bit hackily by changing how I connect the socket for InSim and the others, and everything is working so far. Still getting the InSim errors when using the same port, though.

Networking isn't exactly my forte, apologies for the short monologue Wave
Mixed TCP/UDP for InSim
Bokujishin
S3 licensed
As I'm close to releasing a "production-ready" version of my GodotInSim library, I went back to the details of the TCP/UDP settings in the ISI packet. Using full TCP or full UDP works just fine (UDPPort = 0 for both protocols), however I am having issues with NLP/MCI packets on mixed TCP/UDP, as well as just UDP but using a different port (basically, any time I set UDPPort to something other than zero).

Using Wireshark, I can see the packets are being sent (with port numbers e.g. 29999 -> 30000, haven't checked their contents), however I can't seem to get any packet in Godot (I already checked the UDP socket is connected on the correct port). Additionally, setting UDPPort to the same port as the TCP one causes LFS to throw errors for each NLP/MCI packet sent:
Quote :InSim : first packet has unexpected size - should be ISI
InSim : first byte in packet does not represent size

To sum up the possible options:
  1. connect using TCP, UDPPort == 0: works fine
  2. connect using UDP, UDPPort == 0: works fine
  3. connect using TCP, UDPPort != connection port: cannot get NLP/MCI packets
  4. connect using TCP, UDPPort == connection port: cannot get NLP/MCI packets, InSim throws errors
  5. connect using UDP, UDPPort != ISI port: cannot get NLP/MCI packets
  6. connect using UDP, UDPPort == ISI port: cannot get NLP/MCI packets, InSim throws errors (more of the same error when sending packets)
For reference, my implementation has an LFSConnection class/pseudo-interface to handle connect, disconnect, send_packet and get_packet, with LFSConnectionTCP and LFSConnectionUDP implementing those functions. LFSConnectionTCP also creates an instance of LFSConnectionUDP. Both the "main" UDP connection and the child one with TCP exhibit the same issues, and the main UDP connection can still send and receive other packets, only NLP/MCI are missing (though in case 6 above, sending packets causes additional InSim errors).

I will investigate some more on the Godot side and in my code, in case I made a mistake somewhere, but I would appreciate any insight, also the errors do seem to be an issue on LFS's side. I just cannot understand why those packets are not being picked up by Godot, especially in UDP-only mode (cases 5-6 above), as other packets are being sent and received properly.
Bokujishin
S3 licensed
#21
Bokujishin
S3 licensed
Nice, I wanted to try Bad Apple in LFS using modded "vehicles" with lights for pixels, but then realized you could only control the local car's lights with this, so the only way I can hope to do something half-decent would be to have 40 people running some "pixels" in sync.
Never thought about using InSim buttons, this looks quite good! Maybe using filled rectangles instead of underscores would make it better?
Bokujishin
S3 licensed
To add to the "changing one line of code": maybe (and I say maybe) it would be that simple to change the maximum number of gears.
But then, you have to check other parts of the game, make sure it works on any vehicle with more than 7 gears, update the UI properly to allow tweaking gear ratios for all gears (does it still fit the screen if you have 10 or more?). You also have to consider InSim, which sends packets with the current gear, is there anything that needs to change to accommodate the higher number of gears?

It really never is that easy to change something in code, or rather it is usually only somewhat easy in smaller projects. That said, I agree that at some point (ideally of course after the new physics and graphics), it would be nice to see more than 7 gears for some vehicles. As has been said, although it is a *racing* simulator, we do have street cars in the official selection of cars, and they can race...
Bokujishin
S3 licensed
I just released version 0.9, including a bunch of fixes for various packets, better color handling for text (including stripping and conversion to/from BBCode), and utility functions for unit conversion (kph to mph, rad to deg and various other units).

I will now work on adding InSimRelay support, and try to test host packets, as I haven't managed to connect to InSim with host/admin privileges yet.

Thanks for the kind words!
Bokujishin
S3 licensed
21/Bokujishin/Cyril Bissey/France/no team
Bokujishin
S3 licensed
I found some time to work on text encoding, once again shamelessly adapting/stealing code from Flame CZE and adapting it to Godot.
I have released version 0.8.1 on GitHub containing this feature as well as fixes for several other issues with various packets.


I should now have everything I wanted to add (unless I'm forgetting something), so will bump the version to 1.0 after some more testing and bug fixing.

Some projects I am working on with this tool:
  • Telemetry recording and display
  • Live race stats (minimap with driver names, standings with tyre compounds, pit stops, time deltas, etc.)
  • PTH and SMX file parsers to display them in 3D
Allow custom penalty time in InSim PEN packet
Bokujishin
S3 licensed
From the set pitstop suggestion thread:
Quote from Scawen :We can set number of laps and a penalty, so I guess the number of pit stops done is the one missing thing.

I noticed that the PEN packet has a spare byte, could it be used to set custom penalties in addition to predefined ones? e.g. 5s, granularity of byte allows for single second penalties.

These penalties could be easily adjusted, though I must say I'm not sure how it should be presented to the players or actually set as part of the PEN packet - alternatively, add a new packet for this, such as PET (PEnalty Time)?

The command to set the penalty could take the format /penalty USERNAME TIME.
Bokujishin
S3 licensed
#21
Bokujishin
S3 licensed
21/Bokujishin/XRR
Bokujishin
S3 licensed
Quick nitpick in IX.4.a), I believe "all other teams" should be "all other drivers".
Bokujishin
S3 licensed
yes/21/Bokujishin
Bokujishin
S3 licensed
In the Signups post, it says we need an S2 license, but isn't Rockingham S3 only?
Bokujishin
S3 licensed
21/Bokujishin/Cyril Bissey/France/no team/cyk774
Bokujishin
S3 licensed
Session AND SERVER of Incident: Main, Race 2
Lap AND MPR timecode of incident (or session time or UTC Time of Day): lap 2, MPR 4:48
Car(s) involved: 21, 35, 27
Location of Incident: turn 5
Brief Description of Incident: 35 spins 21 into the gravel, may have been "helped" by 27 (not sure if sliding on their own or following contact with 27).
Godot InSim
Bokujishin
S3 licensed
For anyone using the Godot game engine, I released an InSim library written in GDScript, which includes support for InSim, OutSim OutGauge and InSimRelay.

GitHub link to the library (MIT license)
GitHub link to a very simple demo



The library supports InSim version 9 as of LFS version 0.7F.

What is included:
  • All InSim packets are implemented.
  • All text input is done from UTF8 and converted to LFS format, all packets convert text back to UTF8.
  • OutSim can be used from the configuration file.
  • OutGauge can be used from the configuration file.
  • InSimRelay is available.
  • There are some utility functions in the GISUtils class for converting units.
Feel free to try it if you're interested, I will update with examples as I have time to work on them.
There are also a .pth file reader and a .smx file reader included, for 3D rendering.


Special thanks:
Flame CZE and his Node InSim library, where I found how to parse car names for mods and took inspiration for text conversion.
Last edited by Bokujishin, .
Bokujishin
S3 licensed
Updated #21 with some more logos.
FGED GREDG RDFGDR GSFDG