Freelancer Community Network


Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

**Tutorial** - DIY ships with Destructible Parts using SUR S

Here you find the different tutorials on editing and MODing Freelancer

Post Wed Sep 27, 2006 5:46 pm

**Tutorial** - DIY ships with Destructible Parts using SUR S

**Tutorial** - DIY Destructible Ship Parts using SUR Splicer, plus Wires

a tutorial by yours truly, Cold_Void

this an ADVANCED TUTORIAL about converting a single-mesh ship to have all the features of a stock ship(destructible wings, wireframes, SUR), not for the beginning modder who has never exported a model!

vocabulary:
code-hardpoint- a single triangle, tells the ms3d exporter how to orient, name, and nest hardpoints in models
model-hardpoint- a model of a hardpoint mount, this is the block-thing with yellow hazard stripes that code-hardpoints are located over for equipment items
mesh - a milkshape model group
part - a freelancer Compound Part - it can be made up of several meshes, or just one, and it's usually destructible (1d.)
.vms - the parent node of the VMeshData in UTFedit
.vwire - wireframe data
.3db - a simpler form of cmp, requires an additional exporter
.cmp - a compound model for the game freelancer
.sur - a SURface file for detecting hits

req. software:

Milkshape 3d
modeling software required! you get 30 days free, and its only $20 to purchase

Modding tools by Colin Sandby:

