Ships - Destructable Parts
Each part has several components :
1 - A .3db file - This is the shape of the part for use when it is blown off, not (as i originally thought) the shape of the part at all times. This also contains the location of the harpoint DpConnect which matches a harpoint on the ship for that part. Presumably the DpConnect and Dp'nameofpart ' (on ship) are for deciding what direction to blow the part in when it is destroyed.
2 - A .sur file - For detecting damage to the part
3 - Entries in the ships main .cmp file - There are two main nodes for each part :
a) An entry under 'Cmpnd' called Part_'nameofpart '_lod1 with 3 nodes :
Filename - Usually in the format 'nameofpart '_lod1xxxxxxxxxxxxxx.3db. Refers to name of second entry in .cmp file. Where the xxxxxxx number is the same for the hull and all the parts.
Index - 8 byte integer array. 'Root' is 0 other parts are numbered 1, 2, 3 etc
Object name - Object name 'nameofpart '_lod1. Matches object name in {Collison Group} entry in shiparch.ini.
b) An entry in the main tree the same as the entry for the main hull. It has the same name as Filename in the above entry. It contains the same nodes as the main hull entry :
Harpoints - Any Hps which are on the part
VMeshWire - ? Rarely more than 100 bytes for a part.
Multilevel - Information for different LODs. 1 VMeshRef for each level always 60 bytes.
4 - Entries in shiparch.ini - {Collision Group} has the stats for the part (hitpoints, type, explosion/debris type etc.) {Simple} Refers to the .3db file and .mat file for the part.
You can delete all the files in the ships directory (except for the main.cmp) and delete all the {Collision Group} and {Simple} entries in shiparch and the parts will still be on the ship when you load up. So the parts are present somewhere in the .cmp.
You can delete the 'Cmpnd' -> 'Part_'nameofpart '_lod1' -> Index entry, the 'nameofpart '_lod1xxxxxxxxxxxxxx.3db -> VMeshWire node and the 'Harpoints' node and the part is still there. This only leaves the 'Multilevel' node which is far too small to contain any decent info.
You can change the name of Part_'nameofpart '_lod1 to anything you like and the part still shows up.
You can change the Filename entry and as long as you make the same change to the name of 'nameofpart '_lod1xxxxxxxxxxxxxx.3db things are fine.
However if you change the Object entry the part disappears. So the object name is referring to the data for the part which must be contained in the main VMeshData node for the hull.
No matter what i do tho i cant seem to get a part to appear on a ship. I have tried defining a part of the ship as a different group. This increases the size of the VMeshData in the exported .cmp file so it is not simply ignoring the extra group. When the ship is in game this part does not appear. So then i added all the relevant entries to the .cmp using the object name i gave the group in milkshape (as the object name for Root is the hulls group name in milkshape this makes sense). No luck. I also tried adding the VMeshData for the part on its own as a separate node under VMeshLibrary again using the milkshape group name but this didnt work either.
I am really fed up. Once the part is registered in the .cmp and FL will show it the rest is a piece of cake. Anyone got this to work?
EDIT - I have just noticed one final place where the parts are referred to. There are two entries in a node in the .cmp file under 'Cmpnd'. The node is called 'Cons' and the subnodes are 'Fix' and 'Rev'. I had overlooked these assuming they were nothing of relevance. However 'Fix' contains the names of all the parts in the format 'Root....60bytes....Object name ....<112bytes'
The total is always 176 bytes regardless of the length of Object name . 'Rev' is similar but only contain references to the bay doors. Hopefully this is the key to it....
EDIT - The 'Fix' entry is the key to getting the parts to show up. I ripped the data from a game ship and replaced the name of one of the parts with the part i was trying to add to my ship. I then added a 'Cmpnd' -> 'Cons' -> 'Fix' entry to my ship and imported the edited data. When i loaded up the normal ship hull was there aswell as a second ship centred on the point where the component from the game ship would have been. The second hull had no Hps and behaved as a destructable part should. Now all that needs to be done is to work out how to get it to display the part in question instead of the whole bloody hull...
EDIT - Further to all this i have discovered that the reference to the actual structure of the part is contained within the data in the 'Fix' bit. If you change the Object name in both the 'Fix' entry and the 'Part_'nameofpart'_lod1' -> Object name entry the part will still appear as long as the object names match. Therefore the Object name name component of the 'Fix' entry is not relevant to what structure to show but is for FL to refer to later on.
Edited by - redeye on 09-07-2003 09:04:58
Edited by - redeye on 09-07-2003 09:48:28
Edited by - redeye on 09-07-2003 10:05:45