LFS Programming

From LFS Manual
Revision as of 09:47, 22 June 2009 by DarkTimes (talk | contribs) (Fixed tables.)
Jump to navigationJump to search


LFS is a very programmer friendly game, and while official modification of the game engine is not allowed, there are many ways that addon writers can cutomise and control the playing experience. This section of the wiki details several ways of doing this, as well as other general programmer related information.

Programming Categories


InSim is a protocol which allows an external program to communicate with Live for Speed. It allows you to create a socket connection with the game and to send and receive packets of data. The InSim protocol describes how each of these packets is formatted, and any programming language which can create a network connection and send and receive strings of binary data can interface with it.

OutSim / OutGauge

Similar to InSim, OutSim and OutGauge also allow you to create a socket connection from an external program, but specifically for the support of motion simulators and external dashboards.

LFSWorld stats

Through the use of LFSWorld stats, addon programmers are able to query the LFSWorld Web site for a whole host of information about the racers who play the game and the servers they play on.

File Formats

Many of LFS's unique file formats have been documented, both officially by the development team, and unofficially by enthusiastic hackers with hex-editors.

General Programming Information


LFS is written in the C++ programming language and many of data-types used are from that language. Here is a break-down of the various data-types used by LFS and what they mean.

Type Name Notes
char 1 byte unsigned character A character from the alphabet
byte 1 byte unsigned integer A number between 0 and 255
word 2 byte unsigned integer A number between 0 and 65,535
short 2 byte signed integer A number between −32,768 and +32,767
unsigned 4 byte unsigned integer A number between 0 and +4,294,967,295
int 4 byte signed integer A number between −2,147,483,648 and +2,147,483,647
float 4 byte floating point number A number with a decimal point

LFS Strings and Escape Codes

LFS does not support unicode strings and instead uses it's own system of character escape codes.

Code Name Codepage
^L Latin 1 CP1252
^G Greek ISO-8859-7
^C Cyrillic CP1251
^J Japanese Shift-JIS
^E Central Europe ISO-8859-2
^T Turkish ISO-8859-9
^B Baltic ISO-8859-13
^H Traditional Chinese CP936
^S Simpified Chinese CP949
^K Korean CP950

Escape Codes
Code Character
^a *
^c :
^d \
^s /
^q ?
^t "
^l <
^r >

Code Colour
^0 Black
^1 Red
^2 Light green
^3 Yellow
^4 Blue
^5 Purple
^6 Light blue
^7 White
^8 Dark green (default)
^9 Original text colour and codepage.