Adding My New Ships - .BOD File Format Question

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

aXeL_UK
Posts: 200
Joined: Thu, 23. Oct 08, 22:45
x3tc

Adding My New Ships - .BOD File Format Question

Post by aXeL_UK »

I've search the forums for 'bod', 'bod file' and 'bod file format' and the search has returned nothing from any forum - :? Kind of hard to believe.

Also tried the x3dmod forum but to no avail

So, after reading EVERY tutorial there is on X2/X3 ship modding, I started pulling apart X3TC .bod files and still couldn't fathom what I needed. My issue:

When I export a ship from 3DS Max 8.5 using DBOX2 1.9, it only exports successfully if the ship components are ungrouped. If I 'group' or 'assemble' the components, DBOX only exports the 'comment' section, ie. 1 line into the file and the rest is empty. Anyone know how to get around this?

At present I just export the ship with the components ungrouped, however in the game it treats each component as an LOD model representing the entire ship. If I zoom in and out, different parts of the ship appear and disappear so...

I started hacking my .bod file to manually group components but no arrangement seems to work - the game just CTDs. I tried obvious stuff like grouping all vertex data together, then all facet data together but I just get a corrupted ship rendered in the game.

I then tried playing with the sections marked:

-99; 00000000000000000001; // end of part
-99; 0000000000000000; // end of body

..which represent the end markers for a particular LOD; so I tried moving the 'end of body' marker to the end of the entire model, hoping that it would include all 'parts' in one LOD but no joy..

It's almost as if there should be something to mark the beginning of a new 'part' section but I don't know what so in summary:

1) Why does DBOX2 1.9 make an empty bod file if ungrouped components are grouped or assembled first?

2) If I have multiple 'parts' to a ship:
- What is the bod file structure?
- How do I denote discrete 'parts' sections so they'll render correctly?

See annoted example of just two 'parts' in a single object. I want these parts to render simultaneously in their respective relative locations. The format below (as exported by DBOX2) will treat the second part as a second LOD whereby, as I zoom the view out, the first part will vanish and the second part will appear...

------------------------------------------------------------------------------

/# Exported with dbox2 1.9 at 23/11/2008 13:11:47

MATERIAL6: 0; 16; NULL; 0;0;0; 251;255;240; 190;193;182; 0; 0; 90; 0; 0;1;0; 100; NULL;100; NULL;30; NULL;100; NULL;100; NULL;0; // Top
MATERIAL6: 1; 16; NULL; 0;0;0; 70;0;255; 50;0;180; 0; 0; 90; 0; 0;1;0; 100; NULL;100; NULL;30; NULL;100; NULL;100; NULL;0; // Bottom


2850; // body size
// vertices (5418)
-54025; 10594; 26504; // 0
-53993; 10551; 27290; // 1
............and so on.............
49330; 10551; 27290; // 5416
49362; 10594; 26504; // 5417
-1; -1; -1; // end of verts

// ----- Top (10654 faces) -----
0; 1939; 1908; 1900; -25; 1; 0.470304; 0.088168; 0.468984; 0.090264; 0.468532; 0.090184; /! N: -0.691583; 0.447395; 0.567054; !/ // 0
0; 1911; 1939; 1900; -25; 1; 0.469115; 0.087987; 0.470304; 0.088168; 0.468532; 0.090184; /! N: -0.663040; 0.494728; 0.561802; !/ // 1
0; 2608; 2558; 2559; -25; 1; 0.497964; 0.082345; 0.496129; 0.082350; 0.496197; 0.079985; /! N: -0.003019; 0.366116; 0.930564; !/ // 2
............and so on.............
0; 5172; 5191; 5176; -25; 1; 0.701076; 0.969431; 0.706896; 0.970112; 0.701648; 0.992078; /! N: 0.109570; 0.924070; -0.366182; !/ // 10653
-99; 00000000000000000001; // end of part
-99; 0000000000000000; // end of body

52; // LOD
// vertices (4290)
-33451; -5385; 41254; // 0
-33408; -6271; 41337; // 1
-33344; -5598; 35345; // 2
............and so on.............
8028; -31395; 63878; // 4288
8094; -31395; 54384; // 4289
-1; -1; -1; // end of verts

