Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: HotSnoJ on October 31, 2002, 08:00:20 am

Title: multi barraled turrents
Post by: HotSnoJ on October 31, 2002, 08:00:20 am
Yesterday I was browsing the FS1 game VP and I looked at the Gun platforms. I noticed that there are two gun points on it for each turrent. Has this feature been deleted from the FS2 source? Or if not whats so hard about making multi barraled turrents?
Title: multi barraled turrents
Post by: Killfrenzy on October 31, 2002, 08:02:41 am
If I were you, unless you ABSOLUTELY NEED them, avoid barrelled turrets like the plague!
Title: multi barraled turrents
Post by: Bobboau on October 31, 2002, 11:07:57 am
Quote
If I were you, unless you ABSOLUTELY NEED them, avoid barrelled turrets like the plague!

:wtf: why, there cool

there isn't anything hard about makeing rotateing turrets (<-note no N), simply make the barel a child of the base and set it as the physical parent
Title: multi barraled turrents
Post by: Taristin on October 31, 2002, 02:08:07 pm
Why avoid them? I made a ship with 4 of them, works perfectly in game, and each one has 3 firing points... I just wish all of the firing points would work in game *looks at bob and hints "source"*
Title: multi barraled turrents
Post by: EdrickV on October 31, 2002, 02:36:04 pm
As far as I can tell, turrets in FS2 support up to 4 firing points per turret. What I'm not sure is if it'll actually use all of them. It looks like it should, but it's hard to tell if that's working right. (Need to setup a mission to test that better with the Brontos' 4 barrel turret.) And making multi-part turrets isn't that hard. I've done it and made a turret tutorial for TS1/2 users who don't have TrueView. (Though I ought to look through it and revamp it.)
Title: multi barraled turrents
Post by: Raptor on October 31, 2002, 03:39:43 pm
Barrelled turrets will use all the firing point they have, they just fire them in turn.  They cycle though them, fing from one at a time (Unless you have added the 'Swarm: #'  to their table entry, in which case they fire a savlo of shots;)

The only flaw is that they fire slight odd when you do that.

Example:

Three barrelled turret, fire points A, B and C.

Without Swarm #, turret will fire from A, then B, then C, before going back to A.

With Swarm 2 say, the turret will fire A-B, then B-C, then C-A. :doubt:

quote:
--------------------------------------------------------------------------------
By Bobboau
 why, there cool
--------------------------------------------------------------------------------

I totally Agree with you there.  Turrets with barrels extending out of them are the best looking around.;7  To bad they will only work on flat or vertical faces.
Title: multi barraled turrents
Post by: Killfrenzy on October 31, 2002, 03:43:33 pm
I can't get barrelled turrets to work - so I adopt the Shivan idea! :D
Title: multi barraled turrents
Post by: EdrickV on October 31, 2002, 03:44:01 pm
FS2 will only support 4 firing points per turret. Anything higher will cause a crash in game. (Raising the max turret firing points would change that, but I'm not sure what other things it might affect.) And turrets look odd some times when they're firing and turning, they may fire before the turret is fully turned. (Think I recall a rotation speed thing that might be useful to fix that.)
Title: multi barraled turrents
Post by: EdrickV on October 31, 2002, 03:45:04 pm
Quote
Originally posted by Killfrenzy
I can't get barrelled turrets to work - so I adopt the Shivan idea! :D


*points to his sig* :)
Title: multi barraled turrents
Post by: Killfrenzy on October 31, 2002, 03:50:58 pm
Followed it, and it didn't help........:( I dunno what's going on......not that I actually NEED barrelled turrets anyway......
Title: multi barraled turrents
Post by: EdrickV on October 31, 2002, 04:05:34 pm
Well, if you tell me what it was/wasn't doing and/or send me a model file with the bad turrets, I could probably figure out what went wrong. (I learned turrets the hard way. :) )
Title: multi barraled turrents
Post by: Killfrenzy on October 31, 2002, 04:14:22 pm
1) They rotated strangely (as in the wrong way)

2) Proceeded to shoot backwards

And yes, I'm pretty sure I set the axes and stuff right. Currently I don't have a model with barrelled turrets.
Title: multi barraled turrents
Post by: EdrickV on October 31, 2002, 11:29:28 pm
Quote
Originally posted by Killfrenzy
1) They rotated strangely (as in the wrong way)

