Laser art, turrets and zen

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

Moderators: winston, another_commander

User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Laser art, turrets and zen

Post by Simon B »

Considering this discussion the matter of hacking lasers has come up.
Commander McLean wrote:
"Simon B wrote:
... It is also not possible to have any laser weapon type other than thargoid_laser?

Well, Oolite knows five laser types: WEAPON_PULSE_LASER, WEAPON_BEAM_LASER, WEAPON_MILITARY_LASER, WEAPON_MINING_LASER, and WEAPON_THARGOID_LASER. You can chose any of them, but the former four will fire only straightforward. Only the last follows its target (= is turreted). According to the information from Eric and Thargoid it fires from the centre of the entity it is defined for.
I'm sorry - let me be clear.
I want to make a subentity like this:

Code: Select all

	<key>laserturret</key>
	<dict>
		<key>ai_type</key>
		<string>nullAI.plist</string>
		<key>laser_color</key>
		<string>magentaColor</string>
		<key>model</key>
		<string>hvy-cannon.dat</string>
		<key>name</key>
		<string>Turret Cannon</string>
		<key>fwd_weapon_type</key>
		<string>WEAPON_MILITARY_LASER</string>
		<key>roles</key>
		<string>laserturret</string>
		<key>setup_actions</key>
		<array>
			<string>initialiseTurret</string>
		</array>
		<key>thrust</key>
		<real>1</real>
	</dict>
I think it will be useful to distinguish between weapons which are in subentities which become turrets and weapons with a wide arc of fire.

I get from your statement that WEAPON_THARGOID_LASER is coded to always fire from the (0,0,0) coordinate of it's entity (understanding that not all entities are centered on their origin.)
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

laser art part 2

Post by Simon B »

You can't "mix". The five laser types are distinct. If you put (in different sub-entities; works only for NPCs) more than one forward pointing laser on a ship, each of them fires independently of the others. So if you put one pulse laser next to one military laser, you will have one pulse laser and one military laser, and each of them will fire according to its characteristics
What I am talking about is altering what the laser appears to be doing. I am also only talking about NPCs - so I am thinking about what it looks like to the player when an NPC fires a laser.

I can alter the color and the beam strength.
A can put any laser in a subentity.
I can put subentitien in the same location and orientation.

So I can take a beam laser, give it a green color and energy 12.5 ... now, to all appearances, I have a thargoid laser which has a narrow arc of fire (probably a different range and firing rate) which can fire from someplace other than the (0,0,0) coordinate.

Someone could insist: but it is not a thargoid laser. But it's green and being fired by a thargoid, to what extent are you going to stop and analyze?

I could make a subent with a military laser, strength 50. Is this a long range mining laser or a high-strength military one? The target does not really care.

Now put two of these subents in the same place (will an npc shoot itself? I've been too scared to put fwd pointing laser on the aft of the megaship just to see if it will shoot up it's own rings.)


The lasers are:

Code: Select all

		case WEAPON_PLASMA_CANNON :
			weapon_energy =			6.0;
			weapon_recharge_rate =	0.25;
			weaponRange =			5000;
			break;
		case WEAPON_PULSE_LASER :
			weapon_energy =			15.0;
			weapon_recharge_rate =	0.33;
			weaponRange =			12500;
			break;
		case WEAPON_BEAM_LASER :
			weapon_energy =			15.0;
			weapon_recharge_rate =	0.25;
			weaponRange =			15000;
			break;
		case WEAPON_MINING_LASER :
			weapon_energy =			50.0;
			weapon_recharge_rate =	0.5;
			weaponRange =			12500;
			break;
		case WEAPON_THARGOID_LASER :		// omni directional lasers FRIGHTENING!
			weapon_energy =			12.5;
			weapon_recharge_rate =	0.5;
			weaponRange =			17500;
			break;
		case WEAPON_MILITARY_LASER :
			weapon_energy =			23.0;
			weapon_recharge_rate =	0.20;
			weaponRange =			30000;
			break;
		case WEAPON_NONE :
			weapon_energy =			0.0;	// indicating no weapon!
			weapon_recharge_rate =	0.20;	// maximum rate
			weaponRange =			32000;
			break;

Possibilities abound.

A pulse laser and a mining laser have the same range - but the mining laser has a slower recharge. So put them on the same coordinate ond point them both down (0,0,1) say, and you'd get:

t : energy
0.00 : 65
0.33 : 15
0.50 : 50
0.66 : 15
0.99 : 15*
1.00 : 50*
1.32 : 15
1.50 : 50**
1.65 : 15**

notice * and ** are pairs of entries firing very close together.

I see weapon-none has the longest range and the shortest recharge rate.
I'm guessing that I cannot just set it's energy non-zero for an extra advantage?