// ----- part Bottom (5540 faces) -----
1; 1381; 1425; 1427; -25; 1; 0.518276; -0.313283; 0.500000; -0.312523; 0.500000; -0.340000; /! N: 0.030778; -0.888290; 0.458251; !/ // 0
1; 1382; 1381; 1427; -25; 1; 0.518096; -0.339636; 0.518276; -0.313283; 0.500000; -0.340000; /! N: -0.012834; -0.876292; 0.481610; !/ // 1
1; 1379; 1423; 1425; -25; 1; 0.518688; -0.271535; 0.500000; -0.271196; 0.500000; -0.312523; /! N: 0.021756; -0.930456; 0.365758; !/ // 2
............and so on.............
1; 2224; 2166; 2189; -25; 1; 0.286667; 1.553333; 0.294916; 1.650965; 0.292981; 1.733732; /! N: -0.166279; -0.986071; -0.003889; !/ // 5538
1; 2224; 2157; 2166; -25; 1; 0.286667; 1.553333; 0.295596; 1.553333; 0.294916; 1.650965; /! N: -0.195088; -0.980785; -0.001358; !/ // 5539
-99; 00000000000000000001; // end of part
-99; 0000000000000000; // end of body

------------------------------------------------------------------------------


Anyone overcome this?
User avatar
Observe
Posts: 5323
Joined: Fri, 30. Dec 05, 17:47
xr

Re: Adding My New Ships - .BOD File Format Question

Post by Observe »

aXeL_UK wrote:Also tried the x3dmod forum but to no avail
Ah, but you didn't ASK question on x3dmod where I usually hang out did you? [ external image ]

Ok, I'll forgive you this one time. Here goes to see if I understand you correctly:

DBOX will export the main "component" mesh (as you refer to it). Any other meshes will not be exported UNLESS they are either attached or linked to the "main" mesh. I've written details on these methods in various places over the years, but don't know exactly where atm.

As an example, let's say you have a main ship "body" polygon mesh and a separate polygon mesh for the wings. You could select the main mesh, and then under the Editable Poly Modifier tab, scroll down to the Edit Geometry section and click the Attach button. This will let you select the wings Editable poly and attach it to the main body. You'll then want to reset your pivots, collapse Modifier Stack, Reset Xform, and best collapse the stack again. Then when you export via DBOX, you'll have the complete "package" intact.

The other way is to link the wings as a "child" of the "parent" main body. The advantage of doing it this way is that the two sections remain separate for further modification if desired. Generally I personally simply attach (first method).

Try that and let me know if I addressed your question, and if you have further trouble. :)
aXeL_UK
Posts: 200
Joined: Thu, 23. Oct 08, 22:45
x3tc

Post by aXeL_UK »

Thanks Observe,

I DL'd a tonne of stuff from various parts of x3dmod which got me started.

Can't be 'as@@@' to forum hop (Yes - lazy I know) and I figured that anyone with the knowledge would definitely be in THIS forum... Seems I was right :)

Thanks very much for the steer with regard to using attach - makes far more sense than my approach. Last night I was exporting to .OBJ, resetting Max, importing from .OBJ, 'Assembling' all the meshes and then the group did export with DBOX. If you ignore the fact that it's pitch black (I cut out all the textures - that's next) and it's upside down and backwards (doh!) I now have a servicable Whitestar replacing the Skiron. Total newbie approach I know; but thanks to you I can do it properly now, once I learn to reset my divots, collapse my Stats and Reset the XMen thingy... whatever that is. At this point you're, quite rightly, wondering how I got the ship into 3DS much less into the game. Well - I have no idea but I did write it all down as I went through.

Textures - Quick Question

I read conflicting tutorials, stating that:

1) I have to use the in game textures only from the X3 library (Don't believe it)
2) I have to use DDS format textures with dimensions as a discrete power of 2
3) I can use other formats e.g. jpg, tga etc. provided I put them in the textures dir off game folder.

Which is true? Should I be hacking around with properly sized DDS and adding to Materials.txt or can I just say, "See those jpegs? Use 'em!".
jimhsu77479
Posts: 168
Joined: Sun, 25. Nov 07, 22:39
x4

Post by jimhsu77479 »

I can verify JPG works. Haven't tried TGA. They also work fine in cat/dats. And don't know how the game handles scaling, etc for AQC if you don't use DDSes.

(Also, X3 seems to be fine when I export DDSes without mipmaps. Oversight or expected?)

PS Finding this information is an enormous pain in the ***. Is it possible to start building a wiki at Wikia or something with some basic information?
PSS Apparantly there is something: http://www.xwiki.chaos.net.nz . Hasn't been updated in a while, though.

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”