tree.klz think tank
Posted: Fri Aug 05, 2011 4:05 pm
Hi everyone.
I've started looking at tree.klz to understand how collisions works. It seems a long and difficoult way, though. So I'll post every discovery I make here.. Maybe someone else will have ideas.
First of all, I advice to read how collision trees usually works:
http://en.wikipedia.org/wiki/Bounding_volume_hierarchy
http://en.wikipedia.org/wiki/Octree
http://en.wikipedia.org/wiki/R-tree
http://en.wikipedia.org/wiki/Kd-tree
I don't know which of these method is used in H&D2, but they share some principles.
The world is divided into sub-sectors, each sub-sector is divided into sub-sub-sectors, and so on.
So, given my position in game, with a quick tree research, the game can tell that I'm into sector A, but I'm also into sub-sector AB, and that I'm into sub-sub-sector ABC.
Then, each sector and sub-sector is linked to the objects that overlap that sector.
So, to detect collisions of my movements, the game has to intersect me with just the object linked by my sector, and does not have to intersect me with EVERY object present in the scene.
tree.klz is used to divide the world into sectors and sub-sectors and to associate each one to some objects from scene.4ds and scene.bin.
tree.klz is divided in at least 2 parts.
In the first part, there is a list of strings, which correspond to scene objects.
In the second part should be the division of space and linking of objects.
I've started looking at tree.klz to understand how collisions works. It seems a long and difficoult way, though. So I'll post every discovery I make here.. Maybe someone else will have ideas.
First of all, I advice to read how collision trees usually works:
http://en.wikipedia.org/wiki/Bounding_volume_hierarchy
http://en.wikipedia.org/wiki/Octree
http://en.wikipedia.org/wiki/R-tree
http://en.wikipedia.org/wiki/Kd-tree
I don't know which of these method is used in H&D2, but they share some principles.
The world is divided into sub-sectors, each sub-sector is divided into sub-sub-sectors, and so on.
So, given my position in game, with a quick tree research, the game can tell that I'm into sector A, but I'm also into sub-sector AB, and that I'm into sub-sub-sector ABC.
Then, each sector and sub-sector is linked to the objects that overlap that sector.
So, to detect collisions of my movements, the game has to intersect me with just the object linked by my sector, and does not have to intersect me with EVERY object present in the scene.
tree.klz is used to divide the world into sectors and sub-sectors and to associate each one to some objects from scene.4ds and scene.bin.
tree.klz is divided in at least 2 parts.
In the first part, there is a list of strings, which correspond to scene objects.
In the second part should be the division of space and linking of objects.