News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: COL format  (Read 9476 times)

0 Members and 1 Guest are viewing this topic.

Offline gtafan

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
COL format
« on: March 09, 2015, 08:36:24 AM »
I was looking through bully col file and try to understand how they worck. There are some similarities with GTA col formats but also some diferences. I am going to present some results of my researches here. I´ll use C/C++ syntax for data formats.
The file can be divided in FileHeader and Data, while Data can also be divided in DataHeader and DataBody.

struct FileHeader {
        char signature[4];
        unsigned int size;
}

-signature: specifies the version and known values are: "COLL", "COL2" and "COL3"
-size: containes the size of Data in bytes.

Here goes the DataHeader:

If version>1 unsigned short flags[2];

-flags[0]: known values are: 0x2 for "COL2" and 0x3 or 0x4 for "COL3"
-flags[1]: known values are: 0x0 for "COL2" and 0x1 for "COL3"

char name[20];
unsigned int id;

-name: every of the  20 bytes are 0x0
-id: the id of the collision model

-posibly bounding objects: 48 byte divided into 2 blocs first 16 byte posible bounding sphere and second 32 byte posible bounding box

the bounding box use the Box datatype that could look like that:

struct Box {
float min[3]
unsigned int minZero
float max[3]
unsigned int maxZero
char surface[4];
}

-min and max: could contain the position of min and max
-minZero and maxZero: always 0x0
-surface: containes the values for material, flag, brightness and light

Here goes the DataBody:

This part is stil incomplete and a lot of stuff is just aligations based on GTA col format. The  structs I was able to recognise are Sphere, Vertex and Face:

struct Sphere {
        float values[4];
        char surface[4];
}

-values: radius and (x,y,z) position of center of the sphere
-surface: containes the values for material, flag, brightness and light

struct Vertex {
short values[3];
}

-values: vertices used for the faces. short type is used to reduce used memory, the real values of a vertex can be calculated by dividing through 128.f

struct Face {
       unsigned short vertices[3];
       unsigned char material;
       unsigned char light;
}

-vertices: IDs of vertices from the Face(triangle)

The structure of DataBody look like:

unsigned int numSpheres;
Sphere spheres[];
unsigned int unk;
unsigned int numBoxes;
Box boxes[];
unsigned int numVertices;
Vertex vertices[];
if(numVertices%2) short pading;
unsigned int numFaces;
Face faces[];

-numSpheres: number of Spheres in the array
-spheres[]: the array of Spheres with size numSpheres
-unk: always 0x0
-numBoxes: number of Boxes
-boxes: the array of Boxes with size numBoxes
-numVertices: number of Vertices in the array
-vertices: the array of Vertices with size numVertices
-pading: always 0x0
-numFaces: number of Faces in the array
-faces: the array of Faces with size numFaces

the rest is stil to be discovered, but it look something like:

unsigned int unknownValue;
Box box;
unsigned int numUnknownStructs;
UnknownStruct unknownStructs[];

-unknownValue: no idea what it good for but known values are: 0xEF5DCB33
-box: another posible Box (quite shure it´s some kind of FaceGroup for all faces)
-numUnknownStructs: number of UnknownStructs in the array
-unknownStructs[]: the array of UnknownStructs with size numUnknownStructs (seems to be in some way related to FaceGroups


struct UnknownStruct{
void unknown[8]
unsigned short start;
unsigned short end;
}

I have realy no idea how the 8 Byte from unknown can be interpreted.
« Last Edit: April 02, 2015, 09:07:56 AM by gtafan »

Offline AfterLife

  • The Reaper
  • Sr. Member
  • ***
  • Posts: 830
  • Gender: Male
  • I'm from the AfterLife...
    • View Profile
Re: COL format
« Reply #1 on: March 10, 2015, 06:20:36 AM »
I don't really understand... But good find.

Offline gtafan

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: COL format
« Reply #2 on: March 10, 2015, 09:40:10 AM »
I don't really understand... But good find.
Like I said, C/C++ syntax is used, that requires some programming knowledge.

I just wrote a tool that reads the sphere section from Bully col file and export it into cst file. The cst file can than being read by GTA colleditor2.
« Last Edit: March 10, 2015, 10:57:37 AM by gtafan »

deadpoolXYZ

  • Guest
Re: COL format
« Reply #3 on: March 10, 2015, 11:13:04 AM »
What does the col files exactly do? I found them in stream.img so I suppose they are related to textures or models.

Offline gtafan

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: COL format
« Reply #4 on: March 11, 2015, 08:09:43 AM »
What does the col files exactly do? I found them in stream.img so I suppose they are related to textures or models.
They are related to models in some way, they contain the collision data for the model.

Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Re: COL format
« Reply #5 on: March 11, 2015, 08:14:22 AM »
This is collision data for all things in the game.

Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Re: COL format
« Reply #6 on: March 11, 2015, 08:15:55 AM »

Offline GreenOmnitrix

  • XFire: jedijosh920
  • Full Member
  • ***
  • Posts: 292
  • Gender: Male
  • 欺負改裝是真棒
    • View Profile
    • YouTube Channel
Re: COL format
« Reply #7 on: March 11, 2015, 10:42:57 AM »
I believe the .COL files are related to some sort of collision file. In World.img there are.col files for the nerds glasses, and I think it's when you punch the nerds and their glasses go flying off.

Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Re: COL format
« Reply #8 on: March 11, 2015, 11:40:24 AM »
yeah duh.....


i just fucking told them you fucking parrot


fuck you go and die


*allah akbar!!!*


*explosion*

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: COL format
« Reply #9 on: March 11, 2015, 12:06:26 PM »
Collision fellas, preventing you from walking through shit and crashing cars.

The col files would define what parts of models are "solid" in a way.

Offline gtafan

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: COL format
« Reply #10 on: March 11, 2015, 12:12:06 PM »
I believe the .COL files are related to some sort of collision file. In World.img there are.col files for the nerds glasses, and I think it's when you punch the nerds and their glasses go flying off.
http://www.gtamodding.com/index.php?title=Collision_File
The structure of the file has some changes, but the datastrucktures, at least the really important ones, are still the same.
I have writen a tool, that extracts the collision model from a col file and convert it into CST format, that can be read by gta colleditor. If somebody is interested, I can post the tool with its sorces later.

deadpoolXYZ

  • Guest
Re: COL format
« Reply #11 on: March 11, 2015, 02:28:42 PM »
Possibly going off topic here but is there a way to load the .col files with lua? Most of the thigs I spawn with createpersistententity doesn't seem to have collision, for example the auditorium.

Then there are some props like the scaffold which seems to already spawn with collision.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: COL format
« Reply #12 on: March 11, 2015, 05:55:04 PM »
I've never used that function but 2 ideas. Maybe 1, it's another function that spawns with collision, or 2, maybe it's another argument you have to pass to the function that's bool (true/false) for if it has collisions.

Offline gtafan

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: COL format
« Reply #13 on: March 12, 2015, 10:50:50 AM »
The tool has still some bugs, I can´t understand, but here some pics of collision models from some vehicles:

70wagon


truck


policecar

Offline GreenOmnitrix

  • XFire: jedijosh920
  • Full Member
  • ***
  • Posts: 292
  • Gender: Male
  • 欺負改裝是真棒
    • View Profile
    • YouTube Channel
Re: COL format
« Reply #14 on: March 13, 2015, 02:03:54 AM »
The tool has still some bugs, I can´t understand, but here some pics of collision models from some vehicles:

70wagon


truck


policecar


Nicely done.