FRM File Format

Introduction
This article delves into the raw data format of the FRM graphics file. The same format was used for both Fallout and Fallout 2, giving all FRM files complete compatibility with both game engines.

General Information
The FRM format is used to store all of the game's images for map objects, critter animations, talking heads and their respective backgrounds, as well as all of the components which comprise the Pip-Boy interface. Splash screens are the only images which are stored in a separate format. Each FRM file contains one or more frame(s) of image data.

Pallete
FRM files are unpaletted 256-color image files containing either one or several image frames. The palettes used for FRM files come in the form of external palette files. The engine defaults to  if not specified, but FRM files may have their own distinct palette files. These specific palette files have the same name as the FRM file, but with the extension .pal. For example, the palette file of  is.

An index colour model is used to store raw pixel data, meaning each pixel is represented by an offset into a palette of colours. For the default palette (color.pal) which has 256 color indices, the colour index of 0 represents transparency.

Endianness
All values within the FRM file are stored in Big-Endian (Motorola) format as opposed to Little-Endian (Intel) format. For those who don't know what the difference is, Big-Endian stores the most-significant byte (largest digit places) closest to the number's starting address, whereas Little-Endian stores the least-significant byte (smallest digit places) closest to the starting address.



File Suffixes
A FRM file may contain image data for one or all of the 6 orientations used in Fallout. If a FRM file has the extension .fr[0-5] instead of the usual .frm, then that file contains image data for the orientation given by the last digit in the extension. 0 represents the northeast direction and each subsequent suffix rotates in the clockwise direction (5 representing the northwest direction). Otherwise, the FRM file contains image data for either orientation 0, or all 6 orientations.

Frame Positioning
The FRM file contains info to correctly align (or center) the image data. For example: Image data should be aligned so that each critter's feet should be on the same level.

Each frame contained within the FRM file has an offset from the previous frame which must be applied before rendering. This offset ensures that each frame is correctly aligned during an animation sequence.

The center of the image data is the center of the bottom edge of the frame. To find the position of the top left corner of the frame (needed for rendering):

left = center_x - (frame_width / 2) top = center_y - frame_height