New range of turrets

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Post Reply
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

New range of turrets

Post by Shipbuilder »

As I understand it you can model your own turrets to replace the standard turret in Oolite. Can anyone give me some advice on how this is done specifically with regard to how this is dealt with within the config files.

I assume that I refer to the turret somehow in the sub entity entry in the shipdata.plist and include a .dat model in the models folder and textures file in the texture folder.

Once in have got one working I am thinking about producing a series of different turret models that people can download for use on their own ships. Is this something people would be interested in ?
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: New range of turrets

Post by Pleb »

Yes I have wondered about turrets for a long time, as would be good to fix to a station for defensive purposes. I don't want to hijack your thread shipbuilder, but as you make ships for Oolite perhaps you know whether a turret has to be modeled onto a ship/station, or whether it can be added via the shipdata.plist file?
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: New range of turrets

Post by Shipbuilder »

The standard Oolite turrets, and therefore I assume also any oxp developed turret, are added as sub entities in the shipdata.plist so do not need to be modelled on to either a station or ship.

For example you can have a ship with no turrets and then by adding an additional term in the shipdata.plist add a turret.
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: New range of turrets

Post by Smivs »

...and you can add turrets to the most unlikely ships :roll:
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: New range of turrets

Post by Shipbuilder »

My idea is to develop a series of turrets for various uses so for example there could be functional and industrial looking, Slimline and sleek, different sizes for smaller ships, larger ships and as Pleb suggests stations etc.

Also various textures could be made available or can be edited so that the texture of the turret follows the texture of the ship it is installed on. At present, as far as I am aware, we are stuck with one model with a single texture which looks somewhat of a bolt-on on many models.
Last edited by Shipbuilder on Fri Jul 13, 2012 7:44 pm, edited 1 time in total.
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: New range of turrets

Post by Shipbuilder »

Smivs wrote:
...and you can add turrets to the most unlikely ships :roll:
Smivs - Your WonderWorm really does look like an aggressive little beast :lol:
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2475
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: New range of turrets

Post by Griff »

Looks like i've been ninja'd but i might as well go ahead and post anyway

Yes, they're just like any other subent object that you can add to a ship in oolite except there's an extra line that you put into their entry in the shipdata.plist to make them act like turrets, that command is

Code: Select all

	setup_actions = ("initialiseTurret");	
When you'e making the model just position them like any other ship (but make sure that the 0,0,0 origin is in the centre of the 'ball' part of your turret as they will rotate around this point in game)

here's what the turret object looks like in my prototype boa oxp

Code: Select all

"griff_prototype_boa_turret_subent" = 
	{
	ai_type = "nullAI.plist";
	model = "griff_prototype_boa_normal_turret.dat"; 
	name = "Griff Prototype Boa";
	roles = "griff_boa_turret";
	weapon_energy = 7.0;
	smooth = "true";
	thrust = 1.0;
	setup_actions = ("initialiseTurret");	
	};

and here's the subentites part that places copies of this turret onto the main hull of the ship

Code: Select all

	subentities = (
					"griff_prototype_boa_turret_subent  17.5379  6.6338  16.8643 1 0 -1 0",
					"griff_prototype_boa_turret_subent -17.97   -0.0181   1.2819 1 0 1 0",
					"griff_prototype_boa_turret_subent -0.0697   29.0156 -40.815  0 0 0.7071 0.7071",
					"griff_prototype_boa_turret_subent -0.0697   19.993  -50.336  0 0 1 0"					
				   );
						/*  Turret order in the subentity list is as follows: 
							Top - Turret Facing Up, 
							Rear - Turret Facing Backwards  
							Starboard Side - Turret Facing Right	 
							Port Side  - Turret Facing Left */	

