Quick reference guide for InSim packets in LFS.
Full specification: https://en.lfsmanual.net/wiki/InSim.txt
All InSim packets follow this basic structure:
struct PacketHeader {
byte Size; // Packet size in multiples of 4
byte Type; // Packet type (ISP_*)
byte ReqI; // Request ID (usually 0)
byte SubT; // Sub-type (depends on packet)
};
| Code | Name | Description | Direction | Priority |
|---|---|---|---|---|
| 1 | IS_ISI | InSim Init | → LFS | Critical |
| 2 | IS_VER | Version | ← LFS | High |
| 3 | IS_TINY | Tiny packet | ↔ Both | Medium |
| 5 | IS_STA | State | ← LFS | High |
| 11 | IS_MSO | Message Out | ← LFS | Low |
| 17 | IS_RST | Race Start | ← LFS | High |
| 18 | IS_NCN | New Connection | ← LFS | Medium |
| 19 | IS_CNL | Connection Leave | ← LFS | Medium |
| 21 | IS_NPL | New Player | ← LFS | High |
| 22 | IS_PLP | Player Leave Pits | ← LFS | Medium |
| 24 | IS_LAP | Lap Time | ← LFS | High |
| 25 | IS_SPX | Split Time | ← LFS | High |
| 26 | IS_PIT | Pit Stop | ← LFS | Medium |
| 27 | IS_PSF | Pit Stop Finish | ← LFS | Medium |
| 30 | IS_PEN | Penalty | ← LFS | Medium |
| 34 | IS_FIN | Finished Race | ← LFS | High |
| 35 | IS_RES | Result | ← LFS | High |
| 37 | IS_NLP | Node and Lap | ← LFS | High |
| 38 | IS_MCI | Multi Car Info | ← LFS | Critical |
Most important for real-time telemetry.
Frequency: Configurable via Interval parameter (centèssimes de segon)
Contains:
Data conversions:
# Position in meters
x_meters = x / 65536.0
y_meters = y / 65536.0
z_meters = z / 65536.0
# Speed in m/s
speed_ms = speed / 32768.0
# Speed in km/h
speed_kmh = (speed / 32768.0) * 3.6
Alternative to IS_MCI with node-based positioning.
Frequency: Configurable via Interval parameter
Contains:
Complete lap information.
Contains:
Sector timing information.
Contains:
Race configuration and start.
Contains:
Player finished race.
Contains:
Race result for a player.
Contains:
New player connection.
Contains:
Player joins track.
Contains:
Small control packets.
Sub-types:
Small data packets.
Usage: Various small data requests/responses
# Send TINY_SST to request IS_STA
tiny_packet = struct.pack("=4B", 1, 3, 0, 7) # TINY_SST
client.send_packet(tiny_packet)
# Initialize with MCI and NLP packets
flags = 0x30 # ISF_MCI | ISF_NLP
interval = 100 # 1 second (100 centiseconds)
isi_packet = struct.pack(
"=4BH2BH16s16s",
44, 1, 0, 0,
0, flags, 9, ord('!'), interval,
b'', b'MyApp'.ljust(16, b'\x00')
)
client.send_packet(isi_packet)
Always handle these scenarios:
examples/ directory