Page 2 of 3

Posted: Fri Aug 14, 2009 1:38 pm
by Commander McLane
Simon B wrote:
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?
Thargoid has already given some more clarification, but I can still try again. And I apologize that I, too, was't exact in my terms. I'll try to be now.

There is no contradiction here. Oolite knows the following weapon types which are defined in the code and available via equipment.plist:
  • EQ_WEAPON_PULSE_LASER: Laser, slowly firing, low range, low punch.
  • EQ_WEAPON_BEAM_LASER: Laser, quickly firing, medium range, medium punch.
  • EQ_WEAPON_MINING_LASER: Laser, very slowly firing, low range, huge punch.
  • EQ_WEAPON_MILITARY_LASER: Laser, quickly firing, high range, big punch.
  • EQ_WEAPON_THARGOID_LASER: Laser, medium slowly firing, medium range, medium punch, omnidirectional.
  • EQ_WEAPON_TWIN_PLASMA_CANNON: Plasma balls, slowly firing, low range, low punch.
These are all the weapons there are. You can only tinker with them in the limits we discussed before (colour, limited increase of punch). You cannot define any other lasers or cannons yourself with scripting methods. (As you said, you could change their definitions in the code, and probably add more types there. But the result wouldn't be Oolite anymore--not in the sense of "the same Oolite platform that everybody uses" at least.)

All these weapons are handled as equipment. You can fit them as an equipment on any entity (including sub-entities) using the shipdata.plist-keys forward_weapon_type and aft_weapon_type. It is completely your choice which of these weapons you will fit on which entity. And none of them is a turret.

And then there is something completely unrelated. It is called plasma turret (or in short simply turret). From the coding perspective it is not a weapon, because it isn't assigned to any entity as a weapon. It is not an equipment. You cannot make it a forward_weapon or aft_weapon. So it is not comparable to any of the aforementioned. It only borrows the plasma balls (appearance again, which can in this case deceive) from the EQ_WEAPON_TWIN_PLASMA_CANNON. Instead you may think of it as a package from a completely different factory, which works completely differently. Instead of assigning it as a weapon, it comes packaged in a subentity with special pre-defined behaviour. Any subentity of your liking gets converted into a turret by inserting the initialiseTurret-method into the setup_actions in its shipdata entry. Its model doesn't need to look like a turret. It doesn't need (or even be able) to turn (and it won't if you don't define its pitch and roll etc. accordingly). If you initialise it as a turret, it will be a turret.

Again: Although the turret's ammunition looks like that of EQ_WEAPON_TWIN_PLASMA_CANNON, and its firing range and punch are the same, it is not in any way related to the weapon (which still is an equipment piece). The turret is a completely independent thing, whose characteristics (except again colour and (I think) punch of the plasma balls) cannot be changed. Specifically the plasma balls cannot be exchanged with anything else, notably not with a laser beam.
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?
Yes, completely unlike, because an EQ_WEAPON_THARGOID_LASER is simply one of the six pre-defined weapons. You assign it to an entity of your liking as forward_weapon_type and aft_weapon_type.
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.
No, because it is a piece of equipment like all other weapons, which is simply assigned using the forward_weapon_type and aft_weapon_type keys.
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.
I have a stretchable comfort-zone, don't worry. :wink: No, the problem is that you are using the term different from how Oolite uses it. For Oolite a turret is any entity that is initialised as a turret, and therefore will behave in a pre-defined way (firing plasma balls at the current target of its mother, covering roughly a 180° angle). Oolite doesn't care at all about the model, what it looks like, whether it turns, or whether it has a muzzle. In short: Contrary to what you and I would associate with a turret, it's not the looks which define a turret, but it's pre-defined special behaviour characteristics.
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.
No, it turns a subentity into a turret (= something that fires plasma balls at its mother's current target, provided this target is in firing range and at a sufficient angle). Nowhere in this process is it armed with a EQ_WEAPON_TWIN_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.
Yes. If you assign EQ_WEAPON_TWIN_PLASMA_CANNON as a weapon to an entity, that entity will have it as a weapon. And this isn't a turret.

Posted: Fri Aug 14, 2009 10:06 pm
by Simon B
Commander McLane wrote:
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.
No, it turns a subentity into a turret (= something that fires plasma balls at its mother's current target, provided this target is in firing range and at a sufficient angle). Nowhere in this process is it armed with a EQ_WEAPON_TWIN_PLASMA_CANNON.
<sigh>
I think this statement relies overmuch on emphasis and inflection for its meaning, I find three meanings depending on emphasis and have put the one I like most, last.

"armed" - a turret is not armed?
AFAIK there is nothing in the wiki or the source code which has such a wierd definition of "armed" which may be "used by oolite" - can you point it out to me?

OR: perhaps you mean that a turret is armed - in the sense that it is "able to shoot at things" but that it is not armed with EQ_WEAPON_TWIN_PLASMA_CANNON. In which case: so what? I never claimed that it was :)

Perhaps you mean that the setup action turns the entity into a plasma cannon. So it makes as much sense to say that a turret is armed with plasma as it does to say that a rifle is armed with bullets?

(So a rifle is loaded with bullets, a turret with plasma, and a laser with light? Better?)

By the same token, a subentity with forward_weapon_type="WEAPON_SUREKIL_CANNON" becomes a surekil cannon.

But if I want a surekil cannon that rotates to follow it's target I am out of luck, because only turrets have that behavior.

You see - I always figured language was our tool, not our master.

The problem I am having is that in real life a turret is something which can have a weapon of some kind mounted or housed on or in it. The turret is armed when the weapon is loaded and ready to fire. The turret, or more accurately: it's weapon, may fire things other than plasma balls.

How can I talk about these things sensibly while restricting myself to strict in-game terminology? At some point I am going to have to break protocol.

I guess I had naively assumed that I'd use code to describe game-mechanics and normal English to describe the effects of this.

All I can promise is to try to be careful not to mix terms up too badly and to try to make it clear when I am speaking in game-mechanics and when casually.

Looking back, I begin to suspect that your object was more to squash a conceptiual confusion I had, illustrated by trying forward_weapon_type in an intended subentity which also used initialiseTurret and in talking about thargoid lasers owing their wide fire arc to "being on a turret"? If so, then please consider that matter resolved.

Posted: Sat Aug 15, 2009 8:44 am
by Thargoid
Firstly let's take a sub-entity. This does not move relative to its mother entity (does not track targets or anything like that). But it can be equipped with a forward (or aft) weapon, and will fire it under the command of the whole entities AI. The target will be the same as that for any weapon that the main entity possesses unless the weapon assigned is a Thargoid laser, whereby a different target may be aimed at (if one is available).

We now take this sub-entity and add the setup action to initialise it as a turret, and also remove any assigned forward (or aft) weaponry from it. It will now rotate and track its own target (although all turrets on a given entity will track the same target), which may well be separate from that of the main entity itself (presuming sufficient targets are actually around to shoot at). It will fire the aforementioned plasma balls, with a range (iirc) of about 5km.

If we further take this turret and re-add the assigned weaponry, then essentially it is trying to do two things at once and perform two different jobs. This results in the problems you saw with offsetting etc. I would strongly suspect.

Basically by taking a sub-entity, giving it a Thargoid laser and no intialisation action, you have what is essentially a "laser turret", although it will not move to track targets. The only thing that can track a target is a true initialised turret, and they cannot be armed with explicit weapons as part of that initialisation gives them their plasma weaponry.

Posted: Sat Aug 15, 2009 10:27 am
by Commander McLane
Simon B wrote:
Looking back, I begin to suspect that your object was more to squash a conceptiual confusion I had, illustrated by trying forward_weapon_type in an intended subentity which also used initialiseTurret and in talking about thargoid lasers owing their wide fire arc to "being on a turret"? If so, then please consider that matter resolved.
Yes, that was the case of the matter. Okay, resolved then. :D

Oh, and I don't want to suggest by any means that you shouldn't try to do fiddle with the existing weapons, mix them in the ways described by you and try which effects you may get. My aim was merely to make you aware of how things work from a coding/scripting perspective. The fun part of scripting is always to be aware of the limitations of the game engine, and then find clever ways of getting a maximum result within these limitations. Therefore:

Right On, Commander! :D

Posted: Sun Aug 16, 2009 8:43 am
by Simon B
Thargoid wrote:
If we further take this turret and re-add the assigned weaponry, then essentially it is trying to do two things at once and perform two different jobs. This results in the problems you saw with offsetting etc. I would strongly suspect.
Nah - the weird stuff happened even with properly defined turrets - it was due to following turrets with static entities in the subentity array.
Basically by taking a sub-entity, giving it a Thargoid laser and no intialisation action, you have what is essentially a "laser turret", although it will not move to track targets. The only thing that can track a target is a true initialised turret, and they cannot be armed with explicit weapons as part of that initialisation gives them their plasma weaponry.
Yeah - so, to test is putting a thargoid-laser subentity at the same coordinate as a turret. The turret turns to track a target, the thargoid laser entity fires at it - apparently through the turret muzzle. Somehow stopping the turret itself firing would complete the effect.

On another point - the longest range weapon is WEAPON_NONE ... and I note it has an explicit default weapon energy set to zero. So, does this mean I can set it to non-zero in a plist and get a really long range laser?

Posted: Sun Aug 16, 2009 9:30 am
by Thargoid
Simon B wrote:
Yeah - so, to test is putting a thargoid-laser subentity at the same coordinate as a turret. The turret turns to track a target, the thargoid laser entity fires at it - apparently through the turret muzzle. Somehow stopping the turret itself firing would complete the effect.
If you could get the two positioned properly, possibly. But I see two issues. Firstly I don't know of any way to actually stop the turret firing, and secondly there's no guarantee that the laser and the turret will be targetting the same thing, so you may get some weird effects if multiple targets are around, like lasers coming out of the side of a turret (depending of course on how you design it again).
Simon B wrote:
On another point - the longest range weapon is WEAPON_NONE ... and I note it has an explicit default weapon energy set to zero. So, does this mean I can set it to non-zero in a plist and get a really long range laser?
I would be surprised, but I can't say I've ever tried it. But my expectation would be a WEAPON_NONE would also have a fire rate and a recharge rate of zero, and those you can't change...

Posted: Sun Aug 16, 2009 11:32 am
by Eric Walch
Thargoid wrote:
Simon B wrote:
On another point - the longest range weapon is WEAPON_NONE ... and I note it has an explicit default weapon energy set to zero. So, does this mean I can set it to non-zero in a plist and get a really long range laser?
I would be surprised, but I can't say I've ever tried it. But my expectation would be a WEAPON_NONE would also have a fire rate and a recharge rate of zero, and those you can't change...
The ship-key "weapon_energy" is not used for lasers, only for the energy of missiles. It explicit is only read in when forward_weapon = WEAPON_NONE. In other cases it is just skipped. So you cant make an super laser.

The entry in the wiki is wrong. Maybe it was once right, but at least since 1.65 laser_energy is not modified, only missile eneregy

Posted: Sun Aug 16, 2009 12:26 pm
by Simon B
I would be surprised, but I can't say I've ever tried it. But my expectation would be a WEAPON_NONE would also have a fire rate and a recharge rate of zero, and those you can't change...
case WEAPON_NONE :
weapon_energy = 0.0; // indicating no weapon!
weapon_recharge_rate = 0.20; // maximum rate
weaponRange = 32000;
break;

Non-zero... :) But I suspect you are right - there is probably something else blocking it. Still, worth a go aye?

The forward_weapon_type="WEAPON_NONE" frigate still fires a red laser as a player - but it has subents that have lasers, maybe the code figures to give the player a break?

At some point when I'm not too busy like next decade I'll have to examine what I'll have to modify to give players access to subent lasers ... I figure, player cannot modify them but they fire on a-key. I have to get the engine to realise they are there and work out the offsets.
The ship-key "weapon_energy" is not used for lasers, only for the energy of missiles. It explicit is only read in when forward_weapon = WEAPON_NONE. In other cases it is just skipped. So you cant make an super laser.
<checks> hey! Has this changed?

Didn't I read not months ago that it was possible to set weapon energy for plasma and lasers, limited to range 0-50. Now I'm scrabbling to find an oxp exploiting this.

Weapon energy is clearly set for turrets in behemoth and galactic navy oxps - but presumably these count as forward_weapon_type="WEAPON_NONE".

Posted: Sun Aug 16, 2009 1:23 pm
by Eric Walch
Simon B wrote:
[Has this changed?

Didn't I read not months ago that it was possible to set weapon energy for plasma and lasers, limited to range 0-50. Now I'm scrabbling to find an oxp exploiting this.

Weapon energy is clearly set for turrets in behemoth and galactic navy oxps - but presumably these count as forward_weapon_type="WEAPON_NONE".
No, I didn't read well. It is skipped on setting up the ships directory, but later during the actual firing in "fireMainWeapon", the key is read in and clamped at 50 as maximum!

Code: Select all

- (BOOL) fireMainWeapon:(double) range
{
	weapon_energy = OOClamp_0_max_f([shipinfoDictionary floatForKey:@"weapon_energy" defaultValue:weapon_energy],50.0);
	
	//

	BOOL fired = NO;
	switch (forward_weapon_type)
	{
		case WEAPON_PLASMA_CANNON :
			[self firePlasmaShot: 0.0: 1500.0: [OOColor yellowColor]];
			fired = YES;
			break;
		
		case WEAPON_PULSE_LASER :
		case WEAPON_BEAM_LASER :
		case WEAPON_MINING_LASER :
		case WEAPON_MILITARY_LASER :
			[self fireLaserShotInDirection: VIEW_FORWARD];
			fired = YES;
			break;
		
		case WEAPON_THARGOID_LASER :
			[self fireDirectLaserShot];
			fired = YES;
			break;
		
		case WEAPON_NONE:
			// Do nothing
			break;
	}
WEAPON_PLASMA_CANNON is here defined as main weapon, not as turret. Apparently it is than always yellow while as turret is takes the colour of laser_colour.
In case of weapon_none you can set every energy, but it wont fire a shot.

Posted: Sun Aug 16, 2009 1:35 pm
by Kaks
Still, firing WEAPON_NONE with 50 energy sounds very wrong to me!
If that's at all possible, that would be classified as a bug, I'm afraid...

Posted: Sun Aug 16, 2009 2:28 pm
by Eric Walch
Kaks wrote:
Still, firing WEAPON_NONE with 50 energy sounds very wrong to me!
If that's at all possible, that would be classified as a bug, I'm afraid...
Only when it actually fires something. But just verified. Setting forward weapon to none does nothing.

Posted: Mon Aug 17, 2009 7:48 am
by Commander McLane
Eric Walch wrote:
Kaks wrote:
Still, firing WEAPON_NONE with 50 energy sounds very wrong to me!
If that's at all possible, that would be classified as a bug, I'm afraid...
Only when it actually fires something. But just verified. Setting forward weapon to none does nothing.
...which really is the only sensible thing it could do, isn't it? I mean, "none" is none, nothing, nada, nix. And where you set a weapon explicitely to "NO weapon", you wouldn't expect anything to fire, would you? :)

I'm quite sure that Ian Fleming never wrote a line like this: "James Bond drew no weapon at all from his empty holster and fired one deadly shot at the big bad, who died instantly." :roll:

Posted: Mon Aug 17, 2009 10:11 am
by Eric Walch
Commander McLane wrote:
...which really is the only sensible thing it could do, isn't it? I mean, "none" is none, nothing, nada, nix. And where you set a weapon explicitely to "NO weapon", you wouldn't expect anything to fire, would you? :)
I agree, but one of the above messages stated his ship fired with weapon_none, so I wanted to double check. I assume that ship had a weapon after all.

Posted: Tue Aug 18, 2009 7:11 am
by Simon B
Eric Walch wrote:
Commander McLane wrote:
...which really is the only sensible thing it could do, isn't it? I mean, "none" is none, nothing, nada, nix. And where you set a weapon explicitely to "NO weapon", you wouldn't expect anything to fire, would you? :)
I agree, but one of the above messages stated his ship fired with weapon_none, so I wanted to double check. I assume that ship had a weapon after all.
Ah - I know what happened - I hacked a save file of course. The save file included a forward weapon - which overrode the weapon_none in the plist.

