** Tutorial ** Making asteroid fields and nebulas in .THN Me
Part 1: Asteroid fields
First of all, we need to create scene, starsphere, lights and camera in our script:
<pre><font size=1 face=Courier>
duration=10361.872
entities={
{
entity_name="Scene_Tutorial",
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
}
},
{
entity_name="starsphere_Bw07_stars",
type=COMPOUND,
template_name="starsphere_bw07_stars",
lt_grp=2,
srt_grp=-80,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Prop"
}
},
{
entity_name="starsphere_Bw07",
type=COMPOUND,
template_name="starsphere_Bw07",
lt_grp=2,
srt_grp=-80,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Prop"
}
},
{
entity_name="Camera_1",
type=CAMERA,
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
}
}
},
cameraprops={
fovh=30,
hvaspect=1.333333,
nearplane=1,
farplane=1000000
}
},
{
entity_name="Light_1",
type=LIGHT,
template_name="",
lt_grp=1,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-13805,
0,
-5578
},
orient={
{
0.991074,
-0.077697,
0.108328
},
{
0.027899,
0.9154870000000001,
0.40138
},
{
-0.130359,
-0.394775,
0.909483
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
1,
1,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
0.5,
0.5,
2
},
range=2000,
cutoff=98.999977,
type=L_DIRECT,
theta=90,
atten={
1,
0,
0
}
}
},
{
entity_name="Light_2",
type=LIGHT,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-13805,
0,
-5578
},
orient={
{
-0.834819,
0,
0.550524
},
{
0,
1,
0
},
{
-0.550524,
0,
-0.834819
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
0.909804,
0.909804,
0.5
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
1,
0,
1
},
range=60000,
cutoff=98.999985,
type=L_DIRECT,
theta=90,
atten={
1,
0,
4e-006
}
}
},
{
entity_name="Light_1_copy_2",
type=LIGHT,
template_name="",
lt_grp=3,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-14988,
0,
-8387.272247
},
orient={
{
0.991074,
-0.077697,
0.108328
},
{
0.027899,
0.9154870000000001,
0.40138
},
{
-0.130359,
-0.394775,
0.909483
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
1,
1,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
1,
-0.5,
1
},
range=2000,
cutoff=98.999977,
type=L_DIRECT,
theta=90,
atten={
1,
0,
0
}
}
},
{
entity_name="Monitor_2",
type=MONITOR,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0
}
}
events={
{
0,
SET_CAMERA,
{
"Monitor_2",
"Camera_1"
}
},
}
</font></pre>
When you load this script in the game, you will see a starsphere from Sigma-19. You can add distant asteroids to your starsphere background. Simply place this entity after the starsphere_Bw07 entity:
<pre><font size=1 face=Courier>
{
userprops={
category="Prop"
},
template_name="distant_roids_lt",
spatialprops={
orient={
{
0,
0,
1
},
{
0,
1,
0
},
{
-1,
0,
0
}
},
pos={
0,
0,
0
}
},
usr_flg=2,
type=1,
srt_grp=-80,
entity_name="ambi_distant_roids",
flags=4,
lt_grp=21
},
</font></pre>
And here is the result:
If you change the flags from "4," to "4 + LIT_AMBIENT,", you'll get a field of grey asteroids.
If you want to make a script that takes place in the asteroid field, you have to manually place all asteroids. If you have enough time and patience, you'll do it. This is the sample asteroid entity:
<pre><font size=1 face=Courier>
{
entity_name="asteroid_1",
type=COMPOUND,
template_name="nonmineable_asteroid60",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={40,-30,-327},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Asteroid"
}
},
</font></pre>
All you need to do is to copy-paste it many times, and change "entity_name" and "pos" in each copy. Change "template_name" in some copies to avoid having a field where all asteroids are identical. The file data\solar\asteroidarch.ini contains all available asteroids. The nickname is what you need to write in "template_name".
The other way is to use "backdrop" picture in your background, but in that case you will be unable to add any objects or moving ships, because "backdrop" is a small picture and it is very close to the camera.
Add this to Data\PetalDB.ini:
<pre><font size=1 face=Courier>
prop = menu_background, bases\backdrops\bd_li02_06_iceasteroid.3db
</font></pre>
And place this entity in the script:
<pre><font size=1 face=Courier>
{
entity_name="Background",
lt_grp=23,
flags=4,
userprops={
category="Prop"
},
template_name="menu_background",
spatialprops={
pos={
0,
0,
-80
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
type=1,
usr_flg=0,
srt_grp=0
},
</font></pre>
Now launch the game and you will see a picture of asteroid field in the main menu.
You can edit the 3db files in
First of all, we need to create scene, starsphere, lights and camera in our script:
<pre><font size=1 face=Courier>
duration=10361.872
entities={
{
entity_name="Scene_Tutorial",
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
}
},
{
entity_name="starsphere_Bw07_stars",
type=COMPOUND,
template_name="starsphere_bw07_stars",
lt_grp=2,
srt_grp=-80,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Prop"
}
},
{
entity_name="starsphere_Bw07",
type=COMPOUND,
template_name="starsphere_Bw07",
lt_grp=2,
srt_grp=-80,
usr_flg=1,
flags=LIT_DYNAMIC,
spatialprops={
pos={
0,
0,
0
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Prop"
}
},
{
entity_name="Camera_1",
type=CAMERA,
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
}
}
},
cameraprops={
fovh=30,
hvaspect=1.333333,
nearplane=1,
farplane=1000000
}
},
{
entity_name="Light_1",
type=LIGHT,
template_name="",
lt_grp=1,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-13805,
0,
-5578
},
orient={
{
0.991074,
-0.077697,
0.108328
},
{
0.027899,
0.9154870000000001,
0.40138
},
{
-0.130359,
-0.394775,
0.909483
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
1,
1,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
0.5,
0.5,
2
},
range=2000,
cutoff=98.999977,
type=L_DIRECT,
theta=90,
atten={
1,
0,
0
}
}
},
{
entity_name="Light_2",
type=LIGHT,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-13805,
0,
-5578
},
orient={
{
-0.834819,
0,
0.550524
},
{
0,
1,
0
},
{
-0.550524,
0,
-0.834819
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
0.909804,
0.909804,
0.5
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
1,
0,
1
},
range=60000,
cutoff=98.999985,
type=L_DIRECT,
theta=90,
atten={
1,
0,
4e-006
}
}
},
{
entity_name="Light_1_copy_2",
type=LIGHT,
template_name="",
lt_grp=3,
srt_grp=0,
usr_flg=0,
spatialprops={
pos={
-14988,
0,
-8387.272247
},
orient={
{
0.991074,
-0.077697,
0.108328
},
{
0.027899,
0.9154870000000001,
0.40138
},
{
-0.130359,
-0.394775,
0.909483
}
}
},
lightprops={
on=Y,
color={
255,
255,
255
},
diffuse={
1,
1,
1
},
specular={
0,
0,
0
},
ambient={
0,
0,
0
},
direction={
1,
-0.5,
1
},
range=2000,
cutoff=98.999977,
type=L_DIRECT,
theta=90,
atten={
1,
0,
0
}
}
},
{
entity_name="Monitor_2",
type=MONITOR,
template_name="",
lt_grp=0,
srt_grp=0,
usr_flg=0
}
}
events={
{
0,
SET_CAMERA,
{
"Monitor_2",
"Camera_1"
}
},
}
</font></pre>
When you load this script in the game, you will see a starsphere from Sigma-19. You can add distant asteroids to your starsphere background. Simply place this entity after the starsphere_Bw07 entity:
<pre><font size=1 face=Courier>
{
userprops={
category="Prop"
},
template_name="distant_roids_lt",
spatialprops={
orient={
{
0,
0,
1
},
{
0,
1,
0
},
{
-1,
0,
0
}
},
pos={
0,
0,
0
}
},
usr_flg=2,
type=1,
srt_grp=-80,
entity_name="ambi_distant_roids",
flags=4,
lt_grp=21
},
</font></pre>
And here is the result:
If you change the flags from "4," to "4 + LIT_AMBIENT,", you'll get a field of grey asteroids.
If you want to make a script that takes place in the asteroid field, you have to manually place all asteroids. If you have enough time and patience, you'll do it. This is the sample asteroid entity:
<pre><font size=1 face=Courier>
{
entity_name="asteroid_1",
type=COMPOUND,
template_name="nonmineable_asteroid60",
lt_grp=0,
srt_grp=0,
usr_flg=0,
flags=LIT_DYNAMIC + LIT_AMBIENT,
spatialprops={
pos={40,-30,-327},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
userprops={
category="Asteroid"
}
},
</font></pre>
All you need to do is to copy-paste it many times, and change "entity_name" and "pos" in each copy. Change "template_name" in some copies to avoid having a field where all asteroids are identical. The file data\solar\asteroidarch.ini contains all available asteroids. The nickname is what you need to write in "template_name".
The other way is to use "backdrop" picture in your background, but in that case you will be unable to add any objects or moving ships, because "backdrop" is a small picture and it is very close to the camera.
Add this to Data\PetalDB.ini:
<pre><font size=1 face=Courier>
prop = menu_background, bases\backdrops\bd_li02_06_iceasteroid.3db
</font></pre>
And place this entity in the script:
<pre><font size=1 face=Courier>
{
entity_name="Background",
lt_grp=23,
flags=4,
userprops={
category="Prop"
},
template_name="menu_background",
spatialprops={
pos={
0,
0,
-80
},
orient={
{
1,
0,
0
},
{
0,
1,
0
},
{
0,
0,
1
}
}
},
type=1,
usr_flg=0,
srt_grp=0
},
</font></pre>
Now launch the game and you will see a picture of asteroid field in the main menu.
You can edit the 3db files in