Anyway, back on track, what I'm looking for with mixing weaponed subents on the same bearing is just the appearance of non-cyclic fire. Different ranges are not really an issue.

Presumably I can also use two laser subents on the same bearing to give the appearance of a single very powerful laser.

Reading carefully - I could probably write a new weapon in the code and recompile ;)
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

The turret defined in the first post does not work - neither does setting the weapon to thargoid-laser.

It still acts like plasma cannon - only, initialising the turret with a laser defined in it just makes the the models behave very wierd.

These models are like those on the turret anaconda and griffs seedy space bars. They have a ball-and-stick model "turret" and a base. The bases are just defined as a single subent that sits there lookinf pretty. Only the guns get initialised as turrets.

However, both the bases and the turrets get displaced from their defined positions, where they hang in space quivvering. Most are displaced in y, but some in z - by around 2-300 meters. This only happens when the subentity has forward weapon type = any kind of laser.


I have not been able to entice it to shoot at me with it's forward guns. Presumably fixed lasers can be mixed with turrets?

I notice it is smart enough to rotate to bring more turrets to bear though. Turrets don't seem to want to fire through the hull - as in, from inside (I stuffed up some locations - those turrets did not fire.)

Anyway, looks like my stick guns are to be plasma cannon for the time being.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

To give the example of the sub-ent plasma turrets and lasers from Aquatics:

Code: Select all

	"aquatics_subEntLaser" = {
		ai_type = "nullAI.plist";
		energy_recharge_rate = 2;
		forward_weapon_type = "WEAPON_THARGOID_LASER";
		laser_color = "yellowColor";
		max_energy = 200;
		model = "aquatics_turret.dat";
		name = "Weapons Platform Laser Mount";
		roles = "aquatics_subEntLaser";
	};

	"aquatics_subEntTurret" = {
		ai_type = "nullAI.plist";
		laser_color = "yellowColor";
		model = "aquatics_turret.dat";
		name = "Weapons Platform Turret Mount";
		roles = "ballturret aquatics_subEntTurret";
		setup_actions = ("initialiseTurret");
		max_flight_pitch = 1;
		max_flight_yaw = 1;
		max_flight_roll = 1;
		thrust = 1;
		weapon_energy = 25;
		energy_recharge_rate = 2;
		max_energy = 200;
	};
These are used for various ships, just because the laser sub-ent uses a Thargoid Laser doesn't mean it has to be a Thargoid ship ;). The laser sub-ent doesn't need to be initialised or anything like that, only the ball (plasma) turret needs that.

In practice they both work well for me, although I didn't particularly bother with the modelling (both are just small pyramid shapes) as that's not my thing really, and I just wanted additional weaponry rather than something pretty to look at. But the Leviathan is a large ship, and the source of the laser/plasma is certainly where I put the turret, rather than the centre of the ship itself.

For completeness here's how they're set up on the Leviathan:

Code: Select all

	"aquatics_platform" = {
		ai_type = "aquatics_platformAI.plist";
		cargo_type = "CARGO_NOT_CARGO";
		frangible = true;
		likely_cargo = 0;
		max_cargo = 0;
		energy_recharge_rate = 3;
		max_energy = 2500;
		max_flight_pitch = 0.05;
		max_flight_roll = 0.05;
		max_flight_speed = 5;
		missiles = 24;
		missile_launch_position = "70.0 0 0";
		missile_role = "EQ_HARDENED_MISSILE";
		model = "aquatics_platform.dat";
		name = "Leviathan System Platform";
		roles = "aquatics_platform aquatics_populator";
		subentities = ( 
			"aquatics_subEntLaser 185.25 38.25 0 1 0 1 0",
			"aquatics_subEntLaser 0 38.25 0 1 0 1 0",
			"aquatics_subEntLaser -185.25 38.25 0 1 0 1 0",
			"aquatics_subEntLaser 185.25 -38.25 0 1 0 -1 0",
			"aquatics_subEntLaser 0 -38.25 0 1 0 -1 0",
			"aquatics_subEntLaser -185.25 -38.25 0 1 0 -1 0",
			"aquatics_subEntLaser 178 0 87.5 -0.7071 0.7071 0 0",
			"aquatics_subEntLaser 70 0 0 -0.7071 0.7071 0 0",
			"aquatics_subEntLaser -178 0 87.5 -0.7071 0.7071 0 0",
			"aquatics_subEntLaser 178 0 -87.5 0.7071 0.7071 0 0",
			"aquatics_subEntLaser -70 0 0 0.7071 0.7071 0 0",
			"aquatics_subEntLaser -178 0 -87.5 0.7071 0.7071 0 0",
			"aquatics_subEntLaser 225 0 0 1 0 0 0",
			"aquatics_subEntLaser -225 0 0 0 0 1 0",
			"aquatics_subEntTurret 185.25 38.25 -52.5 1 0 1 0",
			"aquatics_subEntTurret 185.25 38.25 52.5 1 0 1 0",
			"aquatics_subEntTurret -185.25 38.25 -52.5 1 0 1 0",
			"aquatics_subEntTurret -185.25 38.25 52.5 1 0 1 0",
			"aquatics_subEntTurret 0 50 -42 1 0 1 0",
			"aquatics_subEntTurret 0 50 42 1 0 1 0",
			"aquatics_subEntTurret 185.25 -38.25 -52.5 1 0 -1 0",
			"aquatics_subEntTurret 185.25 -38.25 52.5 1 0 -1 0",
			"aquatics_subEntTurret -185.25 -38.25 -52.5 1 0 -1 0",
			"aquatics_subEntTurret -185.25 -38.25 52.5 1 0 -1 0",
			"aquatics_subEntTurret 0 -50 -42 1 0 -1 0",
			"aquatics_subEntTurret 0 -50 42 1 0 -1 0"
			);
		thrust = 100;
		laser_color = "yellowColor";
		forward_weapon_type = "WEAPON_THARGOID_LASER"; 
		weapon_position_forward = "0.0 0.0 185.0";
		aft_weapon_type = "WEAPON_THARGOID_LASER"; 
		weapon_position_aft = "0.0 0.0 -185.0";  
		script = "aquatics_platform.js";
		scanner_range = 60000;
		scanClass = "CLASS_POLICE";
	};
