Page 2 of 4

Re: V1.77

Posted: Fri Mar 15, 2013 4:15 pm
by mandoman
another_commander wrote:
mandoman wrote:
For some reason, the ball turrets on my ship didn't fire when I thought they should, while my mirror enemy had his blazing from the beginning. Why is that?
Turrets on player ships commence firing when all below conditions are met:
- The player has a ship entity targeted
- The targeted ship exhibits hostile behaviour against the player
- The targeted ship is within turret range
Of the three, we can exclude the second one in the case you are describing, since the opponent was firing already at you and therefore was clearly hostile. This means that one or both of the other two conditions were not being met at the time.
I've been out to check on those guidelines. I'm sure that's the way it's suppose to be, but the fact of the matter is that;
a. the ships with ball turrets are firing at me from the beginning, even when I have it picked as my target, but seem to be too far away for my turrets to fire.
b. the hostile behavior que is immediate in most cases, but still no reaction from my turrets.

Oh, they will fire when I "get within range", but while I'm out of range, the same types of ships are nailing me with their ball turrets.

Re: V1.77

Posted: Fri Mar 15, 2013 8:35 pm
by Shipbuilder
If this is the case what is the range of a NPC ball turret ?

Is is more than a ball turret on a player ship ?

Re: V1.77

Posted: Fri Mar 15, 2013 8:39 pm
by another_commander
Shipbuilder wrote:
If this is the case what is the range of a NPC ball turret ?

Is is more than a ball turret on a player ship ?
Turrets are the same across players and NPCs and their range is maxed at 6000m.

Re: V1.77

Posted: Fri Mar 15, 2013 9:10 pm
by mandoman
I must be delusional.

Re: V1.77

Posted: Fri Mar 15, 2013 10:35 pm
by Diziet Sma
another_commander wrote:
Shipbuilder wrote:
If this is the case what is the range of a NPC ball turret ?

Is is more than a ball turret on a player ship ?
Turrets are the same across players and NPCs and their range is maxed at 6000m.
Even though the range is set to max on my Falcon's turrets, I've never seen them open fire until the target is less than 5000 metres away. A handicap which NPC's don't seem to suffer from.

(and it would be nice if the wiki didn't insist the max weapon_range of a turret was 7500 metres [actually, I'd like to see it increased to 7500m, as per the wiki])
mandoman wrote:
I must be delusional.
You're not.. the turret code does not work as advertised.

Re: V1.77

Posted: Fri Mar 15, 2013 11:45 pm
by cim
Diziet Sma wrote:
(and it would be nice if the wiki didn't insist the max weapon_range of a turret was 7500 metres [actually, I'd like to see it increased to 7500m, as per the wiki])
Source code says it is 7500m already, so that should be okay.

Hmm... interesting. In my tests it doesn't start firing until the target is at around 5400m ... but having started firing it keeps doing so until the target is back outside 6000m. So, okay, moving in to range the turrets will probably be pointing the wrong way and need to turn to aim ... and testing again with a very slowly approaching target, it does indeed open fire at 6000m as it should.

So the question is, why are the NPC's turrets more likely to be facing in roughly the right direction to start with?

Re: V1.77

Posted: Sat Mar 16, 2013 12:13 am
by another_commander
Guys, the code works exactly as advertised. I just did this very simple check with the Falcon:
I bought a Falcon, hyperspaced to a new system and spawned a similar Falcon using the Debug Console. Then, I turned and started moving away from it. At some point, it turned red on me and started charging against me, but I had already gained something like 8km distance. Now, I slowly matched speed with it, but not quite, so that it was gaining distance very slowly and I kept monitring the distance indicator, waiting to see when my ship's rear turret would start firing. It started firing immediately once the range fell below 6000m.

