File Formats
DDS
Texture files
So you want to edit LFS files that are in DDS format? Several textures in LFS are in DDS format including lights, interiors, track signage, seats, steering wheels and several other game and car components. To customise some textures in LFS You will need to edit the appropriate DDS file. DDS files can be handled by Paint Shop Pro and Photoshop after installing the DDS plugin which can be found here:
http://developer.nvidia.com/object/nv_texture_tools.html
Although these files are hosted by Nvidia, they are not GPU-specific, so you can use them with any brand card. You don't need all of the files shown on that site. You can download a DDS viewer which can enable thumbnails in windows explorer or my computer and view them easily. There are various viewers available and all seem to work well enough. Grab the plugin if you want to edit DDS with one of the programs mentioned above.
The DDS files can be found in your LFS/data/dds folder. There are a few things to be aware of before you begin:
- Once you have changed the DDS file all of the cars of that type will show that file, the texture is used universally. For example, if you customised the interior of the XF GTi, then all XF GTi's in your sim will have the customised interior. Unlike you car skin, these files are used on every car of that type.
- Be wary of texture size. Yes I know, you've got a fast PC and it can do anything except make your bed, but still be wary of texture size. The default textures in LFS work very well, replacing a 30KB texture with a 300KB texture will use more resources. It is very easy to overdo it so be sensible and back up your files first.
- When you save your customised file you will probably be presented with some complicated save options. Just try the default settings, in other words: don't worry too much about all the bells and whistles. If the option to generate mip maps is not selected then select it first but it should be on by default in most cases.
- There is a plugin that you will need and it works for Adobe Photoshop and Jasc (recently purchased by Corel) Paint Shop Pro only. Both of these programs use the same plugin file. There is a 3DS MAX plugin too, but MAX users check your version first to see if the plugin is even required.
Please note that DDS files use an alpha layer in many cases. If you don't know what that means I suggest you consult your software's documentation and try experimenting with the DDS format files.
Remember to save your files back into DDS format!
PTH
Path nodes are a series of points with direction and width that describe the track that you drive along. LFS uses it to watch your progress along the track, decides if you are driving in reverse. They provide the data for the echoes and the lightmaps, hold information about which objects you can see from that point, define the left and right boundaries for the AI drivers and are also used in yellow and blue flag systems, the position list, timing and some other things. Their length is not constant but there is approximately 0.2 seconds of time between passing one node and the next, when you are driving at a reasonable speed.
TXT
Language Files
Thanks to Eold, we have a translation utility program which makes it easier to make language packs. See the enclosed README.txt for more information.
http://www.liveforspeed.co.uk/LFSTranslator.zip
SET
Thanks to user:colcob for working this one out ([1]), and user:Bob_Smith for updating it ([2]).
TYPES : ======= char : 1-byte ASCII character byte : 1-byte integer word : 2-byte unsigned integer float: 4-byte float Offset Type num Description ------ ---- --- ----------- 0 char 6 Description (always SRSETT) 6 byte 1 0 7 byte 1 Version? (always 250) 8 byte 1 Revision? (always 2) **alternatively a word value of 762...** 9 byte 3 0 12 byte 1 Traction Control + Asymmetrical Type (0=TC Off / Sym, 1=TC Off / Asym, 2=TC On / Sym, 3=TC On / Asym) 13 byte 2 0 15 byte 1 Tyre Brand (0=Cromo Plain, 1=Cromo, 2=Torro, 3=Michelin, 4=Evostar) 16 float 1 Brake Strength (Nm) 20 byte 1 Rear Wing Angle 21 byte 1 Front Wing Angle 22 byte 2 0 24 byte 1 Max Steering Lock 25 byte 1 Parallel Steering 26 byte 1 Brake Balance 27 byte 1 Engine Brake Reduction 28 byte 1 Centre Diff Type (0=Open, 1=Viscous) 29 byte 1 Centre Diff Viscous Torque 30 byte 1 0 31 byte 1 Centre Diff Torque Split 32 word 1 Gear Ratio 7 (0 to 65536 = 0.5 to 7.5) 34 word 1 Gear Ratio Final (0 to 65536 = 0.5 to 7.5) 36 word 1 Gear Ratio 1 (0 to 65536 = 0.5 to 7.5) 38 word 1 Gear Ratio 2 (0 to 65536 = 0.5 to 7.5) 40 word 1 Gear Ratio 3 (0 to 65536 = 0.5 to 7.5) 42 word 1 Gear Ratio 4 (0 to 65536 = 0.5 to 7.5) 44 word 1 Gear Ratio 5 (0 to 65536 = 0.5 to 7.5) 46 word 1 Gear Ratio 6 (0 to 65536 = 0.5 to 7.5) 48 byte 1 Passengers (how DO you relate to this??) 49 byte 1 Car Config (roof on LX4/6 and UF1) 50 byte 1 Traction Control Slip (divide by ten) 51 byte 1 Traction Control Engage Speed 52 float 1 Rear Spring Travel (NOT motion range) 56 float 1 Rear Spring Stiffness (N/mm) 60 float 1 Rear Compression/Bump Damping (N/mm) 64 float 1 Rear Rebound Damping (N/mm) 68 float 1 Rear Anti Roll Bar Stiffness (N/mm) 72 byte 4 0 76 byte 1 Rear Toe (0=-0.9deg, 9=0deg, 18=0.9deg) 77 byte 1 Rear Caster (i.e. always zero) 78 byte 1 Rear Tyre Type (0 through 7 is R1 through Knobbly, in order of grip) 79 byte 1 0 80 byte 1 LR Camber Adjust ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 81 byte 1 RR Camber Adjust ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 82 byte 2 0 84 byte 1 Rear Diff Type (0=Open, 1=Locked, 2=Viscous, 3=Clutch Pack) 85 byte 1 Rear Viscous Torque 86 byte 1 Rear Power Locking 87 byte 1 Rear Coast Locking 88 word 1 LR Tyre Pressure (kPa) 90 word 1 RR Tyre Pressure (kPa) 92 float 1 Front Spring Travel (NOT motion range) 96 float 1 Front Spring Stiffness (N/mm) 100 float 1 Front Bump/Compression Damping (N/mm) 104 float 1 Front Rebound Damping (N/mm) 108 float 1 Front Anti Roll Bar Stiffness (N/mm) 112 byte 4 0 116 byte 1 Front Toe In (0=-0.9deg, 9=0deg, 18=0.9deg) 117 byte 1 Front Caster (need to divide by ten) 118 byte 1 Front Tyre Type (0 through 7 is R1 through Knobbly, in order of grip) 119 byte 1 0 120 byte 1 LF Camber Adjust ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 121 byte 1 RF Camber Adjust ( 45=0.0deg, 0=-4.5deg, 90=4.5deg) 122 byte 2 0 124 byte 1 Front Diff Type (0=Open, 1=Locked, 2=Viscous, 3=Clutch Pack) 125 byte 1 Front Viscous Torque 126 byte 1 Front Power Locking 127 byte 1 Front Coast Locking 128 word 1 LF TyrePressure (kPa) 130 word 1 RF TyrePressure (kPa)
COL
The COL files are designed to hold the colour preferences setup within LFS. Below is the last "tested" format, in the typical LFS "format" (courtesy of user:sdether, [3]).
offset type number description ------ ---- ------ ----------- 0 char 6 LFSCFG 6 byte 1 0 7 byte 1 Version byte (0.5P is 250) 8 char 15 filename of the skin associated to the .COL file (part between <CAR>_ and .JPG 23 byte 1 0 24 byte 1 First Body Red Component (10-160) 25 byte 1 First Body Green Component (10-160) 26 byte 1 First Body Blue Component (10-160) 27 byte 1 0 28 byte 1 Second Body Red Component (10-160) 29 byte 1 Second Body Green Component (10-160) 30 byte 1 Second Body Blue Component (10-160) 31 byte 1 0 32 byte 1 Third Body Red Component (10-160) (only UFR) 33 byte 1 Third Body Green Component (10-160) (only UFR) 34 byte 1 Third Body Blue Component (10-160) (only UFR) 35 byte 1 0 36 byte 1 Unused Body Red Component (10-160) (only UFR) 37 byte 1 Unused Body Green Component (10-160) (only UFR) 38 byte 1 Unused Body Blue Component (10-160) (only UFR) 39 byte 1 0 40 byte 1 First Wheel Red Component (10-160) 41 byte 1 First Wheel Green Component (10-160) 42 byte 1 First Wheel Blue Component (10-160) 43 byte 1 0 44 byte 1 First Wheel Red Component (10-160) 45 byte 1 First Wheel Green Component (10-160) 46 byte 1 First Wheel Blue Component (10-160) 47 byte 1 0 48 byte 1 Unused Red Component (10-160) 49 byte 1 Unused Green Component (10-160) 50 byte 1 Unused Blue Component (10-160) 51 byte 1 0 52 byte 1 Unused Red Component (10-160) 53 byte 1 Unused Green Component (10-160) 54 byte 1 Unused Blue Component (10-160) 55 byte 1 0
Typically we assume colours are in the RGBA format, but as A (thats Alpha) is currently unused, it is always 0.
LYT
These are Layout files, and govern how things are set out on an AutoX track. You will notice that on some tracks you find a limit to the number of objects you can add; this is a limitation in the LFS engine. It is believed (although untested) that this has not significantly changed since S1 ([4]).
TYPES : ======= 1) short : 16 bit signed integer 2) word : 16 bit unsigned integer 3) char : 8 bit signed integer 4) byte : 8 bit unsigned integer FILE DESCRIPTION : ================== num unit offset description --- ---- ------ ----------- HEADER BLOCK : 6 char 0 LFSLYT : do not read file if no match 1 byte 6 version : do not read file if > 0 1 byte 7 revision : do not read file if > 247 1 word 8 num added objects : number of OBJECT BLOCKS 1 byte 10 laps : number 1 byte 11 spare byte : zero ......OBJECT BLOCKS OBJECT BLOCK : 1 short 0 X : position (1 metre = 16) 1 short 2 Y : position (1 metre = 16) 1 char 4 Zchar : approximate height (1 metre = 4) - see NOTE4 below 1 byte 5 Flags : 0 for objects - see NOTE1 below 1 byte 6 Index : object (see existing LYT files, NOTE3 below) 1 byte 7 HeadingByte : see NOTE2 below NOTE1 : ------- Flags byte is always zero for actual objects. For start positions or checkpoints, it is always non-zero. The bits (0 to 7) are arranged like this (bit 0 is the lowest bit) : bits 0 to 1 : 0 = Start position / 1 to 3 = Checkpoint index bits 2 to 5 : Checkpoint width in metres (shifted left by 2 bits) bit 6 : never set bit 7 : always set (0x80) NOTE2 : ------- HeadingByte represents 360 degrees in 256 values. HeadingByte = (heading + 180) * 256 / 360 128 : heading of zero 192 : heading of 90 degrees 0 : heading of 180 degrees 64 : heading of -90 degrees NOTE3 : ------- Objects indexes allowed by tracks. * Autocross track : TYRES (white) : 0 TYRES (red) : 1 post1 : 2 TYRES2 (white) : 3 TYRES2 (red) : 4 TYRES (white) : 19 bale1 : 23 AD_banner1 : 24 Banner_AD2 : 25 Banner_AD3 : 27 CONE red : 29 CONE red3 : 30 CONE blue : 31 Cone yellow : 32 Cone_pointer : 33 CONE red2 : 34 CONE green : 39 Barrier white : 46 Barrier red : 47 Barrier long : 48 Sign keep left : 49 Sign keep right : 58 arrow left : 52 arrow right3 : 56 arrow left3 : 57 chalk line : 59 * Blackwood track : cone1 : 0 cone2 : 1 bale : 3 tyre_white_s2 : 5 tyre_blue : 6 railing : 8 tyre_BLUE_L : 14 tyre_GREEN_R : 15 tyre_white_NEW1 : 26 tyre_BLUE_NEW : 27 tyre_white_NEW2 : 31 tyre_BLUE_NEW2 : 32 ADBANNER_RSC : 35 ADBANNER_cromo : 36 * South City track : Railing : 4 cone1 : 17 cone2 : 18 tyre1_WHITE : 21 tyre2_REF : 22 * Fern Bay track : cone1 : 0 old_tyre1 : 2 old_tyre2 : 3 old_tyre3 : 4 tyresstack1 : 10 tyresstack2 : 11 tyresstack3 : 12 NOTE4 : (from Scawen) --------------------- ZChar is the approximate altitude, but LFS will do a collision test to position it accurately on the ground. It can be anything from 4 metres underground to 6 metres above the ground and it will still work ok. Why it's needed is so you can position objects under a bridge or on top of a bridge. Because first it tests for the ground position along a line from 2 metres above the approximate height, down to 4 metres below the approximate height. If that fails then it tries a second test from 6 metres above the approximate height, down to 4 metres below the approximate height.
DRV
These files contain the data on the AI drivers. This format was "discovered" around 0.3G, and it is unknown if they have been changed recently ([5]).
TYPES : ======= char : 1-byte ascii character byte : 1-byte integer word : 2-byte integer int : 4-byte integer, lowest byte first FILE DESCRIPTION : ================== num unit offset description --- ---- ------ ----------- 6 char 0 SRAINM : do not read file if no match 1 byte 6 unknown : 0x00 ? 1 byte 7 unknown : 0xF6 Version? 1 byte 8 num AIs : Number of AI Names in that file? 3 byte 9 unknown : 3 bytes unknown AI Data: Repeat (num AIs) times. 24 char 0 Name : AI's playername (Fill with 0x00) 8 char 24 Plate : Numberplate label (Fill with 0x00) 1 byte 32 Gender : 0x00 == Male, 0x01 == Female 3 byte 33 unknown : 3 bytes unknown
BANS
The file format of the bans file ([6]).
Notes : The 64 bit "Time" values are obtained from GetSystemTimeAsFileTime. Meaning : number of 100-nanosecond intervals since January 1, 1601. One hour (HOUR_TIME) = 36000000000 Demo ban expiry : time - ban->Time > 12 * HOUR_TIME Name ban expiry : time - ban->Time > ban->BanHours * HOUR_TIME The bans are loaded into memory when : - the program starts up. The bans are saved to disk when : - bans are cleared - a new ban is added - the program exits file format ----------- 6 chars LFSBAN 1 byte 0 1 byte version (246 - do not read file if increased) 1 integer num_demo_bans [demo ban * num_demo_bans] 1 integer num_name_bans [name ban * num_name_bans] demo_ban -------- in_addr IP address __int64 Time name_ban -------- 24 chars user name __int64 Time integer BanHours