TCP or UDP packets can be sent in both directions, LFS reporting various things about its state, and the external program requesting info and controlling LFS with special packets, text commands or keypresses.
OR start LFS with the command line option : LFS /insim=xxxxx This will make LFS listen for packets on that TCP and UDP port.
To avoid defining several packet structures that are exactly the same, and to avoid wasting the ISP_ enumeration,
IS_TINY is used at various times when no additional data other than SubT is required.
IS_SMALL is used when an additional integer is needed.
ReqI : 0
SubT : TINY_CLOSE (close this connection)
Another InSimInit packet is then required to start operating again.
You can shut down InSim completely and stop it listening at all by typing /insim=0 into LFS (or send a MsgTypePack to do the same thing).
LFS will send a blank IS_TINY packet like this every 30 seconds :
ReqI : 0
SubT : TINY_NONE (keep alive packet)
You should reply with a blank IS_TINY packet :
ReqI : 0
SubT : TINY_NONE (has no effect other than resetting the timeout)
To request a StatePack at any time, send this IS_TINY :
ReqI : non-zero (returned in the reply)
SubT : TINY_SST (Send STate)
Other states must be set by using keypresses or messages (see below)
You can send individual key presses to LFS with the IS_SCH packet. For standard keys (e.g. V and H) you should send a capital letter. This does not work with some keys like F keys, arrows or CTRL keys. You can also use IS_MST with the /press /shift /ctrl /alt commands.
On ending or leaving a host, LFS will send this IS_TINY :
ReqI : 0
SubT : TINY_MPE (MultiPlayerEnd)
To request an IS_ISM packet at any time, send this IS_TINY :
ReqI : non-zero (returned in the reply)
SubT : TINY_ISM (request an IS_ISM)
When a vote is cancelled, LFS sends this IS_TINY
ReqI : 0
SubT : TINY_VTC (VoTe Cancelled)
When a vote is completed, LFS sends this IS_SMALL
ReqI : 0
SubT : SMALL_VTA (VoTe Action)
UVal : action (VOTE_X - Vote Action as defined)
You can instruct LFS host to cancel a vote using an IS_TINY
ReqI : 0
SubT : TINY_VTC (VoTe Cancel)
If you are making a multiplayer InSim program, you must maintain two lists You should use the unique identifier UCID to identify a connection
Each player has a unique identifier PLID from the moment he joins the race, until he leaves. It's not possible for PLID and UCID to be the same thing, for two reasons :
When all players are cleared from race (e.g. /clear) LFS sends this IS_TINY
ReqI : 0
SubT : TINY_CLR (CLear Race)
When a race ends (return to game setup screen) LFS sends this IS_TINY
ReqI : 0
SubT : TINY_REN (Race ENd)
The following packets are sent when the relevant events take place :
To request an IS_RST packet at any time, send this IS_TINY :
ReqI : non-zero (returned in the reply)
SubT : TINY_RST (request an IS_RST)
REOrder - this packet can be sent in either direction
LFS sends one at the start of every race or qualifying session, listing the start order
You can send one to LFS before a race start, to specify the starting order. It may be a good idea to avoid conflict by using /start=fixed (LFS setting). Alternatively, you can leave the LFS setting, but make sure you send your IS_REO AFTER you receive the IS_VTA. LFS does its default grid reordering at the same time as it sends the IS_VTA (VoTe Action) and you can override this by sending an IS_REO.
To request an IS_REO packet at any time, send this IS_TINY :
ReqI : non-zero (returned in the reply)
SubT : TINY_REO (request an IS_REO)
In each case, ReqI must be non-zero, and will be returned in the reply packet
ReqI : 0
SubT : TINY_AXC (AutoX Cleared)
You can request information about the current layout with this IS_TINY :
ReqI : non-zero (returned in the reply)
SubT : TINY_AXI (AutoX Info)
The information will be sent back in this packet (also sent when a layout is loaded)
On false start or wrong route / restricted area, an IS_PEN packet is sent :
If an autocross object is hit (2 second time penalty) this packet is sent.
To receive IS_NLP or IS_MCI packets at a specified interval :
If ISF_NLP flag is set, one IS_NLP packet is sent...
If ISF_MCI flag is set, a set of IS_MCI packets is sent...
You can change the rate of NLP or MCI after initialisation by sending this IS_SMALL :
ReqI : 0
SubT : SMALL_NLI (Node Lap Interval)
UVal : interval (0 means stop, otherwise time interval : 50, 60, 70... 8000 ms)
To request Car Positions from the currently viewed car, send this IS_SMALL :
ReqI : 0
SubT : SMALL_SSP (Start Sending Positions)
UVal : interval (time between updates - zero means stop sending)
If OutSim has not been setup in cfg.txt, the SSP packet makes LFS send UDP packets if in game, using the OutSim system as documented near the end of this text file.
You do not need to set any OutSim values in LFS cfg.txt - OutSim is fully initialised by the SSP packet.
The OutSim packets will be sent to the UDP port specified in the InSimInit packet.
To request Dashboard Packets from the currently viewed car, send this IS_SMALL :
ReqI : 0
SubT : SMALL_SSG (Start Sending Gauges)
UVal : interval (time between updates - zero means stop sending)
If OutGauge has not been setup in cfg.txt, the SSG packet makes LFS send UDP packets if in game, using the OutGauge system as documented near the end of this text file.
You do not need to set any OutGauge values in LFS cfg.txt - OutGauge is fully initialised by the SSG packet.
The OutGauge packets will be sent to the UDP port specified in the InSimInit packet.
ReqI : non-zero (returned in the reply)
SubT : TINY_SCP (Send Cam Pos)
LFS will reply with a IS_CPP CamPosPack as described above. You can store this packet and later send back exactly the same packet to LFS and it will try to replicate that camera position.
ReqI : non-zero (returned in the reply)
SubT : TINY_GTH (Get Time in Hundredths)
The time will be sent back in this IS_SMALL :
ReqI : non-zero (as received in the request packet)
SubT : SMALL_RTP (Race Time Packet)
UVal : Time (hundredths of a second since start of race or replay)
You can stop or start time in LFS and while it is stopped you can send packets to move time in steps. Time steps are specified in hundredths of a second. Warning : unlike pausing, this is a "trick" to LFS and the program is unaware of time passing so you must not leave it stopped because LFS is unusable in that state. This packet is not available in live multiplayer mode.
Stop and Start with this IS_SMALL :
ReqI : 0
SubT : SMALL_TMS (TiMe Stop)
UVal : stop (1 - stop / 0 - carry on)
When STOPPED, make time step updates with this IS_SMALL :
ReqI : 0
SubT : SMALL_STP (STeP)
UVal : number (number of hundredths of a second to update)
You can request an IS_RIP packet at any time with this IS_TINY :
ReqI : non-zero (returned in the reply)
SubT : TINY_RIP (Replay Information Packet)
LFS can display normal buttons in these four screens :
The recommended area for most buttons is defined by.
If you draw buttons in this area, the area will be kept clear to avoid overlapping LFS buttons with your InSim program's buttons. Buttons outside that area will not have a space kept clear. You can also make buttons visible in all screens - see below.
To delete one button or clear all buttons, send this packet.
To send a button to LFS, send this variable sized packet.
Host buttons and local buttons are stored separately, so there is no chance of a conflict between a host control system and a local system (although the buttons could overlap on screen).
Programmers of local InSim programs may wish to consider using a configurable button range and possibly screen position, in case their users will use more than one local InSim program at once.
On clicking the button, a text entry dialog will be opened, allowing the specified number of characters to be typed in. The caption on the text entry dialog is optionally customisable using Text in the IS_BTN packet. If the first character of IS_BTN's Text field is zero, LFS will read the caption up to the second zero. The visible button text then follows that second zero.
Replies : If the user clicks on a clickable button, this packet will be sent.
If the TypeIn byte is set in IS_BTN the user can type text into the button In that case no IS_BTC is sent - an IS_BTT is sent when the user presses ENTER
This can be controlled by 5 lines in the cfg.txt file :
OutSim Mode 0 :0-off 1-driving 2-driving+replay OutSim Delay 1 :minimum delay between packets (100ths of a sec) OutSim IP 0.0.0.0 :IP address to send the UDP packet OutSim Port 0 :IP port OutSim ID 0 :if not zero, adds an identifier to the packet
Each update sends the following UDP packet.
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.