As to why it appears that turrets don't fire before the target is at something like 5km away, this probably is because if the player moves towards the target and the target moves towards the player, by the time the AI has ordered the turret to start firing, the apparent distance is at somewhere between 5600-5400m. The actual moment the turret starts is at 6km, but it's the fact that the two ships move towards eachother that creates a false impression (or at least that's what I think happens). Also, sometimes when you are chasing a ship with a rear turret, it may appear that it continues to fire at you even past the 6km mark, but again this is a false perception. The last shot is fired just before going past 6km distance, but that last shot arrives at the player's ship when said distance has opened past the turret hold fire point.

In all my tests so far, the turrets work precisely as they are supposed to.

Re: V1.77

Posted: Sat Mar 16, 2013 2:15 am
by Diziet Sma
Ok.. so it seems that, at least when not in the rapid-moving heat of combat, things do work as intended.. which only leaves the question of how/why is the range capped at 6000m, when that is given as the default range in the wiki, and the maximum of 7500m in both the code and the wiki, never comes into play? (and yes, I've tried setting weapon_range to 7500.. doesn't work..)

Re: V1.77

Posted: Sat Mar 16, 2013 2:19 am
by Diziet Sma
another_commander wrote:
As to why it appears that turrets don't fire before the target is at something like 5km away, this probably is because if the player moves towards the target and the target moves towards the player, by the time the AI has ordered the turret to start firing, the apparent distance is at somewhere between 5600-5400m. The actual moment the turret starts is at 6km, but it's the fact that the two ships move towards eachother that creates a false impression (or at least that's what I think happens). Also, sometimes when you are chasing a ship with a rear turret, it may appear that it continues to fire at you even past the 6km mark, but again this is a false perception. The last shot is fired just before going past 6km distance, but that last shot arrives at the player's ship when said distance has opened past the turret hold fire point.
One tactic I've used is to come to a halt, spin the rear of the Falcon towards the NPC, and wait for them to come to me.. the range is usually close to 5000m before the turret opens fire, so it's not simply a matter of closing speeds, or relative speeds..

Re: V1.77

Posted: Sat Mar 16, 2013 6:28 am
by CmdrLUke
another_commander wrote:
Guys, the code works exactly as advertised. I just did this very simple check with the Falcon:
I bought a Falcon, hyperspaced to a new system and spawned a similar Falcon using the Debug Console. Then, I turned and started moving away from it. At some point, it turned red on me and started charging against me, but I had already gained something like 8km distance. Now, I slowly matched speed with it, but not quite, so that it was gaining distance very slowly and I kept monitring the distance indicator, waiting to see when my ship's rear turret would start firing. It started firing immediately once the range fell below 6000m.

As to why it appears that turrets don't fire before the target is at something like 5km away, this probably is because if the player moves towards the target and the target moves towards the player, by the time the AI has ordered the turret to start firing, the apparent distance is at somewhere between 5600-5400m. The actual moment the turret starts is at 6km, but it's the fact that the two ships move towards eachother that creates a false impression (or at least that's what I think happens). Also, sometimes when you are chasing a ship with a rear turret, it may appear that it continues to fire at you even past the 6km mark, but again this is a false perception. The last shot is fired just before going past 6km distance, but that last shot arrives at the player's ship when said distance has opened past the turret hold fire point.

In all my tests so far, the turrets work precisely as they are supposed to.
Are the extra guns on Hydras, Basilisks, and Rattle Cutters "ball turrets"? Because those definitely fire on me with all guns from way beyond 5-6km....

Re: V1.77

Posted: Sat Mar 16, 2013 8:40 am
by cim
CmdrLUke wrote:
Are the extra guns on Hydras, Basilisks, and Rattle Cutters "ball turrets"? Because those definitely fire on me with all guns from way beyond 5-6km....
They're fixed additional lasers, and have the same range as a normal laser of that type.

Re: V1.77

Posted: Sat Mar 16, 2013 8:48 am
by Eric Walch
Diziet Sma wrote:
(and yes, I've tried setting weapon_range to 7500.. doesn't work..)
Do you use the correct syntax? Because you only can add the max_range parameter with the new subentitie structure as advertised on the wiki.

EDIT: Just tested it again. The NPC falcon also uses the turrets between 6000 and 7500 meters if I raise weapon_range to 7500. It was a bug in Oolite 1.74 that fire_rate, weapon_range were set back to the default values after having been read in correctly, but it was fixed in 1.75. And as just tested, it still works as advertised with 1.77. The falcon only uses turrets at targets behind him. So make him flee, than start following him on injectors, and as soon you are within 7500 meters, the red plasma bolts start to appear.
(Not tested with falcon player but I see no reason why it should be different.)

You do need the new subentity definitions though:

Code: Select all

			{
				"subentity_key" = "bweed-falcon-turret";
				type = "ball_turret";
				position = (0.0, 6.5, -9.5);
				orientation = (0.25, 0.75, 0, 0);
				"weapon_range" = 7500;
			},
			{
				"subentity_key" = "bweed-falcon-turret";
				type = "ball_turret";
				position = (0.0, -6, -9.5);
				orientation = (0.25, -0.75, 0, 0);
				"weapon_range" = 7500;
			},

Re: V1.77

Posted: Sat Mar 16, 2013 10:25 am
by another_commander
One thing to remember (and I did not make it clear earlier, sorry about that) is that the distance checked for the turrets to start firing is not the same as the one displayed on the distance indicator on the HUD. The distance indicator shows distance to the bounding box edges where collision detection occurs, not distance to the center of the entity. This can be misleading when using just the HUD to judge distances. I did another test and documented it with screenshots, which I hereby present.

Before anything else, be aware that the code does allow the turrets to start firing just slightly beyond 6km (at +1%, i.e. 6060m) distance. For the test I used the Mamba with barrel code, published by cim in another thread related to frangible subentities. I replaced the barrel subentity with a ballturret, gave the Mamba a pirateAI and set its max speed to 0 to make life easier for me. Then I fired at it to make it my enemy and started testing.

First screen shows me approaching the Mamba. Note distances displayed on screen and on console. They are different and the console one is the one that matters. My actual distance as far as turrets are concerned is 6060.53m.
Image

Now I take one more little step, distance closes to 6058.81 and... here we go. The Mamba has just started firing the turret at full blast.
Image

I hope the above explains how and why it works as expected and why the distances can be sometimes misjudged. I have not tested what happens if the turret weapon range is set to the theoretical 7500m maximum but I believe Eric covered this already in his earlier post. Still, if there are unclarified points, feel free to ask.

Re: V1.77

Posted: Sat Mar 16, 2013 10:55 am
by Commander McLane
CmdrLUke wrote:
Are the extra guns on Hydras, Basilisks, and Rattle Cutters "ball turrets"? Because those definitely fire on me with all guns from way beyond 5-6km....
A ball turret fires plasma balls. A laser fires a beam. The difference between a slowly moving ball and a continuous beam should be quite obvious.

Re: V1.77

Posted: Sat Mar 16, 2013 11:03 am
by CmdrLUke
Commander McLane wrote:
CmdrLUke wrote:
Are the extra guns on Hydras, Basilisks, and Rattle Cutters "ball turrets"? Because those definitely fire on me with all guns from way beyond 5-6km....
A ball turret fires plasma balls. A laser fires a beam. The difference between a slowly moving ball and a continuous beam should be quite obvious.
It sure is, once you know that a "ball turret" fires "plasma balls." It is quite a reasonable assumption that a ball turret could be a laser turret with a "ball mounting" that can swivel, yes?