Note the orientation in the sub-ents as well as their position. This may be part of your problem perhaps? The weapons fire along the Z-axis of the sub-entity, so you need to set the orientation up correctly to aim that Z-axis along the direction you want it to fire relative to the axis of the main entity (if you see what I mean).

It's also not strictly true that things fire independently. The "groups" of weapons fire independently, as in the main entity front laser fires independently from the sub-ent lasers and from the sub-ent turrets. But if you have multiple sub-ent lasers for example, they will all fire together and at the same target (but not necessarily at the same time or target as the main entity weapon).

If you want to see what I mean, install the current version of Aquatics and go pick a fight with a Leviathan platform or use the console to spawn a few Thargoid or pirate ships near one.
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Update - added shaders to the turret subents, and the odd behavior is back.
The misplacement goes away if I comment out the setup actions in the turret model. The issue effects the guns and the base.

The log for the session runs like:

Code: Select all

[dataCache.rebuild.explicitFlush]: Cache explicitly flushed with shift key. Rebuilding from scratch.
[shipData.load.begin]: Loading ship data...
[script.load.world.listAll]: Loaded 13 world scripts: "AS-JSversion" 0.9, "AsteroidStorm" 3.45, "behemoth" 2.5.1, "GalNavy" Build 0139, "hofd" GalNavy Build 118 / HOFD Build 55, "interstellar_help" 1.0, "oolite-cloaking-device" 1.72, "oolite-constrictor-hunt" 1.72, "oolite-nova" 1.72, "oolite-thargoid-plans" 1.72, "oolite-trumbles" 1.72, "Random_Hits", "Ship_Spawn_Script" 1.0
[dataCache.willWrite]: About to write data cache.
[dataCache.write.success]: Wrote data cache.
[script.javaScript.warning.206]: ----- JavaScript warning: player.docked is deprecated, use player.ship.docked instead.
[gameController.exitApp]: .GNUstepDefaults synchronized.
i.e. not helpful.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Thargoid wrote:
Note the orientation in the sub-ents as well as their position. This may be part of your problem perhaps? The weapons fire along the Z-axis of the sub-entity, so you need to set the orientation up correctly to aim that Z-axis along the direction you want it to fire relative to the axis of the main entity (if you see what I mean).
Nope - At the mo I only have fixed laser subents pointing (1,0,0,0) and (0,0,0,1). I have been unable to get them to shoot at me.

