BAM file format

Applies to:
BG1EE, BG2EE

General Description
This file format describes animated graphics. Such files are used for animations (both creature animations, item and spell animations) and interactive GUI elements (e.g. buttons) and for logical collections of images (e.g. fonts). BAM files can contain multiple sequences of animations, up to a limit of 255.

NB. While the BAM format allows the dimensions of a frame to be very large, the engine will only show frames up to a certain size. This maximum size varies with the version of the engine:
BG1: Unknown
BG2: 256*256
PST: Unknown (greater than 256*256)
IWD1: Unknown
IWD2: Unknown

Detailed Description

Offset Size (data type) Description
0x0000 4 (char array) Signature ('BAM ')
0x0004 4 (char array) Version ('V2  ')
0x0008 4 (dword) Count of frame entries
0x000c 4 (dword) Count of cycle entries
0x0010 4 (dword) Count of data blocks
0x0014 4 (dword) Offset (from start of file) to frame entries
0x0018 4 (dword) Offset (from start of file) to cycle entries
0x001c 4 (dword) Offset (from start of file) to data blocks


Cycles may share the frames, which is accomplished by using a layer of indirection. Instead of specifying which frames belong to a given cycle, each cycle has a list of frame indices.

Offset Size (data type) Description
0x0000 2 (word) Frame width
0x0002 2 (word) Frame height
0x0004 2 (signed word) Frame center X coordinate
0x0006 2 (signed word) Frame center Y coordinate
0x0008 2 (word) Start index of data blocks
0x000a 2 (word) Count of data blocks


These entries refer to a range of indices in the frame entries table.

Offset Size (data type) Description
0x0000 2 (word) Count of frame entries in this cycle
0x0002 2 (word) Start index of frame entries in this cycle


Offset Size (data type) Description
0x0000 4 (dword) PVRZ page
Refers to MOSxxxx.PVRZ files, where xxxx is a zero-padded four-digits decimal number.
0x0004 4 (dword) Source x coordinate
0x0008 4 (dword) Source y coordinate
0x000c 4 (dword) Width
0x0010 4 (dword) Height
0x0014 4 (dword) Target x coordinate
0x0018 4 (dword) Target y coordinate