Monster Bash Tileset Format

From ModdingWiki
Jump to: navigation, search
Monster Bash Tileset Format
Monster Bash Tileset Format.png
Format typeTileset
Max tile countUnlimited
PaletteDefault EGA
Tile names?No
Minimum tile size (pixels)16×16
Maximum tile size (pixels)16×16
Plane count4-5
Plane arrangementGraphic-planar EGA
Transparent pixels?Yes
Hitmap pixels?No
Supports sub-tilesets?No
Compressed tiles?No
Hidden data?No

The Monster Bash Tileset Format is used by Monster Bash to store the graphics used to draw game levels.

Background tiles

The background tiles are stored in files of type #3 (.tbg) in the main DAT file.

This file contains a number of background tiles. These are 16x16 images, stored one after the other. Each image contains four EGA planes, in the order of intensity, red, green and then blue. (So the bytes for the first tile's intensity plane are at the start of the file, followed by the first tile's red data, then green, blue, then the second tile's intensity data.)

Since each tile is 16x16, each plane will contain two bytes per scanline (two bytes == 16 bits == 16 pixels) by 16 lines, or 32 bytes per plane. Since there are four planes (intensity, red, green and blue) each tile is 128 bytes long (which is handy to quickly find the offset of a given tile: offset = index * 128)

There are typically 512 tiles in the background tileset.

Foreground tiles

The foreground tiles are stored in files of type #4 (.tfg) in the main DAT file.

This format is the same as the background tiles above, only there are five planes (transparency is the first plane) and there are typically 128 tiles instead.

Bonus tiles

The bonus tiles are stored in files of type #5 (.tbn) in the main DAT file.

They are identical to the foreground tiles.

Tile properties

The background tile properties are stored in files of type #12 (.pbg) in the main DAT file. Foreground tile properties are in file type #13 (.pfg).

These files contain one byte for each tile in the corresponding tileset (type #3/.tbg for background tiles, type #4/.tfg for foreground tiles), plus an occasional padding byte at the end (possibly due to a decompression artefact.) If there are 512 tiles in the tileset, then this file will be 512 or 513 bytes long.

The following values are known:

Bit Value Purpose
1 00000001 (0x01) 1 = shootable (e.g. treasure chests, cracked spear heads)
2 00000010 (0x02) 0 = 45 degree slope, 1 = 30 degree slope (fg) or bouncing couch (bg)
3 00000100 (0x04) 1 = slope mid section (normally combined with 0x02)
4 00001000 (0x08) 1 = slope high section (normally combined with 0x02)
5 00010000 (0x10) 0 = uphill slope "/", 1 = downhill slope "\"
6 00100000 (0x20) 1 = tile is a tree or made of wood? ! What does this do?
7 01000000 (0x40) ! Unused?
7 10000000 (0x80) ! Unused?

For 45 degree slopes, the uphill section will be the default value of 0x00, just like normal tiles. This doesn't cause every tile to become a slope however, because the background map layer must have the slope flag set before these values will be used.

For the 30 degree slopes, three horizontal tiles are required to raise the ground by one vertical tile. For these three tiles, bit 2 should always be set, with bits 3 then 4 set for the elevation. So the first tile will be 0x02, the second 0x06 and the third 0x0A. Likewise for a downhill 30 degree slope: 0x1A, then 0x16, then 0x12.

The two slope elevation flags (0x04 and 0x08) can be set at the same time (0x0C) however the purpose of this value is unknown. It seems to occur on sloped ceiling tiles.

In order for any of the slope values to take effect, the "slope" flag must be set for that tile in the background map layer.