Code: Select all

	<key>megas-cannon</key>
	<dict>
		<key>ai_type</key>
		<string>nullAI.plist</string>
		<key>laser_color</key>
		<string>magentaColor</string>
		<key>model</key>
		<string>hvy-cannon.dat</string>
		<key>name</key>
		<string>Laser Cannon</string>
		<key>weapon_energy</key>
		<real>30</real>
		<key>roles</key>
		<string>ballturret</string>
		<key>smooth</key>
		<true />
		<key>setup_actions</key>
		<array>
			<string>initialiseTurret</string>
		</array>
		<key>thrust</key>
		<real>1</real>
		<!--<key>shaders</key>
		<dict>
			<key>ng-tgun_auv.png</key>
			<dict>
				<key>fragment_shader</key>
				<string>neolite-std.fs</string>
				<key>vertex_shader</key>
				<string>neolite-std.vs</string>
				<key>textures</key>
				<array>
					<string>ng-tgun_auv.png</string>
					<string>metal-neolite-effectsmap.png</string>
					<string>null-neolite-normalmap.png</string>
				</array>
				<key>uniforms</key>
				<dict>
					<key>uColorMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>0</integer>
					</dict>
					<key>uFXMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>1</integer>
					</dict>
					<key>uNormalMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>2</integer>
					</dict>
					<key>specularRGB</key>
					<dict>
						<key>type</key>
						<string>vector</string>
						<key>value</key>
						<string>1.0 0.7 0.5 1.0</string>
					</dict>

					<key>uTime</key>
					<string>universalTime</string>
					<key>uEngineLevel</key>
					<string>speedFactor</string>
					<key>uHullHeatLevel</key>
					<string>hullHeatLevel</string>
				</dict>
			</dict>
		</dict>-->
	</dict>
	<key>megas-hardpoints-port</key>
	<dict>
		<key>like_ship</key>
		<string>megas-hardpoints-aft</string>
		<key>model</key>
		<string>megas-hardpoints-port.dat</string>
	</dict>
	<key>megas-hardpoints-stbd</key>
	<dict>
		<key>like_ship</key>
		<string>megas-hardpoints-aft</string>
		<key>model</key>
		<string>megas-hardpoints-stbd.dat</string>
	</dict>
	<key>megas-hardpoint-fwd</key>
	<dict>
		<key>like_ship</key>
		<string>megas-hardpoints-aft</string>
		<key>model</key>
		<string>megas-hardpoint-fwd.dat</string>
	</dict>
	<key>megas-hardpoints-aft</key>
	<dict>
		<key>ai_type</key>
		<string>nullAI.plist</string>
		<key>model</key>
		<string>megas-hardpoints-aft.dat</string>
		<key>name</key>
		<string>Hard Point</string>
		<key>roles</key>
		<string>ms-hardpoints</string>
		<key>thrust</key>
		<real>1</real>
<!--		<key>shaders</key>
		<dict>
			<key>ms-hardpoint.png</key>
			<dict>
				<key>fragment_shader</key>
				<string>neolite-std.fs</string>
				<key>vertex_shader</key>
				<string>neolite-std.vs</string>
				<key>textures</key>
				<array>
					<string>ms-hardpoint.png</string>
					<string>ms-hardpoint-effectsmap.png</string>
					<string>null-neolite-normalmap.png</string>
				</array>
				<key>uniforms</key>
				<dict>
					<key>uColorMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>0</integer>
					</dict>
					<key>uFXMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>1</integer>
					</dict>
					<key>uNormalMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>2</integer>
					</dict>
					<key>specularRGB</key>
					<dict>
						<key>type</key>
						<string>vector</string>
						<key>value</key>
						<string>1.0 0.7 0.5 1.0</string>
					</dict>

					<key>uTime</key>
					<string>universalTime</string>
					<key>uEngineLevel</key>
					<string>speedFactor</string>
					<key>uHullHeatLevel</key>
					<string>hullHeatLevel</string>
				</dict>
			</dict>
		</dict>-->
	</dict>
And the actual subentities entries are like this:

Code: Select all

			<!-- forward weaponry -->
			<string>fixed-hvy-cannon	53.3  1.7 420.0 1 0 0 0</string>
			<string>fixed-hvy-cannon	53.3 -4.1 420.0 1 0 0 0</string>
			<string>fixed-hvy-cannon	53.3 -9.9 420.0 1 0 0 0</string>

			<string>fixed-hvy-cannon	-53.3  1.7 420.0 1 0 0 0</string>
			<string>fixed-hvy-cannon	-53.3 -4.1 420.0 1 0 0 0</string>
			<string>fixed-hvy-cannon	-53.3 -9.9 420.0 1 0 0 0</string>

			<string>megas-hardpoints-port	0.0 10.0 0.0 1 0 0 0</string>

			<string>megas-cannon		-87.89 -52.30 334.49 1 1 0 0</string>
			<string>megas-cannon		-87.89 -52.30 308.82 1 1 0 0</string>
			<string>megas-cannon		-87.89 -52.30 283.65 1 1 0 0</string>

			<string>megas-hardpoints-stbd	0.0 10.0 0.0 1 0 0 0</string>

			<string>megas-cannon		87.89 -52.30 334.49 1 1 0 0</string>
			<string>megas-cannon		87.89 -52.30 308.82 1 1 0 0</string>
			<string>megas-cannon		87.89 -52.30 283.65 1 1 0 0</string>

			<string>megas-hardpoint-fwd	0.0 10.0 20.0 1 0 0 0</string>

			<string>megas-cannon		0.60 -96.80 502.69 1 0 0 0</string>

			<!-- thorax weaponry -->
			<string>fixed-hvy-cannon	73.9 -18.3 -290.0 0 0 0 1</string>
			<string>fixed-hvy-cannon	73.9 -30.0 -290.0 0 0 0 1</string>

			<string>fixed-hvy-cannon	-73.9 -18.3 -290.0 0 0 0 1</string>
			<string>fixed-hvy-cannon	-73.9 -30.0 -290.0 0 0 0 1</string>

			<string>megas-hardpoints-aft	0.0 0.0 0.0 1 0 0 0</string>

			<string>megas-cannon		 38.84   71.44 -318.59 1  1 0 0</string>
			<string>megas-cannon		-38.84   71.44 -318.59 1  1 0 0</string>
			<string>megas-cannon		 38.84 -117.65 -318.59 1 -1 0 0</string>
			<string>megas-cannon		-38.84 -117.65 -318.59 1 -1 0 0</string>

		</array>
