-
Notifications
You must be signed in to change notification settings - Fork 1
BSprite Format
THIS DOCUMENT IS CURRENTLY UNFINISHED & MESSY
Last updated 2025-5-18
Gameloft generally used the BSprite format for their games, and were created with AuroraGT, which is the source of most of this documentation. This document goes over BSprite v3 in particular.
BSprites contain both bitmap sprite data and animation data. Bitmap data can be represented as either indexed or direct pixel data of varying bit depth and can optionally be compressed with RLE.
These are the formats colors can be represented with.
Format | Size | Identifier |
---|---|---|
RGBA8888 | 4 bytes/color | 0x8888 |
RGB888 | 3 bytes/color | N/A |
RGB4444 | 2 bytes/color | 0x4444 |
RGB444 | 2 bytes/color | N/A |
ARGB1555 | 2 bytes/color | 0x5515 |
RGB565 | 2 bytes/color | 0x6505 |
RGB332 | 1 byte/color | N/A |
These are all the possible representations of bitmap data. Please note that many of these may be unsupported by certain games as implementations of this format may be cut down for the game's needs.
Format | Depth | Identifier |
---|---|---|
1-bit indexed | 1 bit per pixel | 0x200 |
2-bit indexed | 2bpp | 0x400 |
3-bit indexed | 3bpp | N/A |
4-bit indexed | 4bpp | 0x1600 |
5-bit indexed | 5bpp | N/A |
6-bit indexed | 6bpp | N/A |
7-bit indexed | 7bpp | N/A |
8-bit indexed | 8bpp | 0x5602 |
6-bit indexed RLE | 6bpp, RLE-compressed | N/A |
7-bit indexed RLE | 7bpp, RLE-compressed | 0x27F1 |
8-bit indexed RLE | 8bpp, RLE-compressed | 0x56F2 |
6-bit alpha + 8-bit indexed RLE | 8bpp, RLE-compressed | N/A |
7-bit alpha + 8-bit indexed RLE | 8bpp, RLE-compressed | N/A |
8-bit alpha + 8-bit indexed RLE | 8bpp, RLE-compressed | N/A |
5-bit alpha + 3-bit indexed | 8bpp | N/A |
3-bit alpha + 5-bit indexed | 8bpp | N/A |
8-bit alpha + 6-bit indexed | 16bpp? | N/A |
8-bit alpha + 7-bit indexed | 16bpp? | N/A |
8-bit alpha + 8-bit indexed | 16bpp? | N/A |
Raw | 8bpp? | N/A |
GIF Data | N/A | N/A |
Field | Size | Type | Description |
---|---|---|---|
Version | 2 bytes | int16 | File version, 0x3DF is for v3 |
Flags | 4 bytes | int8 array | |
Module Count | 2 bytes | int16 | |
Module Dimensions | 2 * {Module Count} bytes | struct array | Format |
Frame Module Count | 2 bytes | int16 | |
Frame Modules | 4 * {Frame Modules} | struct array | Format |
Frame Count | 2 bytes | int16 | |
Frames | 4 * {Frame Count} bytes | struct array | Format |
Frame Rects | 4 * {Frame Count} | struct array | Format |
Animation Frame Count | 2 bytes | int16 | |
Animation Frames | 5 * {Animation Frame Count} bytes | struct array | Format |
Animation Count | 2 bytes | int16 | |
Animations | 4 * {Animation Count} bytes | struct array | Format |
Palette Format | 2 bytes | int16 | Color format code of the palette (see above) |
Palette Count | 1 byte | int8 | Number of palettes, up to 16 |
Palette Size | 1 byte | int8 | Size of each palette |
Palette Data | (1 to 4) * 16 * {Palette Size} bytes | array | A 2D array of each palette. The size of each color depends on the color format |
Bit Depth | 2 bytes | int16 | The bitmap format of the sprite (see above) |
Bitmap Data | variable | Minimal Pack | Bitmap data, stored as a minimal pack (see here) |
Field | Size | Type |
---|---|---|
Width | 1 byte | uint8 |
Height | 1 byte | uint8 |
Field | Size | Type |
---|---|---|
Module Index | 1 byte | uint8 |
X Position | 1 byte | int8 |
Y Position | 1 byte | int8 |
Transformation Flags | 1 byte | uint8 |
Bit 0: Vertical Mirror
Bit 1: Horizontal Mirror
Field | Size | Type |
---|---|---|
Number of Frame Modules | 2 bytes | int16 |
First Frame Module Index | 2 bytes | int16 |
Field | Size | Type |
---|---|---|
X Position | 1 byte | uint8 |
Y Position | 1 byte | uint8 |
Width | 1 byte | uint8 |
Height | 1 byte | uint8 |
Field | Size | Type |
---|---|---|
Frame Index | 1 byte | uint8 |
Display Time | 1 byte | uint8 |
X Offset | 1 byte | int8 |
Y Offset | 1 byte | int8 |
Flags | 1 byte | uint8 |
Field | Size | Type |
---|---|---|
Animation Frame Count | 2 bytes | int16 |
First Animation Frame Index | 2 bytes | int16 |
Bitmaps are palette-indexed, and can be 1-bit, 2-bit, 4-bit, or 8-bit in depth. They can be either raw or compressed via RLE, with RLE compression being exclusive to the 8-bit format.
RLE consists of sets of repeat tags occasionally interrupted by "stop" tags that are followed by a specified length of uncompressed bytes. The only distinction between the two is that "stop" tags have their 7th bit set, so a certain value can only repeat with one tag 127 times and only 127 uncompressed bytes can repeat after a tag. The count values for both is equal to the tag value itself, minus the 7th bit.
Compressed: 04 1C 82 23 22
Uncompressed: 1C 1C 1C 1C 23 22
This is essentially a more limited, inverted version of the previous format. All bytes are assumed to be uncompressed, and are interrupted by occasional RLE tags that have their 7th bit set. This does not allow values over 128 for bitmap data, since they are treated as RLE tags, so this format effectively makes bitmaps 7-bit.
Compressed: 14 5A 28 85 34 06
Compressed: 14 5A 28 34 34 34 34 34 06