Block file (.BLK)

From War Thunder Wiki
Revision as of 01:54, 27 April 2019 by KornFlaks (talk | contribs) (Adding a little tidbit about blk and bin files.)

Jump to: navigation, search

A block file (*.blk) is a file holding relatively small pieces of data for the game in text form and is used in various places where mostly power users and modders are encouraged to make changes or add content to the game. WarThunder itself also stores settings in the config.blk file in the game’s root directory.

While most data is stored in binary formats, which are faster to read by computer programs and usually smaller than text formats, the latter has the benefits of being human readable and editable with a basic text editing program instead of complex editing software. Every text file format such as HTML needs to provide enough structure for a computer program to recognize and itemize the contained data while giving the human editor a degree freedom to e.g. add comments or insert blank lines for better organization.

BLK Files are also compressed within War Thunder's .vromf.bin files, most notably the aces.vromf.bin file where most datamined information are found.

Structure

The below excerpt from a config.blk illustrates the basic structure of a block file. There are assignments of values ("medium") to named items (cloudsQuality) of a specific data type indicated by a short code (t) and named groups such as "graphics" which provide some structure by wrapping other assignments and groups inside curly braces.

 cloudsQuality:t="medium"
 use_gamepad_cursor_control:b=no
 use_gamepad_interface:b=no
 hdClient:b=no
 clientType:t="32bit"
 
 graphics{
   enableSuspensionAnimation:b=no
   rendinstDistMul:r=0.5
   grassRadiusMul:r=0.1
   shadowQuality:t="ultralow"
   tireTracksQuality:i=0
   skyQuality:i=2
   cloudsQuality:i=2
 }

Assignments

The names of data items and groups are implied by the game. There are usually either example files highlighting the available options or pages in this Wiki about them. Their exact spelling and casing is important or the game will silently ignore the provided values and resort to defaults. Speaking of which, the default values are usually sensible and if they suit you, allow you to omit some lines from your block file to keep it slim. Some block files expect you to mention a name multiple times to create an array of values, like the line drawing block in user-made sighting reticles:

 drawLines{
   line{ line:p4=0.35, -1, 0.35, 0; move:b=no; }
   line{ line:p4=115, +10000, 117, 0; move:b=no; thousandth:b=yes; }
 }

The name is followed by a colon ":" and a short code for the expected data type.

Designator Example Explanation
t example:t="Hello world!"; Text: Accepts any string of characters encapsulated by quotation marks.
b example:b=true; Boolean: A binary state value, accepts either yes / no or true / false.
i example:i=50; Integer: An integral number, accepts only true positive or negative values (5, -2, 0, etc.).
r example:r=12.7; Real: A real number, accepts any integral values in addition to fractions (5, -2, 0, 7.62, -3.33333, etc.).
p2 example:p2=0.5,20; Point, 2-dimensional: A point defined on a 2-dimensional space. Accepts comma separated list of two real numbers.
p3 example:p3=0.5,20,-10; Point, 3-dimensional: A point defined on a 3-dimensional space. Accepts comma separated list of three real numbers.
p4 example:p4=0.5,20,-10,9; Point, 4-dimensional: A point defined on a 4-dimensional space. Accepts comma separated list of four real numbers.
c example:c=51,204,51,100; Color: An RGBA (red green blue alpha) color value represented by four comma separated integers from 0 to 255 for the three color channels and opacity values respectively.

Assignments may be terminated by a semicolon (;) and they have to be if the line does not end after the assignment. Two examples:

 x:r=3; y:r=5
 person { name:t="John Doe"; age:r=50; }

While you can put several assignments on one line you may not break up a single assignment into multiple lines. Line breaks are allowed around curly braces and assignments. Additional white-space is allowed between all elements, but not between parts of a number (i.e. + 5).

Comments

Block files allow two types of comments, line end comments and block comments known from many programming and scripting languages. A line comment is placed at the end of a line of text and starts with two slashes (//). A block comment can span multiple lines or be interspersed into a line and is enclosed in a slash and asterisk combination like so: /* comment */. The game will for the most part interpret a block file as if the comments were cut out. Some valid comments:

 drawTexts{
   text { text:t="X"; pos:p2=0./*works*/35,0 /* position in screen units */; align:i=0; } // draws an X
 }

The game is not be able to digest coordinate lists on multiple lines though. Neither with nor without comments:

 pos:p3=3, /* x
 */     4, /* y
 */     5; /* z */

Game aspects dealing with block files