I had this working dammit!
What I did different was add the shaders and the hardpoint-fwd entry.
I also changed the hardpoint entries to like_ship.
As you can see, I have commented out the shaders. Still the effect.

Curiously, the forward and starboart turrets are unnaffected. The aft bases are around the front of the ship, some guns are off to port ... it's a mess! I have pics:

Image
... activating the turret displaces subents.

Image
... deactivating turrets restores them.

Maybe one of you will have an idea - I'm too worn out fighting software patents in my alter-ego. Bed time!
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Are the hard points supposed to be the base for the mega-cannon, or some sort of laser? If the latter then they don't have any forward weapon defined, so have nothing to fire. For example I don't see any key for forward_weapon_type set to WEAPON_THARGOID_LASER (or whatever) in your entities.

Also They all seem to be in the same place and pointing in the same direction? Are you displacing them from a common centre-point by using an offset model? I'm a little confused about what each of your sub-entities is actually supposed to be and how you're going about positioning your sub-ents compared to your main entity? Can you clarify a bit?

And I guess fixed-hvy-cannon is defined somewhere else in the plist that you haven't posted? As it's not an entity in what you've listed?

By the way, in the smoothing you have <true />, there's a rogue space before the slash I think.

Editted to add -

In your first post you have

Code: Select all

<key>fwd_weapon_type</key> 
      <string>WEAPON_MILITARY_LASER</string> 
The key is forward_weapon_type, not fwd_weapon_type. Have a look at the example I posted above, although that's in openstep not XML (but you get the idea, the key names are the same).

Also you only need the setup_action if it's a ballturret, not a laser-armed sub-entity. The laser sub-entity won't rotate though, it will be fixed in place.

Your displacement issue may be the result of using the action on something it's not supposed to be used on (something that hasn't the role of a ballturret). There I don't know without more detailed knowledge of the code.
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Thargoid wrote:
Are the hard points supposed to be the base for the mega-cannon, or some sort of laser? If the latter
former - look at the griff spacebar. Look at the second picture.

I'm a little confused about what each of your sub-entities is actually supposed to be and how you're going about positioning your sub-ents compared to your main entity? Can you clarify a bit?


Lets see ...
I'm using the barrelled ballturret on a platform style like the griff spacebar. The platforms are just decoration - they have no weapons, so I don't need the axis orientation to do anything special. Just like the spacebar. You've seen the spacebar?

These pics, with the previous, should help:
Image
... link to a full-size screenshot.

Image
... detail from wings3D showing you where everything is supposed to go.
The turret bases are in red.
The port-hardpoints subentity has three models. Their position and orientation is hard-coded in the dat file. The position info in the plist is a tweak to account for differences between the dock dat file and the dock wings file I'm using. (as it is, I have to update that to fix a bug in the way ships are launched that nobody noticed before :) )

Anyway - this is for comparison with the game-shot in the previous post.

Hears a view showing how the aft hardpoints and fixed lasers get shifted:
Image

And I guess fixed-hvy-cannon is defined somewhere else in the plist that you haven't posted? As it's not an entity in what you've listed?

Ah yes: between the megas cannons and the hardpoints declairations.

