Turret Tutorial

Got questions about Shipmaker? Get answers here. Please read the stickied topics first!

Moderators: th15, Moderators

Post Reply
User avatar
Zalausai
The Tutorialist
The Tutorialist
Posts: 939
Joined: Tue Feb 12, 2013 11:42 am
Location: Looking for angels in the Maze of the Dead.

Turret Tutorial

Post by Zalausai »

Turret Tutorial
This tutorial is intended to teach someone new (newbie = you) how to make a functioning turret.

So, you have this ship. (It looks like crap, I know, this is only a demonstration)
Spoiler!
SMscreen08.png
SMscreen08.png (2.19 KiB) Viewed 12793 times
You already made your big turret shape (sections, guns, and stuff). They are all attached to the blue section.

This blue section will be your driver. It is encouraged to use a round section as the driver, because it gives much greater control over your rotations.
The point that a section rotates around is where the parenting arrow points to in in the shipmaker. *Press "p" to hide or show parenting lines)

That's fine the way it is, now comes the part that is a little tricky. The dummy gun.
The dummy gun is an extra weapon with the sole purpose or guiding a turret.

This is how you make one.
Select the section that the driver section (blue) is parented to (the green one, that's why it's green).
With it selected, place a weapon of your choice on it. It will therefore be parented to the section that comes just before the driver itself in the parenting tree.

It has been placed with the parenting line still shown. The other weapons have also been moved to show their parenting lines.
All images have been magnified for clarity.
Spoiler!
SMscreen09.png
Now, select the blue section (the driver of the turret) and mover the mouse pointer over the "dummy gun". Right-click the "dummy gun" and select "set driver" from the menu that appears (It's near the center of all the options). A yellow-orange arrow will appear going from the driving weapon to the section.

The "dummy gun" is still a functioning weapon though. You will want to make it hidden and not fire. (You only want the turret to be firing anyway, right?) Select the "dummy gun" and go to the "Edit" tab in the upper left of the shipmaker. Set the weapon's "alpha" property to 0 (zero). This will make it invisible, but it still shoots, so now it must be disabled. Click the "ED2" tab just under the "edit" tab to open more options and parameters. Near the middle of the options you will see this.
Spoiler!
Turret Tutorial 1.jpg
Select the "Shooting: Enabled" option and set it to "Disabled. This will stop the dummy gun from firing.
Now, move the "dummy gun" over the center of the turret's driver (blue section). This will ensure that the "dummy gun" faces in the same direction at the same time as the turret itself. (It's more accurate this way)

The turret will now function correctly, but all the weapons will not fire together. If that's fine with you, that's all you need. If you want to get them to fire together, then continue.

Note: If the "dummy gun" is parented to the driving section or any of its children sections, it will not function correctly.


Synchronizing your turret's weapons.
With one of your turret's weapons selected, highlight the "dummy gun". Right-click it and select "set link". If it has been done correctly, a red arrow going from the "dummy gun" to the weapon that it will guide will appear. Repeat this for all of the weapons on the turret. Although the "dummy gun" does not fire, this just means that no projectile is generated. It still tries to fire, and that is why the linked weapons all fire when it "fires". They are linked to it, so they turn when it turns and fire when it "fires". The maximum turning (arc range) of the "dummy gun" will replace theirs.
If it points the wrong way, right-click the weapon that it is going to and select "clear link".

Here is an example that has been done correctly. (The "dummy gun" has been colored green just like the section that it is parented to and left visible.)
The yellow-orange driver arrow is really small, because the "dummy gun" is placed very close the the center of the section.
Spoiler!
SMscreen013.png
See how the front of the ship is turned, that is the turret functioning correctly. (The "dummy gun" is left visible in this image)
Spoiler!
Turret Tutorial Ship.jpg
Advanced Techniques (Articulated Robot Arms)
Once you have learned how to set up a single turret on your own, you can try this technique.
You can link up several turrets together along different shapes in order to get parts of a ship to behave special ways, such as reaching out and firing a laser, making faces, or whatever your imagination and ingenuity can handle.