a. .cmp exporter
b. .mat exporter
c. HardCMP hardpoint editor/model and SUR preview
d. .3db exporter
Other tools:
Tools by Dev (aka Devast8or)
e. SUR splicing tool
f. Dev's makewire (wireframe-generating application)
Essential tools:
g. SUR exporter compiled binary (thank you Argh, you're a saint!)
h. UTFedit v3 (recommended but not necessary, it's just more convenient than Mario's old build)

(note: i have talked to both Colin and Mario indirectly and directly in emails and confirmed we are free to redistribute either program under 1. defacto GPL rules and 2. explicit permission from both programmers)

optional software:
a. Open Command Window Here "XP powertoy" it allows you to open a ms-dos command window in any folder with a right click

videos:
in-game video of my first ship with destructible parts
in-game video of my second ship (Tron recognizer) with destructible parts, showing how they break off

Edited by - Cold_Void on 8/2/2007 7:14:09 PM

Post Wed Sep 27, 2006 5:50 pm

FIRST STEP(regrouping the model into multiple parts):

1a. To begin, break your single or multiple mesh model into parts such as wings fins and anything else you want to break
off with damage
1b. Name your ships parts simply to reduce typing and eye-straining garbage characters;eg. star_wing is better than rh_fighter_star_wing
1c. Your first mesh should be the central part of the ship, which we'll call Root - this mesh's name will be used to name
the .cmp's VMS node which will uniquely identify it - use a new name for your ship-root like the ship name
1d. You can include have several meshes in a part (.3db node) - remember that they are lumped into the .3db groups by
the exporter from top to bottom
- example:

ms3d appearance:
JSN_interceptor
glass
Star_Wing
hardpoint_1
hardpoint_2
Port_Wing
hardpoint_1
hardpoint_2
Star_Engine
Port_Engine
Hp/Fixed/HpEngine
etc etc code-hardpoints

CMP export settings:

groups:5

group 1: 2 meshes (JSN_Interceptor, glass)
group 2: 3 meshes (wing, model-hardpoints)
group 3: 3 meshes (wing, model-hardpoints)
group 4: 1 meshes (engine)
group 5: 1 meshes (engine)
(code-hardpoints don't count)

In UTF format-viewing (the export-finished window, and UTFedit) the CMP exporter v3 result is:



Edited by - Cold_Void on 11/30/2006 7:12:58 AM

Post Wed Sep 27, 2006 5:58 pm

STEP TWO (damage caps):

2. Before proceeding, check your ships model to verify that it's PERFECT - you can change textures later but any changes
to the model will have to be carefully considered so that damage caps, SURs and wires fit - and depending on your methods
you may have to repeat steps 2-3. Note that FLModelTool cannot resize your multi-part CMP or SUR so whatever scale it is,
you're stuck with after exporting.

2a. Duplicate your parts to make damage caps- mangle the ends and make it look broken -
you can use an identical texture with damage marks on it or a damage texture mapped over the open(broken) end.
suggested naming your damage caps: ship_part_dmg_cap - but anything unique will work

2b. Add code-hardpoints. label them similar to this: Hp/Fixed/DpStarWing - locate them inside the parent-part - this is
important for getting these hardpoints and the damage caps on the right part of the ship, be it root or another part

2b. Rename the damage cap's connecting hardpoint you already placed in the model (dpstarwing etc) as DpConnect and place
it below the damage cap mesh(es) in ms3d - then export your cap using the .3db exporter, with the same orientation and
scale(leave the export scaling alone)

STEP THREE (SUR construction):

3a. Now, fit primitive shapes(boxes and spheres) over your ms3d models groups - you can get highly accurate facsimiles using a cube-
duplicate the cube like so and move it so one side touches the original. Select by faces both cubes, then deselect all faces
but the two touching each other - delete them, and snap all the vertexes together, weld them and regroup the cubes -
now you should have a valid sur that can be fitted more accurately.

3b. Once you have sur pieces to match your final-cmp save it in a separate file, and export each piece individually(using the same orientation back-forward/up-down as your cmp). If your model is too big to fit on the screen and you are multiply its scale in milkshape before exporting, do the same with your separate SUR source file, and save it as SUR 100x(or whatever multiplier you use) - this will save coming back and doing each piece. Also, only scale from origin.

list and name your parts in a sur_splice ini like so;
interceptor.sur <-same name as .cmp
10<- ship radius
100000 100000 100000 <-intertia settings
root.sur Root
star_wing.sur Star_Wing_lod1
port_wing.sur Port_Wing_lod1
star_engine.sur Star_Engine_lod1
port_engine.sur Port_Engine_lod1

3c. You will notice that these are the same names as the exporter gave your groups (all have _lod1 attached) - this will save you
several steps listed in sur_splice's readme like renaming Object Names and importing a new cons_fix.

3d. Open a command window and run sur_splice partlist.ini(or whatever you saved the list as), and then check your SUR's fit in HardCMP - open the model, press 'S' and then goto file->open->same model and the sur will display

3e. If your sur is OK you're ready to play test the model and see if it works. Note that parts, like wings, do not normally collide with other objects, but projectiles and missiles will hit them just fine. If this is a problem you can design your damage caps as damage panels and make the Root SUR cover most of the ship. IMO wings not colliding with bases is not much of a problem

Edited by - Cold_Void on 9/27/2006 7:33:24 PM

Post Wed Sep 27, 2006 6:05 pm

STEP 4(making and importing wireframes):

4. If the root collides ok, and projectiles are impacting on the wings, you're ready to make the wireframes for your ship - remember too that this optional step is next to last for a reason; its the least necessary and more repetitive than any other part of the procedure.

4a. The wireframe mesh should be very simple(low poly) and for that reason i reopen the SUR ms3d file as it's already a low-poly model - assign the same material as your ship give to the wireframe model now(it won't display, but this is may be an important step..afaik). At this point, view the wireframe-model in wireframe mode and decide whether it's too crowded with lines or not - remember the makewire utility draws wires around every vertex, so it will look exactly the same in your radar view. If there's too much wire (you should really minimize it, as some reports of vertex-limits have indicated it can cause crashes) snap and weld unnecessary vertexes together and just try to lower the poly count.

4b. Name the wireframe model parts differently from their real-counterparts, and so you can tell them apart
ex: Interceptor_Star_Wing_wire

4c. Export your wireframe parts as .cmps or .3dbs and open the part_name.lod0.vms node(or if you used a .3db, it will be lod0-112.vms), and export the VMeshData - to make things easier later, copy the .vms node name before exporting the VMeshData and paste it in for the exported-file name, do that for all the wireframe-parts and then open a command window in your wire-parts directory

4d. Input this argument(example): make_wire interceptor_wire.lod0.vms interceptor_wire.lod0.vms interceptor_wire.vwire
the format is (filename) (.vms, aka VMesh name) (output wiredata) <-this is the root wire
repeat this until you have five wires(or however many) - remember you can bring up the last command-prompt input by pressing up, however you cannot paste or copy text.

4e. Now open your model in UTF editor:
<pre><font size=1 face=Courier>
JSN_interceptor.lod0.vms

JSN_interceptor_lod1.3db
Star_Wing_lod1.3db
Port_Wing_lod1.3db
Star_Engine_lod1.3db
Port_Engine_lod1.3db
</font></pre>

4e2. and add these nodes

<pre><font size=1 face=Courier>
JSN_interceptor.lod0.vms
New node
VMeshData
New node
VMeshData
New node
VMeshData
New node
VMeshData
New node
VMeshData

JSN_interceptor_lod1.3db
VMeshWire
VWireData
Star_Wing_lod1.3db
VMeshWire
VWireData
Port_Wing_lod1.3db
VMeshWire
VWireData
Star_Engine_lod1.3db
VMeshWire
VWireData
Port_Engine_lod1.3db
VMeshWire
VWireData
</font></pre>

4f. Now, import each .vms part into a VMeshData node of its own - but before you confirm the file import, copy the filename - pasting it in that blank parent node still labeled 'new node' will assure you get the right data with the right name, and saves typing



4g. Then import each .vwire into it's corresponding data node- locating these in your destructible parts links the wireframe to them so damage shows up in the radar view, so star_wing_wire's data goes under star_wing_lod1 wire node

Edited by - Cold_Void on 11/30/2006 7:31:03 AM

Post Wed Sep 27, 2006 6:12 pm

STEP 5.(renaming your models parts to prevent collision):

5. One final step - all those generic part names could collide(conflict) with other ship parts if left as-is, so we'll rename the important part - the .3db names

Open the cmpnd node and expand the parts:
<pre><font size=1 face=Courier>
Cmpnd:
Root
File name
JSN_interceptor_lod189027190.3db <-paste a random 8 digit number, or a crc after lod1.
Part_Star_Wing_lod1
File name
Star_Wing_lod189027190.3db
Part_Port_Wing_lod1
File name
Port_Wing_lod189027190.3db
Part_Star_Engine_lod1
File name
Star_Engine_lod189027190.3db
Part_Port_Engine_lod1
File name
Port_Engine_lod189027190.3db
</font></pre>

Now rename the .3db nodes to match these filenames, and you're done with the model - save the file and check it, then transfer your .3db caps, .cmp, .mat, and .sur's to your ships directory.

6. Now your shiparch needs to know how much damage parts will take, whether they break off or are replaced, and how long separated
debris should live, and where damage components attach to each other

Write your groups like so:
<pre><font size=1 face=Courier>
{CollisionGroup}
obj = Star_Wing_lod1<-the object name, as it appears in the cmpnd object name node
separable = false
debris_type = debris_vanish
mass = 300.000000
dmg_hp = DpStarWing <-the hardpoint that the replacing damage-cap will attach to
dmg_obj = interceptor_star_wing_cap <-your damage 'cap' .3db - this references a {Simple}
hit_pts = 5000 <-how much damage it takes - armor doesn't affect this!
type = Top_Fin <-what label shows in the radar when its selected, check shiparch.ini for more
root_health_proxy = false <-does the damage carry over to the total-health

{Simple}
nickname = interceptor_star_wing_cap
DA_archetype = ships\jsncalif\interceptor\interceptor_star_wing_cap.3db
material_library = ships\jsncalif\interceptor\interceptor.cmp
mass = 1000
LODranges = 0, 9000
</font></pre>

It doesn't matter where you place your simples in the shiparch, so do whatever you like best - just make sure they're
uniquely named, just like ships and every other archetype. Collision groups on the other hand can and do have identical names
- their placement after the shiparch and before the next is critical.

There are more advanced topics i did not touch on, such as fuses for destroying groups and group_dmg_obj/hp's which are a variant of damage caps
for attaching with other groups instead of root - the best example being the battleships which can lose very large chunks
such as the bow, and those chunks are damage-capped groups - otherwise there would be a large hole in the broken model where
backfaces would not draw and the broken-off-piece would be see-through on the inside

Also i did not touch on material export - export it wherever you like; in a .mat file or in the .cmp itself - however i like
to put the damage materials in the same mat as the rest and leave materials out of .3db's (its redundant).

Let me know what you think of the tutorial if you use it, also if there's enough interest in seeing source files for this stuff I will be glad to include an example project.

Edited by - Cold_Void on 1/8/2007 4:50:21 PM

Post Mon Jan 08, 2007 4:25 pm

bump - added UTFeditor v3 link.

P.S. I want to add that I'm not 100% positive about whether SURs and "objects" can have name collisions or not, and unique naming for everything is always a plus - in this tutorial i used very generic naming (star_wing) and that is probably not correct, as freelancer uses names like rh_star_wing, etc. Also a reminder, object names/actual .3db part names -need- to be different or nothing will happen. and SP collision detection is better than MP, for some reason - but you will find that custom SURs always work together, if they work at all with stock SURs that is

Post Thu Jan 11, 2007 12:07 pm

@ Cold_Void,

I bow to your excellence.
I've been creating an 17-1800's replica of a 3 masted sailing barq (per special request of "Shipper" of Asylum51)
I am near completion of texturing out the main model with the exception of figuring out an "active" texture for the sails.
Next, I wanted to be able to break this model down to "destructable" sub component parts as well as create "damaged" sub component parts that in turn would give this particular ship a very special "life" of its own.

My deepest thanks to you for this tutorial.
This is very involved and is going to take me a while to finish. But when it is finished...it will be a sight to behold.

Post Mon Jan 22, 2007 4:43 pm

Cold_Void, we need to talk so please respond to my email, or if your address is different than what is in your profile please send me one so I have yours. This is rather urgent.

Freelancer - =EOA= Players Consortium
Serious Sam - Seriously!

Post Mon Jan 22, 2007 7:03 pm

i sent a reply last night - i'll send it again tho, and address the issue immediately since it's so urgent


edit: hello - anyone home over there?

Edited by - Cold_Void on 1/23/2007 11:45:11 AM

Post Wed Jan 24, 2007 5:47 am

Your emails went into my spam folder so I had to set up a new filter. I have responded.

Freelancer - =EOA= Players Consortium
Serious Sam - Seriously!

Post Thu Jan 25, 2007 7:21 am

clean up on aisle three please (sheepish grin)

Post Wed Nov 07, 2007 5:37 pm

Where are the moderators these days? This should have been stickied a year ago!

Surs are still a hot topic - for me at any rate, still can't get to grips with the buggers - my ones that show dull grey in HardCMP work, but the bright white ones don't!

And yes, Cold_Void, old pal - I named the sur parts correctly as far as I can see in the CMP file, filenames are same as the nodes, I even added a CRC to them too - and object names are same as the sur components and Fix data, ending in _lod1 (can't see the SUR file clearly though, to be 100% sure its right). I didn't use sur_splicer, thought I would try without - do I need to?

Post Sat Nov 10, 2007 12:53 am

Thanks for the new stickies moderator.

Return to Freelancer Editing Tutorial Forum

cron
Hosted by The-Starport
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.