Code: Select all

	<key>fixed-hvy-cannon</key>
	<dict>
		<key>ai_type</key>
		<string>nullAI.plist</string>
		<key>laser_color</key>
		<string>magentaColor</string>
		<key>model</key>
		<string>hvy-cannon.dat</string>
		<key>name</key>
		<string>Laser Cannon</string>
		<key>roles</key>
		<string>fixed-laser-cannon</string>
		<key>smooth</key>
		<true/>
		<key>fwd_weapon_type</key>
		<string>WEAPON_MILITARY_LASER</string>
		<key>weapon_energy</key>
		<real>32</real>
		<key>thrust</key>
		<real>1</real>
		<key>shaders</key>
		<dict>
			<key>ng-tgun_auv.png</key>
			<dict>
				<key>fragment_shader</key>
				<string>neolite-std.fs</string>
				<key>vertex_shader</key>
				<string>neolite-std.vs</string>
				<key>textures</key>
				<array>
					<string>ng-tgun_auv.png</string>
					<string>metal-neolite-effectsmap.png</string>
					<string>null-neolite-normalmap.png</string>
				</array>
				<key>uniforms</key>
				<dict>
					<key>uColorMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>0</integer>
					</dict>
					<key>uFXMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>1</integer>
					</dict>
					<key>uNormalMap</key>
					<dict>
						<key>type</key>
						<string>texture</string>
						<key>value</key>
						<integer>2</integer>
					</dict>
					<key>specularRGB</key>
					<dict>
						<key>type</key>
						<string>vector</string>
						<key>value</key>
						<string>1.0 0.7 0.5 1.0</string>
					</dict>

					<key>uTime</key>
					<string>universalTime</string>
					<key>uEngineLevel</key>
					<string>speedFactor</string>
					<key>uHullHeatLevel</key>
					<string>hullHeatLevel</string>
				</dict>
			</dict>
		</dict>
	</dict>
By the way, in the smoothing you have <true />, there's a rogue space before the slash I think.
seen it - fixed it - no difference. Also seen that the aft cannon are facing the wrong way and fixed that - still no difference.
Editted to add -

In your first post you have[/color]

Code: Select all

<key>fwd_weapon_type</key> 
      <string>WEAPON_MILITARY_LASER</string> 
The key is forward_weapon_type, not fwd_weapon_type. Have a look at the example I posted above, although that's in openstep not XML (but you get the idea, the key names are the same).
Ah - 2am effect - OK, changed that and added a forward_weapon_type=none to the hardpoints.
[/quote]
This fixes the issue of non-firing lasers: they didn't have a weapon!
I've just seen a megaship take out a std tharoid with a single salvo - erk! What have I done?

Also you only need the setup_action if it's a ballturret, not a laser-armed sub-entity. The laser sub-entity won't rotate though, it will be fixed in place.

What I had in mind was a laser-armed ball turret.
But never mind that for now - the entity with the setup actions does not have a laser.

Issue to be solved: displacement of subentities.
I've been attempting to narrow down the entities affected.

The entities effected are:
megas-hardpoints-stbd (will these will actually be the port hardpoints in the game? - due to LH coordinates.)
megas-hardpoints-aft
hvy-fixed-cannon - all the thorax ones.

But NOT: any of the megas-cannon


Your displacement issue may be the result of using the action on something it's not supposed to be used on (something that hasn't the role of a ballturret). There I don't know without more detailed knowledge of the code.
The only entity with a setup action is the megas-cannon - and that does have role=ballturret.

However, the galactic navy shipdata.plist includes an entity "rogueturret" which has the setup action and role="rogueturret"; That seems to work.

The list of entities currently defined is:

Code: Select all

megas-ballturret (frigate plasma turret)
rogueturret (rogue frigate plasma turret)
megas-cannon (megaship plasma turret)
fixed-heavy-cannon (megaship laser)
fixed-cannon (frigate laser)
rogue-cannon (rogue frigate laser)
hardpoints: (megaship hps - form bases for the megas cannon)
port (3 bases along stbd(?) arm of the dock)
stbd (3 bases along the port(?) arm of the dock)
fwd (1 base under the chin of the dock)
aft (4 bases around tho rear of the thorax)
[hardpoints are pre-positioned in the dat file)

megas-dock - bug: orientation, ease of docking.
megas-ring - used for forward and aft habitat rings, rotates
megas-engine - x4
megas-dish - x1 pre-positioned rear.

megaship-type3 (2 rings, command role)
megaship-type2 (1 ring)
megaship-type1 (no rings - faster)

navy-frigate
rogue-frigate

navy-transport
(frontier-transport: player version of the navy-transport)
navy-asp
navy-viper
navy-minesweeper
navy-shuttle

(navy-rattlecutter?)
... but everything below the megaship-type3 is commented out so I can test one ship at a time.

I suspect a problem with a hardpoint model... so I'm working on narrowing down the symptoms even more.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

For the sake of documentation - moving all the non-ballturret subemtity declarations above the ballturret ones has fixed the problem. So now I have turrets, and lasers, all in their right places, all wearing their shaders, and all fun.

Image

A single thargoid is just no match.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
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:

Post by Commander McLane »

Simon B wrote:
For the sake of documentation - moving all the non-ballturret subemtity declarations above the ballturret ones has fixed the problem. So now I have turrets, and lasers, all in their right places, all wearing their shaders, and all fun.
Yes, I seem to remember that there was an issue with the order of subentities. Unfortunately the correct order hasn't been documented yet in the wiki. Could somebody who does remember more about that than me do that some time? Thanks!

And just to clarify one issue in general: Lasers and turrets are two distinct types of weapons in Oolite. Laser = beam of light; turret = small balls of plasma. So there is by definition no such thing as a laser turret. And this:
What I had in mind was a laser-armed ball turret.

