Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: WMCoolmon on April 02, 2006, 08:40:26 pm

Title: Maneuvering thrusters.
Post by: WMCoolmon on April 02, 2006, 08:40:26 pm
1) Screenie:
(http://fs2source.warpcore.org/temp/wmc/ulythrust.jpg)

2) Table entry samples (After "$Trail:" stuff, right before subsystems)
Code: [Select]
$Thruster:
+Texture: Missiletrail03 ;;Graphic that will be used for trail, rendered like beams
+Radius: 3.0 ;;Radius of cylinder
+Length: 5.0 ;;Length of thruster trail
+Used for: ("pitch up") ;;What will trigger this thruster
+Position: (0.0 0.0 0.0) ;;Where the thruster is
+Normal: (0.0 1.0 0.0) ;;What direction it will point
$Thruster:
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
+Used for: ("pitch down")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 -1.0 0.0)

3) Use types:
Code: [Select]
flag_def_list Man_types[] =
{
{"Bank right", MT_BANK_RIGHT},
{"Bank left", MT_BANK_LEFT},
{"Pitch up", MT_PITCH_UP},
{"Pitch down", MT_PITCH_DOWN},
{"Roll right", MT_ROLL_RIGHT},
{"Roll left", MT_ROLL_LEFT},
{"Slide right", MT_SLIDE_RIGHT},
{"Slide left", MT_SLIDE_LEFT},
{"Slide up", MT_SLIDE_UP},
{"Slide down", MT_SLIDE_DOWN},
{"Forward", MT_FORWARD},
{"Reverse", MT_REVERSE},
};

4) Build (Includes sample .tbm used for testing):
http://fs2source.warpcore.org/exes/latest/C02042006.zip
Title: Re: Maneuvering thrusters.
Post by: FireCrack on April 02, 2006, 10:25:58 pm
Hmm, couldn't you do some math to auto-determine when, and with what intensity, the thruster should fire depending on it's position and normal?

Either way good work on this, i'l probably try to make some data for all my HTL models.

A more pertinent suggestion may be to be able to specify a "fire sound" and a "loop sound"
Title: Re: Maneuvering thrusters.
Post by: Trivial Psychic on April 02, 2006, 11:48:28 pm
I can see TBP making good use of this feature.  It's been a long time coming.  Thanks WMC.  BTW, firstly I'd like to know where in a table file that these entries be added.  Just before or after the $afterburner data?  Secondly, I know you've created this for the intention of supporting the RCS thrusters on the Vipers for BtrL, but I seem to recall the thrusters appearing like cones.  Are you gonna include a figure for narrowing of the thrustertrail (I think the term is +attenuation, like in the BEAM sections)?
Title: Re: Maneuvering thrusters.
Post by: Vasudan Admiral on April 03, 2006, 01:30:00 am
That's awesome! (Even if it does mean som poor chap is now going to have to go through and implement it on all fighters. ;) ) Well done.  :yes:

Quote from: Trivial Psychic
firstly I'd like to know where in a table file that these entries be added. Just before or after the $afterburner data?
"2) Table entry samples (After "$Trail:" stuff, right before subsystems)"

Quote from: Trivial Psychic
Secondly, I know you've created this for the intention of supporting the RCS thrusters on the Vipers for BtrL, but I seem to recall the thrusters appearing like cones. Are you gonna include a figure for narrowing of the thrustertrail (I think the term is +attenuation, like in the BEAM sections)?
Assuming it doesn't translate the texture it uses, I'd imagine it'd just be a case of drawing the cone onto the texture itself - perhaps animating it with 2 or 3 frames to make it flickker.
Title: Re: Maneuvering thrusters.
Post by: WMCoolmon on April 03, 2006, 02:08:20 am
New entry style:
Code: [Select]
#Ship Classes
$Name: GTF Ulysses
$Thruster:
+Used for: ("pitch up")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 1.0 0.0)
+Texture: exp20
+Radius: 3.0
+Length: 5.0
+StartSnd: boom_2
+LoopSnd: BS_SRed
+StopSnd: boom_3
$Thruster:
+Used for: ("pitch down")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 -1.0 0.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
#End

As you can see, I've added sounds for starting, stopping, and looping. The looping sound hasn't been working for me so far, unfortunately, and I haven't been able to figure out why yet.

Animations are also now supported and tested.

I'm looking into a more efficient way of rendering these things atm...
Title: Re: Maneuvering thrusters.
Post by: Trivial Psychic on April 03, 2006, 02:39:39 am
I've noticed you've got a normal of 1.0 for pitch-up, and -1.0 for pitch down.  Does that mean that the listed normal is opposite of what one would think when referencing positions in MODview.  If I want my ship to thrust up for example, I would have one or more thrusters on the ventral, fire downwards, and downwards is typically a negative normal.
Title: Re: Maneuvering thrusters.
Post by: WMCoolmon on April 03, 2006, 03:06:32 am
I've noticed you've got a normal of 1.0 for pitch-up, and -1.0 for pitch down.  Does that mean that the listed normal is opposite of what one would think when referencing positions in MODview.  If I want my ship to thrust up for example, I would have one or more thrusters on the ventral, fire downwards, and downwards is typically a negative normal.

Hmm, that is odd. Looks like FS2 uses reverse rotational velocity from what I thought, and it didn't work quite right with normal velocity. Both seem fixed now, though it could be tested a bit more.

http://fs2source.warpcore.org/temp/C03042006.zip

