Skip to content

Research Notes

Willi Schinmeyer edited this page Nov 3, 2022 · 3 revisions

Legacy Notes

The last time I worked on reverse engineering the FO2 level formats, I recorded the results in this repo.

Level Editor Tech

While I wait for Blender Apps, there are already Application Templates, which I need to investigate.

cdb2.gen format

Here are intrepid's notes on the collision file:

/// cdb2.gen format ///

Just a short description of what I have found out yet, for more specific information look at the CODE for now

The cdb2 file is used only for collision detection, it holds a mesh with relatively high poly count of the map and an AABB tree.
It seems that there are no other geometric primitives like spheres, boxes etc., just triangles.

Basically the file consists of 3 parts which are concatenated to one file.

First part is a binary AABB tree which is used for searching which polygons in the mesh are near the actual position of the car and therefore relevant for collision detection. When this is done, on average there are about 10 - 20 triangles which are returned (not really return, but written in buffer...). For this a bounding box of the car is passed to the function which parses the tree.

The second part is a offset table which contains offsets to the vertices in the 3rd part and it gives therefore information which vertices are building one triangle.

The 3rd part contains only vertex coordinates saved as int16, they are divided by constants which can be found in the header for every axis to get the real coordinates as float number, the same also for the values in the 1st part.

The AABB tree in the first part is traversed depth first and if it finds a leaf (flag == 3) it copies it to a buffer. The leaves are containing number of triangles to be copied, and an offset to the offset table (part 2) (and some other stuff needed & also material info for sound). Then there are 6 different ways of which the offsets can be interpreted. Six functions get the vertices and are building then the returned mesh triangle for triangle.

Clone this wiki locally