won't work. Turrets are by definition plasma ball-armed.

Something that Oolite would recognize as a turret (and for instance turn in the direction of its target) will never fire a beam of light, but only plasma balls. And only for this thingamajig which fires plasma balls you need the initialiseTurret-method. Never for anything that is supposed to fire beams of light.

AFAIK it is technically the initialiseTurret-method--and this method only--that makes an entity into a turret (you see, the entity is made into a weapon, it doesn't get a weapon). You don't need anything else for that, notably you don't need the role "ballturret"--or any other role, for that matter. Roles are optional for subentities, and they don't do anything.
At the mo I only have fixed laser subents pointing (1,0,0,0) and (0,0,0,1).
I don't think that (0,0,0,1) is a legal quaternion, but as long as it works, it seems to indicate that Oolite is forgiving in that respect.

As far as the appearance is concerned: Yes, you can do all kinds of things along the lines you have described. But as long as you chose to give pulse or beam lasers a bigger punch for some appearance effect, I will continue (should the case happen and I even download and install your OXP) to toast you ship from a distance too big that any appearance issues would matter. Or in other words: as long as I kill an NPC from 20 to 25 kilometers away, the whole ship won't be bigger on my screen than a few pixels, I won't make out any details, and the ship won't even fire its lasers at all as long as I am above its laser range. You can see that with the existing ships with multiple front lasers. The closer you come the more laser beams are fired upon you, because it first uses only the military lasers, later the beam lasers, and only finally the pulse lasers as well. You can study this when attacking an Imperial Courier, or the Renegade Pirats.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Commander McLane wrote:
I don't think that (0,0,0,1) is a legal quaternion, but as long as it works, it seems to indicate that Oolite is forgiving in that respect.
(0,0,0,1) is the (1,0,0,0) unit quaternion rotated 180 degrees about the Z-axis, and is quite legal. In the same way (0,1,0,0) is 180 degrees about the X-axis and (0,0,1,0) is 180 degrees about the Y-axis respectively.
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

...

Post by Lestradae »

Simon B wrote:
For the sake of documentation - moving all the non-ballturret subentity declarations above the ballturret ones has fixed the problem.
That really is some information that should find its way to the wiki, I have been wondering about this issue for ages.

Now I can go fix it at last.
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Commander McLane wrote:
And just to clarify one issue in general: Lasers and turrets are two distinct types of weapons in Oolite. Laser = beam of light; turret = small balls of plasma.
This equivalence is contradicted in the following, also from you:
What I had in mind was a laser-armed ball turret.

won't work. Turrets are by definition plasma ball-armed.
So either a turret is a plasma gun or a turret is plasma-armed. Which?
Something that Oolite would recognize as a turret (and for instance turn in the direction of its target) will never fire a beam of light, but only plasma balls.
So unlike a thargoid laser then?

But this bit:
And only for this thingamajig which fires plasma balls you need the initialiseTurret-method. Never for anything that is supposed to fire beams of light.
Is the clarification - initialise-turret is for plasma turrets. The "omnidirectional laser" commented in the source code does not use this.

Personally I am using the terms a tad loosely for your comfort?
To me, a turret is the model that turns, it has a muzzle that shoots stuff. Anything which looks like that is a turret.

You have explained that initialise-turret is what makes a model orient its z-axis to a target, and arms it with a plasma cannon.

I understand that it is possible to specify forward_weapon_type="WEAPON_PLASMA_GUN"; to give a unidirectional plasma cannon... eg. not a turret.

At the mo I only have fixed laser subents pointing (1,0,0,0) and (0,0,0,1).
I don't think that (0,0,0,1) is a legal quaternion, but as long as it works, it seems to indicate that Oolite is forgiving in that respect.
Perhaps you can supply an example of a 4-vector which is clearly not a legal quaternion and I'd understand this statement. AFAIK: any 4-vector can be used to represent a quaternion.

Of course it is, it's even normalized!
As far as the appearance is concerned: Yes, you can do all kinds of things along the lines you have described. But as long as you chose to give pulse or beam lasers a bigger punch for some appearance effect, I will continue (should the case happen and I even download and install your OXP) to toast you ship from a distance too big that any appearance issues would matter.
Well of course, how you choose to play the game is up to you ... the shorter range will be something to make up for in the ship design ;)

eg. It can be very fast, or have fast escorts.

What exactly is the issue here: I take it you are not arguing that there is no point having npc ships with short range weapons? Short-range, very powerful weapons look like a nice balance to me: players have to learn to shoot accurately and move quickly.
Or in other words: as long as I kill an NPC from 20 to 25 kilometers away, the whole ship won't be bigger on my screen than a few pixels, I won't make out any details, and the ship won't even fire its lasers at all as long as I am above its laser range. You can see that with the existing ships with multiple front lasers. The closer you come the more laser beams are fired upon you, because it first uses only the military lasers, later the beam lasers, and only finally the pulse lasers as well. You can study this when attacking an Imperial Courier, or the Renegade Pirats.
Yes - that is part of what I'm talking about.