Here's a fuller thrust table:
Code: [Select]
#Ship Classes
$Name: GTF Ulysses
$Thruster:
+Used for: ("pitch up")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 -1.0 0.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
$Thruster:
+Used for: ("pitch down")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 1.0 0.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
$Thruster:
+Used for: ("bank right")
+Position: (0.0 0.0 0.0)
+Normal: (-1.0 0.0 0.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
$Thruster:
+Used for: ("bank left")
+Position: (0.0 0.0 0.0)
+Normal: (1.0 0.0 0.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
$Thruster:
+Used for: ("pitch up" "reverse")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 0.0 1.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
$Thruster:
+Used for: ("pitch down" "forward")
+Position: (0.0 0.0 0.0)
+Normal: (0.0 0.0 -1.0)
+Texture: Missiletrail03
+Radius: 3.0
+Length: 5.0
#End
Title: Re: Maneuvering thrusters.
Post by: WMCoolmon on April 03, 2006, 03:19:53 am
Oh, a word about optimization.

Thruster rendering is grouped together by each frame being displayed, among all thrusters of all ships. This means that if you have two ships with a different thruster image each, or two ships using the same two-frame thruster animation, the thrusters should render at roughly the same speed.

It also means that if you fire 20 thrusters at the same time with a 30-frame animation, they'll render as fast as if they were firing with all firing with the same static image. Although you'll still need the extra memory for the animation.

This is all theory, though, so don't take it as the end-all-be-all of thruster usage. Especially considering each thruster is just two triangles...
Title: Re: Maneuvering thrusters.
Post by: Vasudan Admiral on April 03, 2006, 06:29:39 am
Well, I battled my way through all the debug build's media VP related errors, and am happy to report that it works fine for me. :)

I haven't tried the sounds yet or with AI ships, but here are some settings that make the effect more visible and in the correct places:

Code: [Select]
#Ship Classes
$Name: GTF Ulysses
$Thruster:
+Used for: ("pitch up") ;;rear,top, right
+Position: (1.5 0.5 -4.6)
+Normal: (0.0 1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("pitch up") ;;rear,top, left
+Position: (-1.5 0.5 -4.6)
+Normal: (0.0 1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("pitch up") ;;front,bottom, right
+Position: (4.5 -2 3)
+Normal: (0.0 -1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("pitch up") ;;front,bottom, left
+Position: (-4.5 -2 3)
+Normal: (0.0 -1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("pitch down") ;;rear,bottom, middle
+Position: (0.0 0.2 -5.7)
+Normal: (0.0 -1.0 0.0)
+Texture: thruster02-01
+Radius: 2.0
+Length: 8.0
$Thruster:
+Used for: ("pitch down") ;;front,top, right
+Position: (4.9 -0.6 1.8)
+Normal: (0.0 1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("pitch down") ;;front,top, left
+Position: (-4.9 -0.6 1.8)
+Normal: (0.0 1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("roll left") ;;front,right
+Position: (6.3 -2.1 3.1)
+Normal: (0.0 0.0 1.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("roll left") ;;rear,left
+Position: (-4.9 -1.2 -2)
+Normal: (0.0 0.0 -1.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("roll right") ;;front,left
+Position: (-6.3 -2.1 3.1)
+Normal: (0.0 0.0 1.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("roll right") ;;rear,right
+Position: (4.9 -1.2 -2)
+Normal: (0.0 0.0 -1.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("bank right") ;;middle,right, top
+Position: (4.9 -0.7 0.5)
+Normal: (0.0 1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("bank right") ;;middle,left, bottom
+Position: (-4.9 -2.2 0.5)
+Normal: (0.0 -1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("bank left") ;;middle,left, top
+Position: (-4.9 -0.7 0.5)
+Normal: (0.0 1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
$Thruster:
+Used for: ("bank left") ;;middle,right, bottom
+Position: (4.9 -2.2 0.5)
+Normal: (0.0 -1.0 0.0)
+Texture: thruster02-01
+Radius: 1.0
+Length: 6.0
#End
Title: Re: Maneuvering thrusters.
Post by: FireCrack on April 03, 2006, 07:39:30 am
link in your last post isn't working, this one is correct.

http://fs2source.warpcore.org/exes/latest/C03042006.zip


When i run VA's table i get the banking thrusters firing when the ship yaws, havent checked to see if it's a problem with the table or the code though, or if prehaps i'm neglecting the way the thrusters are placed.
Title: Re: Maneuvering thrusters.
Post by: Vasudan Admiral on April 03, 2006, 09:40:53 am
It's the autobank causing it as far as I can tell.

Edit:
Would it be possible to have the length scale with the input? Ie, if I were to move the stick halfway right, the resulting plumes would be at half length? It's not a big issue, but it'd be a very nice touch. :)
Title: Re: Maneuvering thrusters.
Post by: DaBrain on April 04, 2006, 03:38:37 am
That's a very nice feature...  :yes:


Just wondering... could this be used to simulate the swril effect for the (legendary) barrelroll?

BTW I just got some ideas where I could use this feature... ;)
Title: Re: Maneuvering thrusters.
Post by: WMCoolmon on April 04, 2006, 04:04:08 am
It's the autobank causing it as far as I can tell.

Edit:
Would it be possible to have the length scale with the input? Ie, if I were to move the stick halfway right, the resulting plumes would be at half length? It's not a big issue, but it'd be a very nice touch. :)

Try this build and see if it does what you want:
http://fs2source.warpcore.org/temp/wmc/va_test.zip

EDIT: I've got the modified source for the trial effect sitting on my desktop right now, just so I know what it is...
Title: Re: Maneuvering thrusters.
Post by: Vasudan Admiral on April 04, 2006, 04:44:11 am
Wow that's awesome - great work. :yes:

Now we just need a tiny little thruster plume animation and all is set. ;)

Edit: Just a note, the effect looks better when you use thrusters with half the radius and length of those I posted above.