Alien Trilogy BND
Contents: GRAFs page - All - 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - Edit
BND
- Format Type : File container
- Extensions: bnd and b16 for 16-bit sprites
- Platforms: PC/PS1/Sega Saturn
- Endian Order : Little Endian/Big Endian
Format Description
A container file that can store sprites, textures, models, palette, texture mesh for models. Each file is divided into "sections" that have "names". The problem with this format is that one and the same file is used for different types of data, and different types of data are specified just by "sections" within the file itself. There are the following "section names":
- F000(#1,2,3....) F? - Frame, this section is used for sprites. Most sprites have compression, do not have information about frame sizes (hardcoded into the game engine in animation structures)
- T000(#1,2,3....) T? - Texture, in this section there are standard "descriptions" of images - size, color, no compression, resources can be ripped out with tools such as XWE, TiledGGD.
- M000(#1,2,3....) M? - Model, section contains models. Contains a list of vertices and quads. The peculiarity with quads is apparently due to the fact that the game was originally developed for the Sega Saturn console, which supports them in hardware better than polygon
- BX00(#1,2,3....) - Texture mesh, usually located next to the texture section and has the same numbering. Contains a "list" of quads for texturing.
- CX00(#1,2,3....) - urrently unencrypted section
- C000(#1,2,3....) - C? - Color, specific section, only available in b16 file variations. Contains a 16-bit palette.
Format Specifications
This is a generic "template" for a file. As mentioned above, the rest of the data is determined by the game by the "names / identifiers" of the sections within the file itself.
// Alien Trilogy // BND(B16) file format size comment ----------------------------------------------------------------------------- 0x04 46 4F 52 4D FORM 0x04 - file data size in bytes, BIG-ENDIAN 0x04 - number of sections in a file, text(string?) 0x04 - format \ section identifier(F000\T000\M000....) 0x0... - data, for each section have its own structure
F000(#1,2,3....) Sprite Section
This section contains sprites of enemies and weapons.
These files contain such sections:
Enemyes:
BURSTER.BND(B16) COLONIST.BND(B16)
DOG.BND(B16) DOGCEIL.BND(B16)
EGGS.BND(B16) FINGERS.BND(B16)
GUARD.BND(B16) HANDLER.BND(B16)
HUGGER.BND(B16) QUEEN.BND(B16)
SOLDIERSYNTH.BND(B16) WAR.BND(B16)
WARCEIL.BND(B16)
Wepons:
MM9.BND(B16) PULSE.BND(B16)
SHOTGUN.BND(B16)FLAME.BND(B16)
SMART.BND(B16)
Does not contain image size information. All sizing information is contained in the game engine in animation structures. Most of the sprites in the PC version of the game are compressed by the LZW algorithm, which works the other way around. Those. - the principle of "sliding window" is applied and subsequent pixels are built from the previous ones. The .B16 format uses in addition a section C000 with a 16-bit palette of 2 bytes per color.
Sprite decompression function
One section can contain several sprites, some of which may not be compressed. Take this into account when using the function.
void PicDecoder(uint8_t *p, uint8_t *u) {
int32_t i, offs, size;
i = 0;
while (1) {
while (1) {
i >>= 1;
if (!(i & 0xFF00)) {
i = 0xFF00 | *p;
p++;
}
if (i & 1) { break; }
*u = *p;
u++;
p++;
}
if (*p >= 96) {
offs = *p - 256;
size = 3;
p++;
} else {
size = (*p & 0xF0) >> 4;
offs = (*p & 0x0F) << 8;
p++;
offs |= *p;
p++;
if (!offs) { break; }
offs = -offs;
if (size == 5) {
size = *p + 9;
p++;
} else {
size = size + 4;
}
}
while (--size) {
*u = u[offs];
u++;
}
}
}
M000(#1,2,3....) Modelds Section
This section contains models. Models have vertices and quads in their composition. The nuance with quads, apparently, is due to the fact that the game was originally developed for the Sega Saturn, where quads work better in hardware than polygons. Vertex coordinates have integer values! Many models have a textured mesh
These files contain such sections:
PICKMOD.BND - pickup models
OPTOBJ.BND - menu option models
OBJ3D.BND - other models
Model Section Specifications
// Alien Trilogy // BND(B16) file format size comment ----------------------------------------------------------------------------- 0x04 46 4F 52 4D FORM 0x04 - file data size in bytes, BIG-ENDIAN 0x04 - number of sections in a file, text(string?) 0x04 - format \ section identifier(F000\T000\M000....) 0x0... - data, for each section have its own structure