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

LordFjord''s THN info

The general place to discuss MOD''ing Freelancer!

Post Sat Nov 25, 2006 3:53 pm

LordFjord''s THN info

@ Rankor you posted in the Newbie thread concerning the intro THN's, THN's are not noob material so rather than cluttering up that thread I'll post info here.

The first thing you will need is Fled_Thorn, this decompresses them allowing you to edit them with a text editor. I'm sorry to say that a text editor is still the only way we have of editting them, Accushot was working on a program but I haven't heard anything about it in ages.

What I'm posting is LordFjord's thn tutorial from the old infinity forums, I copied it about a week before the forums got hacked last year and afaik all of the good stuff on that site is now gone.

After reading this you might regret asking as thn's are not for the faint hearted.



What is a thn file
THN files hold all animation sequences in cutscenes, rooms on bases, also the menu background scenes.
All things that are in ingame-graphics and not actually in space flight mode are thn animations.
Original Freelancer has manymany of these for the singlplayer cutscenes or just for filling the docked bases with a bit ambience and light.
Everything that moves there was scripted into detail - every single bypassing "traffic" ship on planets and so on.


This tutorial is a reference to the possible sections I found, not an example.
I learned many parts of this from Lancersreactor and additional researched revealed a few more details.


Install the thn-decompiler. make sure the LUA dir is set up correctly and select a thn file. It will be decoded. It will work in a decompiled format, just like ini-files.

The thn file is divided into 2 big sections, above that u can declare the complete duration of the animation (in seconds).

duration = 300
entities={ ...
< list all entities here >
}

and
events={ ...
< sequences and events go here >
}

you need to declare EVERYTHING, from the largest planet to the smalles engine-effect.

A bit theory:
positions are always: x, z, y (well, it is actually x, y, z but those are aligned differently as in school-maths)
orientations are more complex, this hardpoint tutorial cna be helpful to find out the rough values: click me


I will try to list all sections i found and my guess what they mean:

entities:

scene
i don't know why u need it, it is never referredd to in the future.
havent tested if it works without one, but all files i checked so far have it.
Code:

{
entity_name="Scene_Untitled",
type=SCENE,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
},
up=Y_AXIS,
front=Z_AXIS,
ambient={
128,
128,
128
}
},



declaring a ship

Code:

{
entity_name="Ship_01",
type=COMPOUND,
template_name="pi_elite2",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0.000000,
-1000.000000,
7000.000000
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Spaceship"
}
},


template_name= this is the reference to shiparch.ini
pos={ <------------positioning as described above, only important for fixed objects
orient={ <---------orientation as described above
category= <-------"Spaceship" for ships, "Solar" for planets, other objects

declaring an effect
In this case it is the ship's engine. Note that some ships have several engines, u need an entry for each one.

Code:

{
entity_name="Ship_01_Engine_1",
type=PSYS,
template_name="gf_co_smallengine02_fire",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
psysprops={
sparam=0
}
},


Position values are not important as we will link this to the ship later.

declaring a planet/other opbject
very similar to our other objects, just for reference:
Code:

{
entity_name="planet_mercury_200_2",
type=COMPOUND,
template_name="planet_mercury_200",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC,
spatialprops={
pos={
325.583038,
-2031.342896,
-1040.869141
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Solar"
}
},


Typical it's to long

Edited by - Bejaymac on 11/25/2006 3:55:24 PM

Edited by - Bejaymac on 11/25/2006 3:57:55 PM

Post Sat Nov 25, 2006 3:56 pm

Lights:
Pretty straightforward, you can set a lot of options here, i wont go much into detail here, I assume u know what RGB colors, diffuse, specular and ambient values are
Code:
{
entity_name="Light_1",
type=LIGHT,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0,
0,
0
},
orient={
{
0.560152,
0,
-0.82839
},
{
0,
1,
0
},
{
0.82839,
0,
0.560152
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
0.909804,
0.909804,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
0,
0,
1
},
range=2000,
cutoff=98.999985,
type=L_DIRECT,
theta=90,
atten={
1,
0,
4e-006
}
}
},



Camera and monitor
you need both to see something - u can define cameras and i think u can even swithc between them during the animation. The monitor is what u actually see on the screen.

Code:

{
entity_name="Camera_1",
type=CAMERA,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0.0,
-1028.601685,
7368.024414
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
cameraprops={
fovh=30,
hvaspect=1.333333,
nearplane=1,
farplane=1000000
}
},


I havent experimented with the cameraprops yet, but i guess u can change FOV there how about a 360° cam?

Monitor:
Code:

{
entity_name="Monitor_2",
type=MONITOR,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0
},



Background
Use any starsphere from the inis.
Code:
{
entity_name="starsphere_Li04_4",
type=COMPOUND,
template_name="starsphere_Li04",
lt_grp=0,
srt_grp=-100,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
-0.943394,
0,
-0.331673
},
{
0,
1,
0
},
{
0.331673,
0,
-0.943394
}
}
},
userprops={
category="Prop"
}
},



