Difference between revisions of "File Formats"
m (→LYT: Reformatted NOTE4 (lines were too long)) |
(→SET) |
||
Line 29: | Line 29: | ||
== SET == | == SET == | ||
− | Thanks to [[user:colcob|colcob]] for originally working this format out for v0.3H ([http://forum.rscnet.org/showthread.php?t=213190]), [[user:Bob Smith|Bob Smith]] for updating it for v0.5P([http://www.lfsforum.net/showthread.php?t=14477]), [[user:Woz|Woz]] for updating the bit field values for passengers, and back to [[user:Bob Smith|Bob Smith]] for updating it for v0.5X. | + | Thanks to [[user:colcob|colcob]] for originally working this format out for v0.3H ([http://forum.rscnet.org/showthread.php?t=213190]), [[user:Bob Smith|Bob Smith]] for updating it for v0.5P([http://www.lfsforum.net/showthread.php?t=14477]), [[user:Woz|Woz]] for updating the bit field values for passengers, and back to [[user:Bob Smith|Bob Smith]] for updating it for v0.5X/Y. |
<pre> | <pre> | ||
TYPES : | TYPES : | ||
Line 45: | Line 45: | ||
0 char 6 Description (always SRSETT) | 0 char 6 Description (always SRSETT) | ||
6 byte 1 0 | 6 byte 1 0 | ||
− | 7 byte 1 Version | + | 7 byte 1 LFS Internal Version (was 250 for ages, now 251) [ignore this number] |
− | 8 byte 1 | + | 8 byte 1 File format version (currently 2) [check this number] |
9 byte 3 0 | 9 byte 3 0 | ||
12 byte 1 Bit 0 (Asymmetrical On=1, Off=0) | 12 byte 1 Bit 0 (Asymmetrical On=1, Off=0) |
Revision as of 20:09, 9 January 2008
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 colcob for originally working this format out for v0.3H ([1]), Bob Smith for updating it for v0.5P([2]), Woz for updating the bit field values for passengers, and back to Bob Smith for updating it for v0.5X/Y.
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 LFS Internal Version (was 250 for ages, now 251) [ignore this number] 8 byte 1 File format version (currently 2) [check this number] 9 byte 3 0 12 byte 1 Bit 0 (Asymmetrical On=1, Off=0) Bit 1 (Traction Control On=1, Off=0) Bit 7 (Patch X Setup=1, older set=0) - for pre-load handling 13 byte 1 Unknown, seems to hold random values 14 byte 1 Handicap Mass Position 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 1 Voluntary Handicap Mass 23 byte 1 Voluntary Intake Restriction 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 Passenger (4 2bit fields). Passengers are located in the byte at the following locations 76|54|32|10 --+--+--+-- RR|RC|RL|FR The individual passenger types are identified as follows. 00 = None 01 = Male 10 = Female 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 Ride Height (NOT spring 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 1 0 83 byte 1 Rear Diff Clutch Pack Pre-load (multiply by ten) 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 Ride Height (NOT spring 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 1 0 123 byte 1 Front Diff Clutch Pack Pre-load (multiply by ten) 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)
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 ([3]).
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.
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