Modding: Understanding Game Files

From Truck Simulator Wiki
Jump to navigation Jump to search


There are many different types of files, from textures, models, definition files (defs) to sound files. Placement of some files matters greatly, as the game expects them there, while others can be scattered almost anywhere.

Def files

All def files are text files and can be opened with a text editor of your preference. There are two types of def files, you can distinguish between them by looking at the extension:

  • .sii (mandatory)
  • .sui (optional)

.sii

These are the main files, as they feature a special header SiiNunit and their content is wrapped in curly brackets. They need to be placed in /def folder or in any valid subfolder, otherwise they fail to load.

SiiNunit {
@include “/def/world/contents_to_include.sui”
}

.sui

These files on the other hand contain no special headers, as they are used to link contents to various .sii files via the @include tag. This way, content that is shared between many .sii files can be stored in a single .sui file and any needed changes to that shared content are made only once. These files can be stored pretty much anywhere you want, provided you link them correctly in your .sii file(s).

/*
this is a block comment
*/
//this is a single line comment
#this is also a single line comment

The game then sees the .sii file like this:

SiiNunit {
/*
this is a block comment
*/
//this is a single line comment
#this is also a single line comment
}

Both files use C++ syntax for comments. You can @include either using the relative or absolute paths. Above, I used an absolute path. You can use relative path when the files are in the same directory, it would look like this - @include: “contents_to_include.sui”. Please note @include cannot be indented, it has to be at the start of the new line with no whitespaces or other characters in front of it. Furthermore, both files need to end with an empty line, otherwise, they crash the game on load (or just fail to load without crashing).

.tobj files

There are two .tobj types:

  • binary used by the game
  • readable, created by Blender Tools or manually when you need to use specific flags

.tobj files are usually placed next to the exported models or in your texture folder, depending on your setup and your workflow conventions. Readable .tobj files need to be converted by SCS Conversion Tools so the game can use them.

Here are some flags used by normal 2D textures:

  • map 2d texture.tga
    • linked texture itself
  • addr clamp_to_edge clamp_to_edge
    • no UV repeat, can be mixed with below
  • addr repeat repeat
    • UV repeat, can be mixed with above
  • nomips
    • no mipmaps
  • nocompress
    • no dxt compression
  • usage tsnormal
    • tangent space normal for normal maps
  • bias 2
    • ? used on dashboard and truck paint
  • color_space linear
    • ? image needs to be in gamma=1 colour space for this flag
  • quality high
    • ? used on font files and cube reflections
  • usage ui
    • nomips + nocompress + color_space linear