Of course it would be a bug! But it was interesting to see if it was possible - and that nobody seemed to know for sure that it wouldn't be possible. Presumably it is easy on the coding to give weapon_none an explicit range, recharge, and energy even though it does not do anything.

I imagine that any other laser with energy 0 would still fire a brilliant beam, just do no damage. Hmmm... EQ_LASER_POINTER? (Or a risk of buying your lasers from a salvage gang?)

Presumably a stealth laser (color=transparent) would also be a bug - it is implicit in the design that you can see laser beams.

Chewing through possibilities - if I define a subentity that is rotating about it's z axis and place a laser pointing forward but off-axis, will the firepoint rotate with the subentity?

I'd predict that it won't - imagine the targeting nightmare for the poor npc if I had subentity rotating about y with the regular centered laser? What would that do to the behaviour of the ship? How would we code it?

wow far out topic here

Posted: Mon Nov 30, 2009 10:43 am
by wildstar
was very interesting to read this thread.

im new here played this game well elite on c=64 ages ago and have been tinkering with this oolite and ALLL of the oxp's for last 48 hrs on UBUNTU linux.

i am getting several errors in the log (running newest version available of oolite 1.73.4) and have only had to pull out about 10 OXP's so far. about to restart oolite again with shift key down to clear cache and then see if my edited saved file will load and not cause problems.

my first thing was to get more familiar with the game and see what all possible equipment was available including via oxp's and aside from the obvious lets give me 100million cr and all the cool equipment it soon became apparent to me that although this is a decent ship i would prefer to have something more stellar.

So which is what brings me to this thread....
missles and other weapons specifically self-aiming lasers and or turrets.

It was obvious to me that many things can be edited but this thread is suggesting that i too wont be able to have a battle star cruiser with 8 self targeting /auto aiming turrets or lasers with dozens of missle racks and mine lanchers / probes / anti missle/ship defensive units all about my awesome ship which i have yet to make Oo.

so while i continue to figure out how to make a battle cruiser the size of a small ship.... the question i have is simple.....

cant we just edit the source (it is open source right?) and recompile the game code so that we can have our cake and eat it too?

I realize that the idea of this game is to complete missions and spend hours upon hours jumping from place to place buying selling mining or hunting as we go. but like a few out there i would love to program it so i can relive the amazing intense space wars of our imagination like a crazy laser light show at battle of the rock bands; balancing the game/scenarios as we go along add more pirates more police etc till the cpu maxes out on us.

ok so thats one question and i will see if there r better places to post other questions i have in other parts of the forum. thanks

and just to add some feedback to what has been discussed already here, yeah i think a turret is defined all over the internet as a weapon which can be aimed in many directions be it manned or not firing any form of weapon (projectile) so i can see how one would want to make one as a laser BUT i totally understand the confusion as the GAME doesn't know the difference between a orange and a apple. but if ship has a turret on it just had plasma ball like projectiles fire from the ship at whatever the ship happens to be targeting at the time. u just can not change this default predefined characteristic of the game successfully as the game is currently written << thats what i got out of what u all said. but i am still confused...

if you have fwd/aft/starboard/port side mounts for guns and 4 missiles slots, where is the turret go? can i just edit the code and have one on each wing or one in middle top/bottom whatever of the shop or just say that the shop has one and have the turret fire and i suspect the projectiles will just appear to go outward from the ships middle mass?

i realize i can not just add it to the default ship. i will just mod something else till i understand it enuf then actually make one (if i can) i have maya and photoshop and several other apps which i am in no way very good at using lol.

thanks again. sorry if this is too long a response.

commander wildstar