So I have added a large robotic arm to the test ship. (It's ugly as hell, but color coded for your convenience)
Spoiler!
SMscreen020.png
As in the previous tutorial, there are rounded sections to control the points of rotation. You can bury these on your own ships. It's best to "send to bottom" on each one, so it can be selected easily. The shipmaker selected the deepest buried section when hovering the mouse pointer over overlapping sections.

In the next step, "dummy guns" have been added to each normal section coming before a round one. Note that two have been added to the last normal section before the round sections, because there are two round sections attached to it.
Spoiler!
SMscreen015.png
In the next step, the round sections have been set to be driven (remember "set driver?") by the turrets that come before them in the section line. This way, it will behave correctly. Down worry about a section set up to be a turret having a previous section also set up to be a turret. It will function properly as long as each particular "dummy gun" is set up to "set driver" on the section that comes after it. In this case, those are the round sections.
Spoiler!
SMscreen019.png
Now, for accuracy, the "dummy guns" have been moved over each section that they are driving. They are still parented to the previous sections, so they are just floating over the round sections (They are supposed to be invisible anyway, right? So it doesn't really matter). Their "angle" parameter is also set to a number so that they face straight ahead (taking the angle of the arm into account for this). The sections in this particular arm are set to 30, so the "dummy guns" all have their angles set to 30 for now.
Spoiler!
SMscreen018.png
Now comes the tricky part, articulating the thing and getting it to work like an actual arm. Each "dummy gun" will be set up individually and referred to by the colored section that they are placed over.

We'll start with the "shoulder" round section (the red one).
When this "dummy gun" acquires a target, the arm will be rotated to where it faces. Assuming that it is supposed to attack things in the front of the ship, the arm will be straight up and down (blue straight section. See why this is color coded yet?). For it to be able to follow a target properly, it will need a little extra arc range. The weapon is at a 30 degree angle right now and when facing the front of the ship, it will be at a 0 degree angle. It will need at least a 30 degree arc range to compensate for this, but it should be given a little extra range in case the target moves towards the other side of the ship, so a 45 degree arc range will give it a little extra reach.

Having an arm just sticking straight up and down looks stupid though. To make the arm come forward a little more, we'll need to counterbalance the "dummy gun". The arm will turn further for if the "dummy gun" is set at an angle farther from the front of the ship. So instead of 30 degrees, it can be set to 40. And the 45 degree arch range from earlier can be increased by the same amount to compensate (55 degrees). That's it for the red driver section.

The next section is the "elbow" round sections (the orange one). It will be directly affected by the red one at the "shoulder". When it acquires a target, the orange "dummy gun" will automatically be moved to face the front of the ship, so the angle of the weapon doesn't really need to be changed here. The weapon is on the "hand", so the elbow will be one of the main ways that aims it. It is easier to just treat the "elbow" as you would a normal gun, giving it the desired arc range that you want. Don't make it too high or it'll ruin the look that we're going for. A 45 degree arc range will be a fair range of motion for this part.

Next is the "wrist" round section (the yellow one). This part can function like a normal turret does. The "elbow" will generally point it in the right direction, so the angle of this one doesn't really need to change either. You can set the arc range to whatever you'd like, but remember that the higher it is, the more unrealistic that it will look. A fair "wrist" arc range will be 45 degrees. This will mean that combined with the "elbow", it can bend and reach at 90 degree angles like a realistic hand can. That is it for this part.

The final part is the more difficult one, the "claw". (The green round sections)
The objective is to get the "claw" to open when facing something. The other parts will make sure that it faces a target, so that's taken care of. To open it, the round sections will have to rotate away from each other. This means, that to counterbalance this, the "dummy guns" will have to be facing more towards each other than they are right now. That way, when they target something, they will rotate towards the target. This will cause the green round sections to rotate in opposite directions, thus opening the "claw". Currently, they are set at 30 degree angles each. To get them to face more towards each other, just change the angles by opposite amounts. The "dummy gun" on the upper left section can have its angle decreased by 30 degrees, so it faces more towards the center. At the other side of the "claw", the lower right "dummy gun" can have its angle increased by 30 degrees to face more towards the center. Their new angles will be 0 and 60, respectively. This will make the "claw" open by 60 degrees (30 + 30). You will also want to give these "dummy guns" some extra arc range beyond the amount that they were rotated (30 degrees), so giving them a 45 degree arc range will be fair.

As a final measure to make sure that it has a good effect, you will want to put a weapon of your choice parented to the "palm" (the red section). Don't forget that they all started at 30 degrees, so set that weapon to that amount as well so it points straight. It would also help to link it to the "wrist". Set it up so that the red arrow points from the "wrist's" "dummy gun" to the weapon that you placed.

Here is the finished example. A pulse beam is used. The red section has been darkened so you can see the link arrow.
Spoiler!
SMscreen021.png
Here is the ship in the battlefield test.
Spoiler!
BFscreen05.jpg
Advanced Techniques (Snake Tails)
Once you have learned how to set up turrets on your own, you may notice that they sort of "drag" along as the ship turns. This can be exploited to create interesting tails and similar effects that depend on a ship's movement.
So here is the "snake ship". (Shut up, it's beautiful)
Spoiler!
SMscreen027.png
In the next step, "dummy guns" have been added to each section (blue) that comes before a round section (red). One section is hidden for this screenshot. Basically, it is like the robotic arm tutorial, but it is not intended to detect any enemies. Set the range of all of the "dummy guns" to a low number. If they detect an enemy, the tail will go completely straight when the "snake" faces and enemy. Each "digit" of the tail will also only bend a number of degrees equal to its "dummy gun's" arc range. Remember this.
Spoiler!
SMscreen028.png
They are then set up to drive the round sections that come after the section that they are parented to. This will make them "drag" behind the ship in a sequence. The gracefulness of the "tail" is dependend on the "dummy guns" turning statistic. The more below the ship's turning statistic that the "dummy guns" are, the greater the appearance of the "dragging" effect. Remember that too.
Spoiler!
SMscreen030.png
Finally, they are placed over the center of the driver arrow to hide it. (And it looks nice too)
Spoiler!
SMscreen031.png
Here is the "snake" ship in action as it is turning. The turning rate of the ship is 1 point higher than that of the "dummy guns" in the tail, so the bend is fairly drastic for this example.
Spoiler!
BFscreen01.jpg
Attachments
Tutorial Snake Ship.sb4
Load in shipmaker and click "save sb4 and shp" to play with it in the game.
(4.57 KiB) Downloaded 655 times
Turret Tutorial Ship.sb4
Load in shipmaker and click "save sb4 and shp" to play with it in the game.
(8.59 KiB) Downloaded 655 times
Last edited by Zalausai on Sat Apr 06, 2013 10:47 am, edited 6 times in total.
Has written a series of tutorials for the newbies
Zalausai's Tutorial Index

Created: Elements of Discord, Heaven's Grace, and Hell's Last Battalion.

I stop in from time to time to check in on the community. Though I don't spend much time with shipmaker anymore.
Proud parent since: 8/15/2013 (Baby Boy)

Good shipbuilders never die . . . they just fade away.
User avatar
Necrontyr1998
Rear Admiral
Rear Admiral
Posts: 972
Joined: Fri Jul 27, 2012 3:30 am

Re: Turret Tutorial

Post by Necrontyr1998 »

Wow, nice going zal. Even I can understand it (and that's saying something).
Deus Est Mechanicus

Owner of 'The Novian Empire', a Delphinius Gulf Wars faction.
Fleet Version 1.8 is finally available for download!
viewtopic.php?f=70&t=7081
User avatar
calvin1211
Commodore
Commodore
Posts: 720
Joined: Wed Apr 07, 2010 7:12 pm

Re: Turret Tutorial

Post by calvin1211 »

Don't forget the articulated tail tutorial!
User avatar
Zalausai
The Tutorialist
The Tutorialist
Posts: 939
Joined: Tue Feb 12, 2013 11:42 am
Location: Looking for angels in the Maze of the Dead.

Re: Turret Tutorial

Post by Zalausai »

calvin1211 wrote:Don't forget the articulated tail tutorial!
I classify that as moving sections. I'll put it on the list of planned tutorials (advanced moving sections: tails and tentacles) to do.
Has written a series of tutorials for the newbies
Zalausai's Tutorial Index

Created: Elements of Discord, Heaven's Grace, and Hell's Last Battalion.

I stop in from time to time to check in on the community. Though I don't spend much time with shipmaker anymore.
Proud parent since: 8/15/2013 (Baby Boy)

Good shipbuilders never die . . . they just fade away.
User avatar
Zalausai
The Tutorialist
The Tutorialist
Posts: 939
Joined: Tue Feb 12, 2013 11:42 am
Location: Looking for angels in the Maze of the Dead.

Re: Turret Tutorial

Post by Zalausai »

The articulated arm section of this tutorial is complete. However I cannot guarantee its quality, I did the best I could explaining this complex technique as simply as possible.
Has written a series of tutorials for the newbies
Zalausai's Tutorial Index

Created: Elements of Discord, Heaven's Grace, and Hell's Last Battalion.

I stop in from time to time to check in on the community. Though I don't spend much time with shipmaker anymore.
Proud parent since: 8/15/2013 (Baby Boy)

Good shipbuilders never die . . . they just fade away.
STARSTRUCK
Moderator
Posts: 342
Joined: Wed Mar 03, 2010 3:46 pm
Location: sent milady ;)

Re: Turret Tutorial

Post by STARSTRUCK »

The bit about the arm's "claw" is actually fairly ingenious and I must admit I've never thought of it like that. GJ on the tutorial.

If you need something else to do with turrets, you could write a tutorial on those section-based drones that follow their target. Could be interesting.
User avatar
Zalausai
The Tutorialist
The Tutorialist
Posts: 939
Joined: Tue Feb 12, 2013 11:42 am
Location: Looking for angels in the Maze of the Dead.

Re: Turret Tutorial

Post by Zalausai »

May I ask that you point out an example ship. I've never seen that done before, so I'll need a specimen to reverse engineer.
Has written a series of tutorials for the newbies
Zalausai's Tutorial Index

Created: Elements of Discord, Heaven's Grace, and Hell's Last Battalion.

I stop in from time to time to check in on the community. Though I don't spend much time with shipmaker anymore.
Proud parent since: 8/15/2013 (Baby Boy)

Good shipbuilders never die . . . they just fade away.
User avatar
seaheroe
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 22
Joined: Wed Mar 13, 2013 11:46 pm
Location: Inside a black hole

Re: Turret Tutorial

Post by seaheroe »

Nice thing about the snake thingy!!
Something awesome is hiding in there!!
Spoiler!
NOPE
User avatar
Ristyo
Captain
Captain
Posts: 263
Joined: Wed Aug 14, 2013 5:24 pm
Location: Indonesia

Re: Turret Tutorial

Post by Ristyo »

Sorry for necro, but could you post a download for the robotic arm tutorial ship?
The Comerlian Family


Dammit, didn't realize Starsector is really hard.
User avatar
Zalausai
The Tutorialist
The Tutorialist
Posts: 939
Joined: Tue Feb 12, 2013 11:42 am
Location: Looking for angels in the Maze of the Dead.

Re: Turret Tutorial

Post by Zalausai »

That ship was lost as it was overwritten. However, the FS 01 Oblivion on page 25 of my ships page uses articulated arms.
viewtopic.php?f=2&t=6959&start=360

The "Darkness Ogre 2" uses them nearly exactly as they appear in the tutorial. It appears on page 12 (bottom of the page).
viewtopic.php?f=2&t=6959&start=150
Has written a series of tutorials for the newbies
Zalausai's Tutorial Index

Created: Elements of Discord, Heaven's Grace, and Hell's Last Battalion.

I stop in from time to time to check in on the community. Though I don't spend much time with shipmaker anymore.
Proud parent since: 8/15/2013 (Baby Boy)

Good shipbuilders never die . . . they just fade away.
Post Reply