Exporting from 3dMax, getting .bod's to act like cockpits

The place to discuss scripting and game modifications for X²: The Threat.

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

Post Reply
User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Exporting from 3dMax, getting .bod's to act like cockpits

Post by DeadlyDa » Wed, 3. Nov 04, 01:39

Update- Nov 13 - Added link to thread with addittional information... http://www.egosoft.com/x2/forum/viewtopic.php?t=68906

Update - Nov 9 - Added ingame pix's of 4 ships, and a link to a zip file with the source files (.max, .bod, etc) for one of them. See below.

Small Update: Nov 3rd...additional 'essential tools. Added links to the Bod Viewer and 3d Max import script (from RA's post on ***)

Ok...I've told a few people I would try and explain how I finally got cockpits (and view points) to work. The following (unfortunately lengthy) post is an attempt on my part to provide a "relatively" quick look at how I get a new part (.bod) to act like a real cockpit.

As usual, this isn’t necessarily the right way...but it works every time for me.

First, you must have the right tools. DoubleShadows latest X2 Editor (0.0.27) is awsome, and now allows you to add and delete guns and turrets on your new ship entry in the TShips file. Unless you are a masochist, and like slogging through a never ending string of numbers...get it at: http://www.doubleshadow.wz.cz/?p=download.

Two other tools you will need are the Bod file viewer (lets you look at a small image of the .bod files in your "v" folder), and the MaxScript files used to import .bod files (bodies, not scenes) into 3d Max You can get the viewer at http://urquan.nightmail.ru/BODViewer/Exe , and the MaxScript files at http://urquan.nightmail.ru/Altor/ . These are from a Russian X2 modder. There is a bit more info on how to get the MaxScript to work in this thread: http://www.***/Forums/viewtopic.php?t=48 .

You can pack/unpack & compress/decompress the X2 files using the official X2 Modding kit (from this site), or the older X2 Modder by OlisJ. I prefer OlisJ's X2 Modder.

Now, this is not a simple (or particularly well-understood) subject, and I’m going to assume that you have diligently studied (and re-studied) the various graphics modding threads on this site, as well as the official GFX Modding documentation.

I am also assuming you probably followed roughly the same learning curve that I did; Hacked the TShips file until you got tired of flying around in the ultimate M5 (that could kill anything in the X2 universe), then switched to using a text editor and existing X2 .bod files (from the “v” folder) to build your own custom ships, and finally started importing body parts into 3d Max, creating new meshes, and trying to export your creations back into X2.

The reason that the above assumptions are important is that I fully expect you to have already explored the contents of .bod files...both from the “v” and “cut” folders. If you haven’t, go back and look at the graphics modding threads in the sticky at the top of this forum, and work through what is being discussed as you look at working X2 body parts and scene files!

OK...you know all that stuff...so how do you make a body part (.bod file) act like a cockpit? Well, if you looked in the “v” folder at working cockpits (806 is a good example) and turrets (look at 939), you will note that right at the end of the 1st body in the bodyarray there is a sequence that looks something like (this is from part 806):

Code: Select all

... ...
... ...
-99; 00000000000010001; 
/----- Part cockpit -----
 1;   218;   220;   219; -25;  2; -25.000000;26.000000; 25.000000;-24.000000; -25.000000;-24.000000; /(420) Flags 0x0001
 1;   220;   218;   221; -25;  2; 25.000000;-24.000000; -25.000000;26.000000; 25.000000;26.000000; /(421) Flags 0x0001
 0;   222;   224;   223; -25;  4; -25.000000;26.000000; 25.000000;-24.000000; 25.000000;26.000000; /(422) Flags 0x0001
 0;   224;   222;   225; -25;  4; 25.000000;-24.000000; -25.000000;26.000000; -25.000000;-24.000000; /(423) Flags 0x0001
 4;   218;   223;   221; -25;  8; -25.000000;26.000000; 25.000000;26.000000; 25.000000;26.000000; /(424) Flags 0x0001
 4;   223;   218;   222; -25;  8; 25.000000;26.000000; -25.000000;26.000000; -25.000000;26.000000; /(425) Flags 0x0001
 3;   221;   224;   220; -25; 16; 25.000000;26.000000; 25.000000;-24.000000; 25.000000;-24.000000; /(426) Flags 0x0001
 3;   224;   221;   223; -25; 16; 25.000000;-24.000000; 25.000000;26.000000; 25.000000;26.000000; /(427) Flags 0x0001
 5;   220;   225;   219; -25; 32; 25.000000;-24.000000; -25.000000;-24.000000; -25.000000;-24.000000; /(428) Flags 0x0001
 5;   225;   220;   224; -25; 32; -25.000000;-24.000000; 25.000000;-24.000000; 25.000000;-24.000000; /(429) Flags 0x0001
 2;   219;   222;   218; -25; 64; -25.000000;-24.000000; -25.000000;26.000000; -25.000000;26.000000; /(430) Flags 0x0001
 2;   222;   219;   225; -25; 64; -25.000000;26.000000; -25.000000;-24.000000; -25.000000;-24.000000; /(431) Flags 0x0001
