InSim structs

From LFS Manual
Revision as of 20:10, 10 February 2026 by Bokujishin (talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to navigationJump to search

Introduction

InSim defines a number of structs that are used with the various available packets. The following is an exhaustive list of the documented structs in InSim 10 as of LFS 0.8B.

CarHCP

Car handicaps defined in 2 bytes, used in IS_HCP.

CarHCP struct properties
Type Name Description
byte H_Mass 0 to 200 - added mass (kg)
byte H_TRes 0 to 50 - intake restriction

PlayerHCap

Player handicaps defined in 4 bytes, used in IS_PLH.

PlayerHCap struct properties
Type Name Description
byte PLID player's unique id
byte Flags bit 0: set Mass / bit 1: set TRes (e.g. Flags=3 to set both) / bit 7: silent
byte H_Mass 0 to 200 - added mass (kg)
byte H_TRes 0 to 50 - intake restriction

ObjectInfo

Info about a single object (see LYT for more details), used in IS_JRR, IS_UCO, IS_AXM.

ObjectInfo struct properties
Type Name Description
short X
short Y
byte Zbyte
byte Flags
byte Index
byte Heading

NodeLap

Car info in 6 bytes, used in IS_NLP.

NodeLap struct properties
Type Name Description
word Node current path node
word Lap current lap
byte PLID player's unique id
byte Position current race position: 0 = unknown, 1 = leader, etc...

CompCar

Car info in 28 bytes, used in IS_MCI.

CompCar struct properties
Type Name Description
word Node current path node
word Lap current lap
byte PLID player's unique id
byte Position current race position: 0 = unknown, 1 = leader, etc...
byte Info flags and other info - see below
byte Sp3
int X X map (65536 = 1 metre)
int Y Y map (65536 = 1 metre)
int Z Z alt (65536 = 1 metre)
word Speed speed (32768 = 100 m/s)
word Direction car's motion if Speed > 0: 0 = world y direction, 32768 = 180 deg
word Heading direction of forward axis: 0 = world y direction, 32768 = 180 deg
short AngVel signed, rate of change of heading: (16384 = 360 deg/s)

CarContact

16 bytes defining a car having a contact, used in IS_CON.

CarContact struct properties
Type Name Description
byte PLID
byte Info like Info byte in CompCar (CCI_BLUE / CCI_YELLOW / CCI_OOB / CCI_LAG)
byte Sp2 spare
char Steer front wheel steer in degrees (right positive)
byte ThrBrk high 4 bits: throttle / low 4 bits: brake (0 to 15)
byte CluHan high 4 bits: clutch / low 4 bits: handbrake (0 to 15)
byte GearSp high 4 bits: gear (15=R) / low 4 bits: spare
byte Speed m/s
byte Direction car's motion if Speed > 0: 0 = world y direction, 128 = 180 deg
byte Heading direction of forward axis: 0 = world y direction, 128 = 180 deg
char AccelF m/s^2 longitudinal acceleration (forward positive)
char AccelR m/s^2 lateral acceleration (right positive)
short X position (1 metre = 16)
short Y position (1 metre = 16)

CarContOBJ

8 bytes defining a car in a contact with an object, used in IS_OBH, IS_HLV, IS_UCO, IS_CSC.

CarContOBJ struct properties
Type Name Description
byte Direction car's motion if Speed > 0: 0 = world y direction, 128 = 180 deg
byte Heading direction of forward axis: 0 = world y direction, 128 = 180 deg
byte Speed m/s
byte Zbyte
short X position (1 metre = 16)
short Y position (1 metre = 16)

AIInputVal

4 bytes defining an input for AI control, used in IS_AIC.

AIInputVal struct properties
Type Name Description
byte Input Select input value to set
byte Time Time to hold (optional, hundredths of a second)
word Value Value to set

OSMain

Identical to OutSimMain, included in IS_AII.

OSMain struct properties
Type Name Description
Vector AngVel 3 floats, angular velocity vector
float Heading anticlockwise from above (Z)
float Pitch anticlockwise from right (X)
float Roll anticlockwise from front (Y)
Vector Accel 3 floats X, Y, Z
Vector Vel 3 floats X, Y, Z
Vec Pos 3 ints X, Y, Z (1m = 65536)

OutSimPack

Used in OutSim if the OutSim Opts are equal to 0, and in IS_AII.

OutSimPack struct properties
Type Name Description
unsigned Time time in ms (to check order)
Vector AngVel 3 floats, angular velocity vector
float Heading anticlockwise from above (Z)
float Pitch anticlockwise from right (X)
float Roll anticlockwise from front (Y)
Vector Accel 3 floats X, Y, Z
Vector Vel 3 floats X, Y, Z
Vec Pos 3 ints X, Y, Z (1m = 65536)
int ID optional - only if OutSim ID is specified

OutGaugePack

Used in OutGauge and IS_AII.

OutGaugePack struct properties
Type Name Description
unsigned Time time in ms (to check order)
char Car[4] Car name
word Flags Info (see OG_x below)
byte Gear Reverse:0, Neutral:1, First:2...
byte PLID Unique ID of viewed player (0 = none)
float Speed M/S
float RPM RPM
float Turbo BAR
float EngTemp C
float Fuel 0 to 1
float OilPressure BAR
float OilTemp C
unsigned DashLights Dash lights available (see DL_x below)
unsigned ShowLights Dash lights currently switched on
float Throttle 0 to 1
float Brake 0 to 1
float Clutch 0 to 1
char Display1[16] Usually Fuel
char Display2[16] Usually Settings
int ID optional - only if OutGauge ID is specified