2) Proceeded to shoot backwards

And yes, I'm pretty sure I set the axes and stuff right. Currently I don't have a model with barrelled turrets.


1. There are three ways I can think of that turret parts could rotate the wrong way.

     Problem 1: If they start orbiting the ship (in other words actually leaving the ship when shown in game or ModelView32) then it is an axis problem. Every subobject and every subobject group has it's own axis. All the ones for the turret(s) need to be positioned correctly, which means you have to move through the hierarchy checking every axis along the way.
     Problem 2: The model parts are turning in the wrong direction (for instance the barrels are moving side to side instead of up and down) but are not orbiting, then the submodel is set to rotate using the wrong axis in the POF file. Experiment in ModelView32 till they look right. The base should turn around and the barrels should move up/down. (And be aware, ModelView32 can rotate turrets beyond their PoV so it can look wrong but be right. Watch the turrets of a :v: model rotate to see what I mean. :) )
     Problem 3: The barrels are rotating and the base is moving up and down. That means you probably got the associated and rotational submodels assigned backwards. Switch them in ModelView32. The base should be the Associated submodel and the barrels are the Rotational submodel.

2. Firing in the wrong direction? Double check the normals for your firing points. If the turret normally points up, (which is normal) the firing points should point up. (In other words a positive Y value.) Even with correct normals, turrets may fire in odd directions while rotating. That's an odd bug I'm going to see if I can fix with table/POF stuff.
Title: multi barraled turrents
Post by: Vasudan Admiral on November 01, 2002, 04:40:43 am
the turret firing point limit is 4 points for missile turrets and 3 ONLY for laser ones. just look in the weapons editor in fred. the window only will fit 3 laser.
i have tried upping that limit using the source, but it crashed no matter what i tried. :( (and i DID remember to change that window and all the related code. i think i'll leave it untill i actually learn to program.....apparently there is a lot of code that assumes there is only 3 tfps.)

anyway, multi-part turrets are quite easy to do. as Bobboau said:

-you have the turret arm geometry and base in their correct positions.
(i would suggest compiling the parts in a separate cob/scn for simplicity and then add the finished single object to the objects library [ts5 feature-not sure of others])

-gule a local light to the arms as a sibling (don't think this is nesacarry, but it's never caused me problems) and set the axis of the new object group to the bottom of the arms-or wherever the "hinge" would be.

-glue another local light to the base as a sibling and set that object groups axis to the center of the geometry. or the point that the turret is attached to the hull and will rotate around.

-glue the arms object group to the base group as a child and name the object groups accordingly.
hope this helps, but someone correct me if i'm wrong :)                  ([SIZE=0.3]just not tooo painfully plz :D )[/SIZE]
Title: multi barraled turrents
Post by: EdrickV on November 01, 2002, 04:49:31 am
Quote
Originally posted by Vasudan Admiral
the turret firing point limit is 4 points for missile turrets and 3 ONLY for laser ones. just look in the weapons editor in fred. the window only will fit 3 laser.
i have tried upping that limit using the source, but it crashed no matter what i tried. :( (and i DID remember to change that window and all the related code. i think i'll leave it untill i actually learn to program.....apparently there is a lot of code that assumes there is only 3 tfps.)


The turret weapon slots and firing points are two different things. The game, currently, won't use multiple weapons from one turret. It will use up to 4 firing points for lasers and probably missiles. Firing points are cosmetic, they are where the weapon's pof/ani/whatever emits from/starts at. The way the code is right now, (unless someone has changed it and I haven't heard about it) it checks to see if there are any primary weapon banks and if not checks for secondary weapon banks.

Code: [Select]

// Set active weapon for turret
void ai_turret_select_default_weapon(ship_subsys *turret)
{
ship_weapon *twp;

twp = &turret->weapons;

// If a primary weapon is available, select it
if ( twp->num_primary_banks > 0 ) {
turret->system_info->turret_weapon_type = twp->primary_bank_weapons[0];
} else if ( twp->num_secondary_banks > 0 ) {
turret->system_info->turret_weapon_type = twp->secondary_bank_weapons[0];
}
}


Note, it doesn't check for weapons in any other banks then bank 0. That means the extra weapon slots don't do anything, yet.
Title: multi barraled turrents
Post by: Vasudan Admiral on November 01, 2002, 06:29:59 am
:eek2:  hey, you're right, i tried adding 2 more firing points to a watch-dog and they fired fine. trying 6 crashed it tho :D
whish i'd known this before :D
thx,
VA
Title: multi barraled turrents
Post by: Fury on November 01, 2002, 11:43:50 am
Quote
Originally posted by EdrickV
Note, it doesn't check for weapons in any other banks then bank 0. That means the extra weapon slots don't do anything, yet.


That's what I thought. I hope you (read: SCP) can eventually change that.

It would be a nice feature if turret could use the best available weapon for current target.

Although second feature probably would need a ****load of new code.
Title: multi barraled turrents
Post by: EdrickV on November 01, 2002, 06:12:26 pm
There is some code in the source to handle multiple weapons, but it's made for ships with regular weapons rather then turrets so might be useful but would need some tweaking. And it's beyond my ability right now because I can't compile the thing.
Title: multi barraled turrents
Post by: EdrickV on November 03, 2002, 03:50:22 am
Quote
Originally posted by Vasudan Admiral
anyway, multi-part turrets are quite easy to do. as Bobboau said:

-you have the turret arm geometry and base in their correct positions.
(i would suggest compiling the parts in a separate cob/scn for simplicity and then add the finished single object to the objects library [ts5 feature-not sure of others])

-gule a local light to the arms as a sibling (don't think this is nesacarry, but it's never caused me problems) and set the axis of the new object group to the bottom of the arms-or wherever the "hinge" would be.

-glue another local light to the base as a sibling and set that object groups axis to the center of the geometry. or the point that the turret is attached to the hull and will rotate around.

-glue the arms object group to the base group as a child and name the object groups accordingly.
hope this helps, but someone correct me if i'm wrong :)                  ([SIZE=0.3]just not tooo painfully plz :D )[/SIZE]


From my experiences with turrets, (and very recent experiments) I have found out the following:

1. You have to have a light grouped to the turret objects. I think the light belongs on the barrel object for multi-part turrets. (That's the way I make mine and it works.) It might work on the base too, but I can't say if it will for sure.

2. You don't need a light attached to the base. The local light's main functions are to keep TrueSpace from mucking up the geometry and to tell PCS where parts of a model end. Imagine the hierarchy as a family tree, with the main hull being the trunk.

3. Gluing the arms to the base means clicking them in the other way around. You click the base, click the glue as child tool, and click the arms.

4. For users of TS1/2, don't worry about the turret names becomming "turret,1" instead of "turret-01", PCS should still fill the basic turret data in for the submodels and you can rename the subobjects in PCS/ModelView32 later.
Title: multi barraled turrents
Post by: HotSnoJ on November 03, 2002, 07:04:57 am
Quote
3. Gluing the arms to the base means clicking them in the other way around. You click the base, click the glue as child tool, and click the arms.


Thanx! That's going to help allot with my glueing.
Title: multi barraled turrents
Post by: Killfrenzy on November 03, 2002, 02:59:12 pm
Alternatively just use trueView! :D
Title: multi barraled turrents
Post by: Anaz on November 03, 2002, 03:07:30 pm
Quote
Originally posted by Killfrenzy
Alternatively just use trueView! :D


bah! you beat me to it...
Title: multi barraled turrents
Post by: IceFire on November 03, 2002, 04:38:28 pm
Ahem....its 'turrets' not 'turrents'.  Sorry, had to...its part of my crusade across the internet to prevent people from saying turrent... :D
Title: multi barraled turrents
Post by: Killfrenzy on November 03, 2002, 04:44:29 pm
Is that to avoid a 'turrent' of spelling mistakes? :D:D
Title: multi barraled turrents
Post by: HotSnoJ on November 04, 2002, 05:02:26 am
Quote
Originally posted by IceFire
Ahem....its 'turrets' not 'turrents'.  Sorry, had to...its part of my crusade across the internet to prevent people from saying turrent... :D


Thanx for the spelling correction.