BCO (File Format)

From Custom Mario Kart
Jump to: navigation, 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 Unknown.
0x1C Int16 Unknown.
0x1E Int16 Unknown.
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 2

This is the last section in the file 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 second unknown section in a BCO.
Offset Type Description
0x00 Int8 An ID of some kind. Seems to be a link.
0x01 Int8 Another ID of some kind. Increments by 1 until the byte before is changed.
0x02 Int16 Unknown.
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.

List of collision flags.
ID Description
0x0000 Sand
0x0001 Offroad mud
0x0100 Road
0x0101 Bridge / Wood
0x0102 Cage Road
0x0103 Dirt Road
0x0104 Carpet
0x0300 Grass
0x0400 Slippery Ice
0x0504 Out of bounds 1
0x0505 Out of bounds 2
0x0800 Speed Boost
0x0C00 Sand (Offroad)
0x0F00 Icy Water (stops the player from falling into infinity when driving into the water)
0x0F01 Lava (might just be like water?)
0x1000 Quicksand Sinkhole
0x1200 Wall
0x1200 Wall (Cage related)
0x1300 Sand out of bounds

Tools

The following tools can handle BCO files: