BCO (File Format)

From Custom Mario Kart
(Redirected from BCO)
Jump to navigation Jump to search

A BCO contains the track's collision data in Mario Kart: Double Dash!!. It is split into 4 parts, where only 2 are known, and are listed below.

File Header

File header of a BCO file
Offset Type Description
0x00 String File magic. Always will be 0003 in ASCII.
0x04 UInt16 Grid width.
0x06 UInt16 Length of grid.
0x08 Int32 X Start of grid.
0x0C Int32 Z Start of grid.
0x10 Int32 Grid cell X size.
0x14 Int32 Grid cell Z size.
0x18 Int16 The number of entries in the last section.
0x1A Int16 Possible padding. Always 0x0000.
0x1C UInt32 Triangle indices offset.
0x20 UInt32 Triangle list offset.
0x24 UInt32 Vertex list offset.
0x28 UInt32 Unknown section offset.
0x2C End of file header

Triangles

Triangles are parts of the collision format that are formed from 3 vertices. Triangles also have the collision type for the defined triangle. The structure is a 0x24 byte structure defined below.

Structure of a triangle in BCO.
Offset Type Description
0x00 Int32 The index of the first point of the triangle, from the vertex list.
0x04 Int32 The index of the second point of the triangle, from the vertex list.
0x08 Int32 The index of the third point of the triangle, from the vertex list.
0x0C Float Unknown.
0x10 Int16 X Direction of normal vector.
0x12 Int16 Y Direction of normal vector.
0x14 Int16 Z Direction of normal vector.
0x16 UInt16 Collision Flags
0x18 Byte Table for getting Min/Max X/Z values.
0x19 Byte Unknown.
0x1A Int16 Neighboring Triangle 1
0x1C Int16 Neighboring Triangle 2
0x1E Int16 Neighboring Triangle 3
0x20 UInt32 Padding.
0x24 End of section.

Vertices

Vertices are sets of 3 floats that form a triangle. Each vertex structure is defined in a 0x0C byte structure below.

Structure of a vertex in BCO.
Offset Type Description
0x00 Float X position of the vertex.
0x04 Float Y position of the vertex.
0x08 Float Z position of the vertex.
0x0C End of section.

Unknown Section

This is a section with an unknown purpose. The number of entries is defined in byte 0x18 in the header. The 0xC byte structure is defined below.

Structure of the unknown section in a BCO.
Offset Type Description
0x00 UInt16 Collision flag
0x02 Int16 Sound ID
0x04 UInt32 Unknown.
0x08 UInt32 Unknown.
0x0C End of section.


Collision Flags

Each triangle face has as collision flag that defines how the face acts when the player interacts with it. This can define whether it's sand, mud, ice, and more. Each flag is two bytes, but only the first one determines its basic property

List of collision flags.
ID Description
0x00 Sand / Offroad mud
0x01 Road
0x02 Item and Player Wall
0x03 Medium Offroad (typically grass)
0x04 Slippery Ice
0x05 Out of bounds
0x07 Speed Boost
0x08 Speed Boost
0x09 Cannon Boost
0x0A Out of bounds
0x0C Sand (Weak Offroad)
0x0D Pipe teleportation
0x0E Out of bounds
0x0F Out of bounds
0x10 Quicksand Sinkhole
0x11 Road (Peach Beach sand)
0x12 Player-Only Wall
0x13 Sand out of bounds
0x37 Speed Boost
0x47 Speed Boost

The second byte gives additional properties to a flag, like particle / sound effects on the driveable flags or a connected respawn point in the BOL for the out of bounds flags.

Tools

The following tools can handle BCO files: