TIS file format
Applies to:
BG1, BG1: TotS, BG2, BG2: ToB, PST, IWD, IWD:HoW, IWD:TotL, IWD2, BGEE
General Description
This file format describes a tileset. There are currently two variants available:
1. Palette-based TIS
TIS files are generally comprised of a large number of tiles, each of which consists of a palette and a rectangular block of pixels. Each pixel is an index into the associated palette. Each tile has its own palette and a block of pixels. The pixel data is not compressed. TIS files contain only the graphics for an area - the location information is stored in a WED file.
2. PVRZ-based TIS
This variant is only supported by Enhanced Edition games. Each tile definition refers to a block of pixels within an associated PVRZ file. As with palette-based TIS this format contains only the graphics for an area - the location information is stored in a WED file.
Engine specific notes:
1. Palette-based TIS
TIS files are generally comprised of a large number of tiles, each of which consists of a palette and a rectangular block of pixels. Each pixel is an index into the associated palette. Each tile has its own palette and a block of pixels. The pixel data is not compressed. TIS files contain only the graphics for an area - the location information is stored in a WED file.
2. PVRZ-based TIS
This variant is only supported by Enhanced Edition games. Each tile definition refers to a block of pixels within an associated PVRZ file. As with palette-based TIS this format contains only the graphics for an area - the location information is stored in a WED file.
Engine specific notes:
- PST can only load TIS files when they are stored in a BIFF file.
- Palette-based TIS induces a noticeable performance hit and occasional visual glitches when used in Enhanced Edition games. It is highly recommended to use PVRZ-based TIS instead.
Detailed Description
Palette-based: Each tile consists of a 256 colour palette, with each entry being an RGBA value stored in BGRA order (note that the Alpha value is unused), followed by 8-bit pixel values, which are indices into the palette. The pixel values are row by row, from left to right and top to bottom. Index 0 is hardcoded to be the transparent index.
PVRZ-based: Each tile consists of a block of pixels that is defined in an associated PVRZ file.
PVRZ-based: Each tile consists of a block of pixels that is defined in an associated PVRZ file.
Header
The Header has a constant length of 18h (24) bytes.
Offset | Size (datatype) | Description |
---|---|---|
0x0000 | 4 (char array) | Signature ('TIS ') |
0x0004 | 4 (char array) | Version ('V1 ') |
0x0008 | 4 (dword) | Count of tiles within this tileset |
0x000c | 4 (dword) | Length of a tile data block This value can be used to determine the correct TIS variant:
|
0x0010 | 4 (dword) | Size of the header (offset to tiles) |
0x0014 | 4 (dword) | Dimension of 1 tile in pixels (64x64) |
The tile data itself always starts at 0x18. Each tile data block is 1400h (5120) bytes long.
- One tile inside TIS files is 0x000c offset value bytes long
- All tiles are composed of 0x0014 offset value pixels
- Usually in areas that contain doors/ overlays areas there are several more tiles than it may be visible on main area
- Such a tile has size : (Width(in tiles)*Height(in tiles) + DoorsTilesClosedState + OverlayShapesTiles) *(offset 0x000c value) bytes
- The special "green" colour is used to mark overlay areas in OverlayShapesTiles
- DoorTilesClosedState and OverlayShapesTiles are also referenced from WED files but as the alternative tiles from Tilemap structure and their appearance is defined by offset 0x0006 of this structure
As with the palette-based variant the tile data itself always starts at 0x18. Each tile data block is 0ch (12) bytes long.
Offset | Size (datatype) | Description |
---|---|---|
0x0000 | 4 (dword) | PVRZ page Filenames of referenced PVRZ resources are made up from the first character of the TIS filename, the four digits of the area code, the optional 'N' from night tilesets and this page value as a zero-padded two digits number. Example: AR2600N.TIS would refer to A2600Nxx.PVRZ where xx indicates the PVRZ page. Special: A value of -1 (0xffffffff) indicates a solid black tile. |
0x0004 | 4 (dword) | PVRZ texture coordinate X |
0x0008 | 4 (dword) | PVRZ texture coordinate Y |