-99; 00001000000000000001;
-99; 0000000000000000; /Mark end of body
... ...
... ...
The magic is in getting the cockpits you export from 3d Max to have that “Part cockpit” entry imbeded in them, as it seemingly identifies the part as a real cockpit to the X2 game engine, and also tells it where to place the origin of your cockpit view.

Starting from the limited information in the official GFX documentation, and based on considerable trial and error, here is what I do when creating a cockpit:

1. First create the body part for your cockpit, and name the object. I typically use unassigned part numbers…like 17210_1 (I’ll explain the “_1” at the end of the name later).
2. Make sure your pivot is centered, and that your new part is at 0,0,0. (There are many ways around this, but to keep this as simple as possible…keep things centered.)
3. Then use 3d Max to create a small cube (geometry)…I typically use 2x2x2 as a size…and name the object “cockpit”.
4. Move the cube you just created to where you want the origin point for your cockpit view.
5. Next, use 3d Max to “link” the cockpit cube to your cockpit body part (17210, in my example).
6. Make sure everything is centered (oh...I already said that!), and the use 3d Max to reset the transforms (Reset XForm), and collapse the modifier stack.
7. Now group your cockpit part (17210, in the example) and the linked cube named “cockpit”, and use the EgoSoft-supplied exporter to export your creation as a “body” (in my example, with the name 17210.bod). If you look at your new part with a text editor, you should see the magic “/----- Part cockpit -----“ section!
8. Include your cockpit into a scene file...and your ready to fly!

OK, about that scene file...how do you get guns to work with your new cockpit? Ah…remember the “_1” at the end of the cockpit name in my example above? That tells the EgoSoft exporter that this part is cockpit number 1 when you get around to exporting your scene file. If you imported a couple of X2 lasers (say part 106), and named both the new objects 106_1 (yes, you now have two objects in 3d Max with the same name), the resulting entries in your exported scene file might look something like:

Code: Select all

P 0; B 940; N 940_core;
  { 0x2002;  0; 0; 0;  0.000000; 0.000000; 0.000000; 0.000000;  -1;  -1; } // 34
/     Mon Nov 01 22:04:19 2004
/     Node 16270_1 Class [Editable Poly, GEOMOBJECT_CLASS_ID]
P 1; B 17210; C 1; N 16270_1;
  { 0x2002;  0; 0; 0;  0.000000; 0.000000; 0.000000; 0.000000;  -1;  -1; } // 0
/     Mon Nov 01 22:04:19 2004
/     Node 00106_1 Class [Editable Mesh, GEOMOBJECT_CLASS_ID]
P 2; B 106; C 1; N 00106_1;
  { 0x2002;  12791; -862; -1994;  0.000000; 0.000000; 0.000000; 0.000000;  -1;  -1; } // 34
/     Mon Nov 01 22:04:19 2004
/     Node 00106_1 Class [Editable Mesh, GEOMOBJECT_CLASS_ID]
P 3; B 106; C 1; N 00106_1;
  { 0x2002;  -12791; -862; -1994;  0.000000; 0.000000; 0.000000; 0.000000;  -1;  -1; } // 34 
/     Mon Nov 01 22:04:19 2004
/     Node cockpit Class [Box, GEOMOBJECT_CLASS_ID]
P 4; B 0; F 1; N cockpit;
  { 0x2002;  0; 1891; 1593;  0.344915; -0.529813; 0.662266; 0.529813;  -1;  -1; } // 34
Delete the entry for “cockpit (P 4, above) from your scene file. I usually “clean up” the raw scene files, and reorder the parts as exported from 3d Max anyway, so this is not really a chore.

You will note that the cockpit part (17210) now has a “C 1” automatically inserted into the part entry. This identifies the part as cockpit #1. You will also note that the two 106 lasers are automatically assigned to cockpit #1 (there is a “C 1” in each 106 entry).

Here is a simple example of creating a 4-gun turret using standard X2 parts (in this case, 939 turrets and 708 gun towers)