The first 3 numbers after "griff_prototype_boa_turret_subent" in each line are the X, Y and Z coords for the turret, your turret will be placed with it's own 0,0,0 point at this position in your main model - you can easily find what coords you want your turret at in your 3d modeler by placing a vertex where you'd like the turret to be and writing out what it's position is, the next 4 numbers are the quaternion http://wiki.alioth.net/index.php/Quaternion that rotates the turret so it's pointing in the correct direction (vital as you'll model your turret pointing down the Z axis in your 3d program), these can be tricky to work out but you can use the examples above if you just want up, right and left facing turrets
Last edited by Griff on Fri Jun 22, 2012 12:24 pm, edited 3 times in total.
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: New range of turrets

Post by Shipbuilder »

Thanks Griff for your detailed response and example .plist.

I always find it easier to understand in detail what someone is discussing if you have an actual example of how it is done so this will be a great help.
:D
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: New range of turrets

Post by Pleb »

Ah okay this has been most helpful, thanks to Griff and Shipbuilder for that. But getting back to what Shipbuilder asked at the beginning a think a new range of turrets would be good to have and they could be made available for people looking to put turrets on their ships/stations.

BTW - that WonderWorm looks like a challenge to shoot down...really small and firing that many turrets at the player would surely result in instant death?! :lol:
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: New range of turrets

Post by cim »

Griff wrote:
Yes, they're just like any other subent object that you can add to a ship in oolite except there's an extra line that you put into their entry in the shipdata.plist to make them act like turrets, that command is

Code: Select all

	setup_actions = ("initialiseTurret");	
The more modern approach is to put

Code: Select all

  type = "ball_turret"
into the subentity definition, rather than to use setup_actions. The subentity definitions are in a different (and more flexible) format, too.

See Shipdata.plist docs. So

Code: Select all

"griff_prototype_boa_turret_subent -0.0697   19.993  -50.336  0 0 1 0"
becomes

Code: Select all

{type="ball_turret";
subentity_key = "griff_prototype_boa_turret_subent";
position = "-0.0697   19.993  -50.336";
orientation="0 0 1 0";}
Using the new-style subentity definition, you can also adjust the fire rate, range, and per-shot damage of the turret, within limits.
User avatar
SandJ
---- E L I T E ----
---- E L I T E ----
Posts: 1048
Joined: Fri Nov 26, 2010 9:08 pm
Location: Help! I'm stranded down here on Earth!

Re: New range of turrets

Post by SandJ »

Griff wrote:
The first 3 numbers after "griff_prototype_boa_turret_subent" in each line are the X, Y and Z coords for the turret, your turret will be placed with it's own 0,0,0 point at this position in your main model - you can easily find what coords you want your turret at in your 3d modeler by placing a vertex where you'd like the turret to be and writing out what it's position is
And if, like me, you don't want to use 3D modelling software to workout the locations, an alternative - and probably far more time consuming! - way is to put a different coloured flasher at each of the custom_views view_position locations plus the weapon_position_* locations. I found that helpful in:
- quickly understanding the correct syntax for the shipdata-overrides.plist file;
- where different positions are on the ship;
- where the ship's view positions actually are!;
- fiddling with the preferred turret positions without obscuring the ship (because flashers go off as well as on).

When happy with the positions, convert the flashers to turrets, using your now-developed understanding of view orientation and weapon-facings.

And you'll probably find yourself adding a Scoop View to your custom views while you're in there too.

A Python covered in multi-coloured turrets (there may be the odd syntax error in the following example):

Code: Select all

{
	"python-player" =
	{
		aft_eject_position = "0.0 15.5 -50.0";
		scoop_position = "0.0 -15.0 -21.5";
		view_position_aft = "0.0 15.0 -49.5";
		view_position_forward = "0.0 10.0 31.5";
		view_position_port = "-16.0 4.0 15.2";
		view_position_starboard = "16.0 4.0 15.2";
		weapon_position_aft = "0.0 10 -55.0";
		weapon_position_forward = "0.0 0.0 55.0";
		weapon_position_port = "-26.67 0.0 4.33";
		weapon_position_starboard = "26.67 0.0 4.33";
		custom_views =
		(
			{
				view_description = "Scoop View";
				view_orientation = "1.0 0.0 0.0 0.0";
				view_position = "0.0 -15.0 -21.5";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Rear View - Distant";
				view_orientation = "1.0 0.0 0.0 0.0";
				view_position = "0.0 30.0 -800.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Rear View - VERY Distant";
				view_orientation = "1.0 0.0 0.0 0.0";
				view_position = "0.0 30.0 -5000.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Distant Right View";
				view_orientation = "0.7071 0.0 0.7071 0.0";
				view_position = "1200.0 30.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "VERY Distant Right View";
				view_orientation = "0.7071 0.0 0.7071 0.0";
				view_position = "5000.0 30.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front View";
				view_orientation = "0.0 0.0 1.0 0.0";
				view_position = "0.0 30.0 200.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Left View";
				view_orientation = "0.7071 0.0 -0.7071 0.0";
				view_position = "-200.0 30.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Top View";
				view_orientation = "-0.7071 0.7071 0.0 0.0";
				view_position = "0.0 230.0 -18.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Bottom View";
				view_orientation = "0.0 0.0 0.7071 0.7071";
				view_position = "0.0 -230.0 -18.0";
				weapon_facing = "FORWARD";
			}
		);
		subentities = (
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-M"; position = (   0.0,   21.0,  -16.0); orientation = (   1     , 0 ,  0     , 0); fire_rate = 0.25;}, // Magenta, top, forward
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-M"; position = (   0.0,   21.0,  -16.0); orientation = (   0     , 0 ,  1     , 0); fire_rate = 0.25;}, // Magenta, top, rear
                //  {type = ball_turret;
                //   subentity_key = "SiR-Turret-C"; position = (   0.0,    0.0,   50.0); orientation = (   1     , 0 ,  0     , 0); fire_rate = 0.25;}, // Cyan, nose
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-C"; position = ( -40.0,    0.0,  -25.0); orientation = (   0.7071, 0 ,  0.7071, 0); fire_rate = 0.25;}, // Cyan, left
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-C"; position = (  40.0,    0.0,  -25.0); orientation = (   0.7071, 0 , -0.7071, 0); fire_rate = 0.25;}, // Cyan, right
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-Y"; position = (   0.0,  -21.0,  -21.5); orientation = (   1     , 0 ,  0     , 0); fire_rate = 0.25;}, // Yellow, belly, front
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-Y"; position = (   0.0,  -21.0,  -21.5); orientation = (   0     , 0 ,  1     , 0); fire_rate = 0.25;}, // Yellow, belly, rear
		// repeated, to duplicate them
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-W"; position = (   0.0,   21.0,  -16.0); orientation = (   1     , 0 ,  0     , 0); fire_rate = 0.3;}, // Magenta, top, forward
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-W"; position = (   0.0,   21.0,  -16.0); orientation = (   0     , 0 ,  1     , 0); fire_rate = 0.3;}, // Magenta, top, rear
                //  {type = ball_turret;
                //   subentity_key = "SiR-Turret-C"; position = (   0.0,    0.0,   50.0); orientation = (   1     , 0 ,  0     , 0); fire_rate = 0.3;}, // Cyan, nose
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-W"; position = ( -40.0,    0.0,  -25.0); orientation = (   0.7071, 0 ,  0.7071, 0); fire_rate = 0.3;}, // Cyan, left
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-W"; position = (  40.0,    0.0,  -25.0); orientation = (   0.7071, 0 , -0.7071, 0); fire_rate = 0.3;}, // Cyan, right
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-W"; position = (   0.0,  -21.0,  -21.5); orientation = (   1     , 0 ,  0     , 0); fire_rate = 0.3;}, // Yellow, belly, front
                    {type = ball_turret;
                     subentity_key = "SiR-Turret-W"; position = (   0.0,  -21.0,  -21.5); orientation = (   0     , 0 ,  1     , 0); fire_rate = 0.3;}, // Yellow, belly, rear
                    {
		        type = flasher;
		        size = 4;
                        color = redColor;
		        phase = 0.0;
		        position = (-40.0,  0.0, -25.0);
		    },
		    {type = flasher;
		        size = 4;
                        color = greenColor;
		        phase = 0.0;
		        position = (40.0, 0.0, -25.0);
		    }
		);
	};
	"SiR-Turret-C" = {
                laser_color = "cyanColor";
		model = "oolite-ball-turret.dat";
		roles = "ballturret SiR-Turret-C";
		setup_actions = ("initialiseTurret");
                thrust = 0.5;
		weapon_energy = 300;
		weapon_range = 30000;
		frangible = false;
		energy_recharge_rate = 2;
		max_energy = 2000;
        };

        "SiR-Turret-Y" = {
            frangible = no;
            ai_type = "nullAI.plist";
            weapon_range = 30;
            laser_color = "yellowColor";
            model = "oolite-ball-turret.dat";
            roles = "ballturret SiR-Turret-Y";
            setup_actions = ("initialiseTurret");
            thrust = 0.5;
            weapon_energy = 3000;
        };

        "SiR-Turret-M" = {
            frangible = no;
            ai_type = "nullAI.plist";
            weapon_range = 1;
            laser_color = "magentaColor";
            model = "oolite-ball-turret.dat";
            roles = "ballturret SiR-Turret-M";
            setup_actions = ("initialiseTurret");
            thrust = 0.5;
            energy_recharge_rate = 2;
            max_energy = 2000;
            weapon_energy = 3000;
        };

        "SiR-Turret-W" = {
            frangible = no;
            ai_type = "nullAI.plist";
            weapon_range = 1;
            laser_color = "whiteColor";
            model = "oolite-ball-turret.dat";
            roles = "ballturret SiR-Turret-W";
            setup_actions = ("initialiseTurret");
            thrust = 0.5;
            energy_recharge_rate = 2;
            max_energy = 2000;
            weapon_energy = 3000;
        };
}
Flying a Cobra Mk I Cobbie 3 with nothing but Explorers Club.OXP and a beam laser 4 proper lasers for company :D
Dropbox referral link 2GB of free space online + 500 Mb for the referral: good for securing work-in-progress.
User avatar
SandJ
---- E L I T E ----
---- E L I T E ----
Posts: 1048
Joined: Fri Nov 26, 2010 9:08 pm
Location: Help! I'm stranded down here on Earth!

Re: New range of turrets

Post by SandJ »

Shipbuilder wrote:
I am thinking about producing a series of different turret models that people can download for use on their own ships. Is this something people would be interested in ?
Yes, please.
Flying a Cobra Mk I Cobbie 3 with nothing but Explorers Club.OXP and a beam laser 4 proper lasers for company :D
Dropbox referral link 2GB of free space online + 500 Mb for the referral: good for securing work-in-progress.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: New range of turrets

Post by Commander McLane »

Just for clarification: there is not really a "standard" turret, because none of the original ships have turrets. The first ships that had turrets were the Behemoth, from Aegidian's equally named OXP, and the Military Station, also from Aegidian (not sure which came earlier).

Many ship designers added turrets to their creations afterwards, and many of them did so by using the model by Aegidian. However, many of them forgot to actually include the model and textures in their ship OXPs, thus their ships only got turrets if the player happened to have Behemoth.oxp installed as well. Because this was a common mistake, at some point it was decided to include Aegidian's ballturret in the Oolite distribution as a courtesy for lazy/confused ship designers.

This doesn't mean that it's the only existing turret, though. In fact, a couple of alternative turret designs have come up over the years, for instance the thargoid turret from Thargorn_Threat.oxp, which is also used (in a magnified design) on the Thargoid Carrier. There's also the turrets for Seedy Space Bars and Black Monk Monasteries, to name a few.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: New range of turrets

Post by Eric Walch »

Shipbuilder wrote:
as far as I am aware, we are stuck with one model with a single texture which looks somewhat of a bolt-on on many models.
No, there are more variations available. See for example the seedy space bar in RandomHits. The thrust is also an important parameter for turrets. For turrets, this shipkey is misused to set a rotation speed. I remember the turrets in the seedy space bar being quite jumpy. By lowering the original high thrust values from Little bear, their movement became much more realistic.
Turrets might take two subentities: A stationary support part and the rotating turret part. :D


And for modelling on a ship:
In my experience it is easier to start with them as normal non-turret subentities. That way, they don't rotate and it is easier to evaluate the default position. Fine tuning can be done live by targeting the ship and than typing in the console:

Code: Select all

SP.target.subEntities[i].position = [x,y,z]
SP.target.subEntities[i].orientation = [w,x,y,z]
Than play with position/orientation till satisfied. Only than turn them into rotation turrets.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: New range of turrets

Post by Commander McLane »

Eric Walch wrote:

Code: Select all

PS.target.subEntities[i].position = [x,y,z]
PS.target.subEntities[i].orientation = [w,x,y,z]
Fixed that for you. :wink:
Post Reply