Similarly with turret ships, you stay far off and it doesn't matter that there are a dozen instakill pulse weapons on the thing. So what?

The discussion also assumes that the pc is the target. This is not always the case. Have you never sat back and watched a firefight, or been close to another ship while it is firing a weapon at someone else?

With griff-style ball+stick turrets, if you are far away you cannot see them. Does that make them a waste of time? (Though, when just in firing range, it is nice to be able to see the difference between that and a standard ballturret.)

Here's another one for appearances - but I don't think it will work.

I can make a laser turret by giving a ball-shaped subent a thargoid laser.
That should work - but the nice thing to do would be able to see the subent track a target (i.e. you, or an npc target) in the manner of griffs spacebar turrets.

So, if I start with a spacebar turret, perhaps I can also put a small laser (ball-model+thargoid laser) turret inside it. Then the turret would track the target, and the laser, if fired, would appear to come from the spacebar turret.

May not work - since weapons in subents may not actually fire from inside other models. Though, I can change the spacebar model to have a long hole down the middle so the coordinate of the laser is exposed.

This still has the problem of what to do with the plasma balls which the turret will still fire. Maybe I can script the turret not to fire, only to track?

Maybe I can set the weapon energy to zero. Will that make zero-strength balls of light? Or will the firing stop completely, a la WEAPON_NONE? Is it possible to make the plasma balls transparent as well?

(I don't think you can do that, since 1.71(?) lasers have to be bright enough to be seen... and I don't see Ahruman allowing alpha=0 colors for weapons.)

Another method - probably won't work:

If, however, lasers on subents can fire through mother ents, it gets more interesting. I can create the appearance of a cluster of lasers firing one at a time by putting one laser on a rotating subent inside. The beam emerges from different locations in the facing panel.

Or maybe I can do the same by reversing the normals on the subent and just sticking the needed part out of the hull?

If I use more than one of these with different spin rates I have the effect of a larger cluster firing in pairs, or triples, but different pairs etc. each time.

Now in practical terms - you still get fired on at the same rate.
But, in practical terms, all the ships can be equal size and color tetradedrons.

The reason I suspect it wont work is that it may not be possible to rotate a laser-bearing subent and have the laser follow the rotation.



The keen one would be to have a fighter with wingtip-mounted, or otherwise distinguishable, guns. One where the guns fire alternately.

In can, reportedly, be done in the case of external missile models - when a missile is fired the model gets swapped for one with that missile missing.


For that matter, can npc subents get missiles? This paves the way for missile batteries.... multiple missile launch locations.

Anyway, I started this whole thing to discuss hacking the lasers to create different effects.

Short of recompiling, I cannot remake the existing lasers.
So anything I try has to come from some legal combination of existing devices - and it will not be available to the player.

Lets be creative.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Turret (plasma ballturret) - rotates automatically to point at its target, and fires little balls of plasma. Low range and rate of fire, variable damage. Does not need to have a weapon defined, but requires set-up action of initialisation. Possibly needs the role ballturret (I always thought it did, but I'm by no means sure on that last one).

Armed sub-entity - Any other defined NPC ship subentity which happens to have a weapon as part of that definition. Does not rotate to point at its target (except if the main entity that it's attached to does). Will fire along Z-axis unless it is a Thargoid laser, in which case it will fire anywhere except through itself or its mother entity. Does not require any set up initialisation, but does require a forward (or aft) weapon definition etc.

The plasma ballturret is essentially a specialised type of sub-entity, the "laser turret" is actually just a sub-entity with a laser on it, usable to give an NPC multiple weapons in a given direction (forward or aft) but it does not move in relation to its mother entity, unlike the plasma ballturret which can rotate to point and aim.

It's not possible by script to detect when an NPC ship fires a missile, so you can't do a model swap like you suggest. Also if a ship has mulitple sub-entity weapons, they all fire together (at least if they are the same weapon type they do, never tried it with different weapons) - so "alternately firing guns" or any other kind of cyclical fire pattern is also not possible at the moment.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Simon B wrote:
For that matter, can npc subents get missiles? This paves the way for missile batteries.... multiple missile launch locations.
Unfortunately not. Maybe this will change someday. Tested under v1.72.2.

Another important thing is that the missile_launch_position also defines the direction of the missile. Moving along x-axis or y-axis results in growing changes of the direction. I've seen it while testing the carrier for a coming oxp. This carrier has missile racks, but both are far away from (0,0,0). So the carrier fires it's missiles to one side - hmmm. Looks a bit strange :-)

Image
Post Reply