Pathes:
The way to get things moving, maybe the most compicated part of this:
Code:

{
entity_name="Path_1",
type=MOTION_PATH,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
pathprops={
path_type="CV_CROrientationSplinePath",
path_data="OPEN, {0.000000,-1000.000000,6800.000000}, {1.000000,0.000000,0.000000,0.000000}, {0.000000,-1000.000000,2000.000000}, {1.000000,0.000000,0.000000,0.000000}, "
}
},


position doesnt matter here, the important entry is this:
path_data="OPEN, ...
there is always one coordinate "{x, z, y}" followed by "{1.000000,0.000000,0.000000,0.000000}".
I dont know what the 2nd entries in the set do, but the 1st ones define the waypoints of the path.
(I need to verify if these are absolute or relative coordinates.)

You can add additional waypoints.

The ships / moving objects will be attached to the path in the "effects" section.
You can attach a camera to a path, too.


The last entry in "entities" doesnt have a "," after the closing bracket }.

------------------------------------------------------------------------------
events:

the number before each entry is the delay in seconds before it is initiated.

Starting effects:
This is used for all kinds of effects. They must have been defined in the sections above.
Code:

{
0,
START_PSYS,
{
"Ship_01_Engine_1"
},
{
duration=2400
}
},


duration is in seconds.

Rotating objects
Code:

{
0,
START_SPATIAL_PROP_ANIM,
{
"planet_watblucld_1500_4"
},
{
duration=360.1,
target_type=ROOT,
spatialprops={
axisrot={
360,
NEG_Y_AXIS
}
}
},


Used usually with planets, but it should work with any object - maybe even the camera.

Attaching objects to each other
This is used to attach an engine to a ship, rings to planets, explosions to their objects,...
a few examples:
an engine:
Code:

{
0,
ATTACH_ENTITY,
{
"Ship_01_Engine_1",
"Ship_01"
},
{
duration=360,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
target_part="hpengine01",
target_type=HARDPOINT,
flags=POSITION + ORIENTATION
}
},


target_part is the hardpoint of the ship - mabe its possible to place guns on ships, too.

Pathes / Movement
moving a ship:
Code:

{
0,
START_PATH_ANIMATION,
{
"Ship_01",
"Path_1"
},
{
duration=50,
start_percent=0,
stop_percent=1,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
flags=POSITION + ORIENTATION + LOOK_AT
}
},


duration is in seconds. This and the distance defined by the Path (waypoints) will be responsible for the speed of the object.

The offset entries are used to move the relative position of the attached object to the parent object.
You can give several objects the same path with different offsets to create fleets and their formations.

Set up Monitor
Code:

{
0,
SET_CAMERA,
{
"Monitor_2",
"Camera_1"
}
},
{
0,
START_PATH_ANIMATION,
{
"Camera_1",
"Path_Cam"
},
{
duration=35,
start_percent=0,
stop_percent=1,
offset={
0,
0,
0
},
up=Y_AXIS,
front=NEG_Z_AXIS,
flags=POSITION + ORIENTATION + LOOK_AT
}
},



First the Monitor is attached to the camera object, then the camera is set on a defined path -> moving camera.

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

Most of the work you'll be doing is pure trial and error so don't be afraid to experiment and don't worry about CTD's as thier par for the coarse. If you have any problems post away and I'll try and help, I'm not brilliant at them but I do know enough not to get to many CTDs

Post Sun Nov 26, 2006 9:24 am

@ Bejaymac

I can't express how much I appreciate your feedback on this. This is like the "Holy Grail" to me as IT IS what makes the difference between the usual and unique.
It's like a "teaser" to wet the appetite and anticipation of the player for the "Shape of Things to come" .

Edited by - Rankor on 11/26/2006 9:25:21 AM

Post Sun Nov 26, 2006 12:33 pm

There are a couple of tutorials here on TLR

This is bobthedog's tutorial, it's similar to the one I posted.
This is buckaroobanzai's new room tutorial.

Between these and dozens of experiments of my own I've got a basic understanding of THN's, and I do mean basic.

Return to Freelancer General Editing Forum