COL (File Format)
COL is a collision format used in Mario Kart Arcade GP DX and the successor of Mario Kart Arcade GP and Mario Kart Arcade GP 2's MKAGP BIN.
File Format
The file byte order is always little endian.
Header
The file starts with the following header:
| Offset | Type | Description |
|---|---|---|
| 0x00 | Char[4] | File magic. Always COL\0 in ASCII. |
| 0x04 | Byte[4] | Timestamp? Always 16 08 12 20 (2012-08-16?). The game specifically checks if this value is correct, otherwise it won't read the file. |
| 0x08 | Int32 | Grid width (W). |
| 0x0C | Int32 | Grid length (L). |
| 0x10 | Float | Grid cell X size. |
| 0x14 | Float | Grid cell Y size. |
| 0x18 | Float[2] | AABB minimum coordinate XZ. |
| 0x20 | Float[2] | AABB maximum coordinate XZ. |
| 0x28 | Float[2] | Negative AABB minimum coordinate XZ. Unknown usage. |
Grid
Followed by the header, the grid data is read from the start of the AABB minimum coordinate, from left to right. A total of W * L cells are loaded.
Cell
| Offset | Type | Description |
|---|---|---|
| 0x00 | Int32 | Number of Triangles (T). |
| 0x04 | Int32 | Number of Walls (C). |
Triangle
Followed by the cell header, there are T 0x70 triangles.
| Offset | Type | Description |
|---|---|---|
| 0x00 | Float[2] | Minimal coordinate for this triangle. |
| 0x08 | Float[2] | Maximal coordinate for this triangle. |
| 0x10 | Float[3][3] | Triangle vertices XYZ position. |
| 0x34 | Float[3][3] | Triangle edges XYZ directions. |
| 0x58 | UInt32 | Neighbour triangle flag, used to determine which edges connect to other triangles. |
| 0x5C | UInt32 | COL flag. |
| 0x60 | Float[3] | Triangle normal. |
| 0x6C | Float | Negative dot product between triangle center and triangle normal. |
Wall
Followed by the cell's triangles, there are C 0x40 walls, which are used for wall collision detection. The walls are auto-generated from all triangles by checking which edges are missing neighbour triangles.
| Offset | Type | Description |
|---|---|---|
| 0x00 | Float[3] | Min XYZ of the triangle edge. |
| 0x0C | Float | Unknown. Always 0. |
| 0x10 | Float[3] | Max XYZ of the triangle edge. |
| 0x1C | Float | Unknown. Always 0. |
| 0x20 | Float[3] | Position 1 XYZ of the triangle edge forming the wall. |
| 0x2C | Float | Unknown. Always 0. |
| 0x20 | Float[3] | Position 2 XYZ of the triangle edge forming the wall. |
| 0x3C | Float | Unknown. Always 0. |
Triangle Wall Grid
Followed by the grid, there's a secondary grid with cells containing triangle walls. As of version 1.18 of Mario Kart Arcade GP DX, it only seems to be used in FM_L_N_HIT.col and FM_L_N_HIT_cam.col.
Triangle Wall Cell
| Offset | Type | Description |
|---|---|---|
| 0x00 | Int32 | Number of triangle walls (U). |
Triangle Wall
Followed by the cell header, there are U 0x38 triangle walls. These are walls represented as triangles. Presumably this was added since edge walls which are auto-generated couldn't represent certain walls.
| Offset | Type | Description |
|---|---|---|
| 0x00 | Int32 | Unknown. Possible collision flag indicating surface type. |
| 0x04 | Float[3][3] | Triangle vertices XYZ position. |
| 0x28 | Float[4] | Unknown. Always 0. |
Tools
The following tools can handle COL files:
- (none)