1. Import a 939 turret, and place somewhere on your model. Name it 939_2 (or _3, _4, _5, _6, _7...in addition to front guns in C1, you can have up to 6 turrets; top, bottom, front, rear, left, and right.)
2. Import and place 4 708 gun towers (actually, import 1, and clone it 3 times), each one named 708_2 (assuming the gun towers are to be controlled by the turret #2). You now have 4 objects in 3d Max with the name 708_2.

When you export the scene file, the resulting .bod will have the following entries somewhere in it:

Code: Select all

P  6; B 00939; C 2; { 2;      0;   5250; 293750; 0.0000; 0.0000; 0.0000; 0.0000;   -1; -1; } // 0 /- Turret - front
P  7; B 00708; C 2; { 2;  67200; -25000; 243700; 0.0000; 0.0000; 0.0000; 0.0000;   -1; -1; } // 0 /- gun tower - front
P  8; B 00708; C 2; { 2;      0; -61900; 283900; 0.0000; 0.0000; 0.0000; 0.0000;   -1; -1; } // 0 /- gun tower - front
P  9; B 00708; C 2; { 2; -67200; -25000; 243700; 0.0000; 0.0000; 0.0000; 0.0000;   -1; -1; } // 0 /- gun tower - front
P 10; B 00708; C 2; { 2;      0;  12750; 294750; 0.0000; 0.0000; 0.0000; 0.0000;   -1; -1; } // 0 /- gun tower - front
Simple...eh!

Now all you have to do is pop over into DoubleShadows X2 Editor, and modify the appropriate TShip entry...but that topic has already been addressed in other threads (and this post has gone on far too long!)

Hope this helps...it works for me.
Last edited by DeadlyDa on Sat, 13. Nov 04, 16:20, edited 2 times in total.

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek » Thu, 4. Nov 04, 01:50

"Nature's first green is gold" . . . stay golden.

User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Post by DeadlyDa » Tue, 9. Nov 04, 20:46

OK, a few ingame screenshots of the ships I've been playing around with. (...and don't be ragging me about the textures...that's not where I like to spend my time :wink:)

On the assumption that examples teach, I have included a link to a .zip with all of the files I used to create the first ship in the series (Darkship). The .zip includes the 3dMax file, the exported .bod files (body and scene), and the TShips entry. Based on the questions I've been getting, this should hopefully help people understand the cockpit stuff a bit better.

This is the "Darkship". The original mesh was done by Armand Niculescu...based on a Privateer 2 ship. Enjoy...
[ external image ]
...and here is the .zip with all the files used in the above ship...

http://www.flatrock.org.nz/wolf/images/ ... FX_Pkg.zip

Here is the A-17 Broadsword based on a mesh by someone known as Corsair(pilot), redone as a proper M6 (3 main guns, 2-gun turret in rear, 1-gun turrets on top and bottom). Add in Reven's Gunnery Crews for the turrets, and who needs Capital ships! The M5 docking is below the main pod, where you see the lasers firing...
[ external image ]

I wanted something small, zippy, and deadly to play around with (the Peggy is just way too ugly). Here is a small M5-class ship I based on a mesh called Storm...no author listed...
[ external image ]

And finally, my favorite...a ship based on the mesh by Alan "Hawk" Hart of the Wing Commander Banshee. It's a tad excessive on the poly's but that's what high-end graphics cards are for! The model was soo very nice, I gave it 6 main guns (GHEPTS, of course)...
[ external image ]

Again, no apologies for the textures & artwork...that's not what I do. However, the ships are certainly fun to play with!
Last edited by DeadlyDa on Mon, 24. Jan 05, 06:15, edited 1 time in total.

saiien
Posts: 8
Joined: Mon, 23. Aug 04, 16:16
x3

bod's as cockpit

Post by saiien » Wed, 10. Nov 04, 05:59

Thanks for the help DD and for the model it's very help full i would like to pm
my ship files to you and show you some in game pictures form two of the ships im currently working on so i can give you a better insite of the small probs im up against and hope fully that's make it more easy to solve and for the rest of you pilots out there yes i will tell you how to make your own ships
in 3dsmax in do time and if i get a green light to post it from the chief pilots
( The Moderators ) :o Really it isen't that hard to do and ill ask DeadlyDa nicely to host the pictures from some of my ships if anybody is interested enough he is a very very big help to me on this topic. :wink: See Yaa;-)

User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Post by DeadlyDa » Thu, 11. Nov 04, 01:11

Saiien...no problem, happy to be of assistance. In the absence of any useful documentation we all need to help each other :D

As for hosting a few pix's, no problem there either. Send them along, and I'll put them up and send you the url's.

As an FYI...SteelRush has just opened up a graphics mod download facility on Xscripting.com. I put the Darkship source files up there as an alternate download site. His site is at http://www.xscripting.com/index.php

It's empty at the moment, so lets all try and provide him with a bit of content :!:

Post Reply

Return to “X²: The Threat - Scripts and Modding”