Loading...
 

LFS UDP Data

StartCountDescription
04 Time
44 Car Name
82 OG Flags
101 Gear
111 View ID
124 Speed
164 RPM
204 Turbo
244 Coolant Temp
284 Fuel Level
324 Oil Pressure
364 Oil Temp
404 Dash Lights Available
444 Dash Lights Active
484 Throttle
524 Brakes
564 Clutch
6016 Display Line 1
7616 Display Line 2
921 OutSim ID (Optional)



  • Car: UF1,XFG,XRG,XRT,FXO,RB4,LX4,LX6,RAC,FZ5,MRT,FOX,FO8,BF1,FBM,XFR,UFR,XRR, FZR, FXR

  • Flags: It's a bitflag value, so each bit represents a value either on/off. It's best to test them this way, as the int value that comes out from LFS isn't really the best way to use it. Best way is to learn about bitflags, bitwise operations and testing for them that way. (SEE OG_x)

  • Gear: In LFS right now, you have 0->8 as possible ranges. 0 = R, 1 = N, 2 = 1st, etcera.

  • PLID: It's the PLID of the player you're receiving data for (On an online server with AI's.. you receive data for ALL your AI's. It's important/best to use IS_STA to filter out the currently viewed player).

  • Speed: It's in metres/second. To convert to km/h you must multiply by 3.6. The highest you would probably see naturally in LFS is around 100m/s (about 360 kmh)

  • RPM: It's RPM. Normal road cars are about 8000 RPM as a max. The racing cars vary based upon their redline, however you can always see retarded values in all cars by going to top gear at high speed, putting the clutch in, shifting to 1st and then dumping the clutch. You also damage your engine doing this. (This effect was much more significant in 0.3).

  • Turbo: It's in BAR. Again, this depends on the car. To convert to PSI, multiply by 14.5. (You can detect if the user desires PSI or BAR by checking the flags)

  • EngTemp: This doesn't work in LFS yet, so it's static, doesn't move, and should be ignored.

  • Fuel: It's a floating point number between 0 and 1. Multiply by 100 to get the percentage of fuel.

  • Oil Pressure: Yet again, doesn't work in LFS yet.¬†

  • Oil Temp: Doesn't work yet.

  • DashLights: A bitflag value indicating the available dash lights in the current car. (see DL_x)

  • Show Lights: A bitflag value indicating what dash lights are currently active/on. (see DL_x)

  • Throttle/Brake/Clutch: Floating point between 0 and 1 to indicate the current percentage (multiply by 100 to get the percentage)

  • Display1/Display2¬†Only truly useful on the formula cars, but shows what settings text is currently active. Arrow keys should manipulate these values regardless of whether or not the F11/F12 menu is open. (This one is the only one I'm not certain about as I haven't actually solidly tried it.



// TYPES : (all multi-byte types are PC style - lowest byte first)
// =====

// char			1-byte character
// byte			1-byte unsigned integer
// word			2-byte unsigned integer
// short		2-byte signed integer
// unsigned		4-byte unsigned integer
// int			4-byte signed integer
//a float		4-byte float



// OutGauge - EXTERNAL DASHBOARD SUPPORT
// ========

// The user's car in multiplayer or the viewed car in single player or
// single player replay can output information to a dashboard system
// while viewed from an internal view.

// This can be controlled by 5 lines in the cfg.txt file :

// OutGauge Mode 0        :0-off 1-driving 2-driving+replay
// OutGauge Delay 1       :minimum delay between packets (100ths of a sec)
// OutGauge IP 0.0.0.0    :IP address to send the UDP packet
// OutGauge Port 0        :IP port
// OutGauge ID 0          :if not zero, adds an identifier to the packet

// Each update sends the following UDP packet :

struct OutGaugePack
{
	unsigned	Time;			// time in milliseconds (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
};

// OG_x - bits for OutGaugePack Flags

#define OG_SHIFT		1		// key
#define OG_CTRL			2		// key

#define OG_TURBO		8192	// show turbo gauge
#define OG_KM			16384	// if not set - user prefers MILES
#define OG_BAR			32768	// if not set - user prefers PSI

// DL_x - bits for OutGaugePack DashLights and ShowLights

enum
{
	DL_SHIFT,			// bit 0	- shift light
	DL_FULLBEAM,		// bit 1	- full beam
	DL_HANDBRAKE,		// bit 2	- handbrake
	DL_PITSPEED,	                 // bit 3	- pit speed limiter
	DL_TC,				// bit 4	- TC active or switched off
	DL_SIGNAL_L,		        // bit 5	- left turn signal
	DL_SIGNAL_R,		        // bit 6	- right turn signal
	DL_SIGNAL_ANY,		// bit 7	- shared turn signal
	DL_OILWARN,			// bit 8	- oil pressure warning
	DL_BATTERY,			// bit 9	- battery warning
	DL_ABS,				// bit 10	- ABS active or switched off
	DL_SPARE,			// bit 11
	DL_NUM
};