Author Topic: $Free Flight Time: question  (Read 8889 times)

0 Members and 1 Guest are viewing this topic.

Re: $Free Flight Time: question
Turns out wanderer was testing with retail vps - mediavps don't have a problem
STRONGTEA. Why can't the x86 be sane?

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: $Free Flight Time: question
However there seems to be some accuracy issues related to the code change combined with the 'fire down normals' flag... For example triton multipart turret was unable to hit stationary uly from 250 m even after giving it 3 minutes time to try. Without either (or both) of the code change and the flag in use the turret was able to hit the same target almost immediately.

Well.. since the turret ALWAYS fires exactly along its firing normal if the flag is set, it depends on the turret being EXACTLY pointing towards the target.
And since the later weapon creation code also adds a certain inaccuracy with the $FOF: value, this can indeed get difficult.

I'd say fire along normals really only makes sense for missile launching turrets.  I mean other turrets can't have relied  on the flag until now since it had no effect anyway.

if one doesn't want a multipart turret to start shooting before it is roughly aligned with its target, well that's what the fire-on-target flag is for, which only checks what the turret is roughly
pointing to before firing, but it doesn't change the firing vector.

So I'd say we're fine here..

Yeah.

Just wanted to see what is wrong and it seems the problem with the accuracy of the turrets is related to the actual models or other game data. I was testing with retail while portej had mediavp version in use. With retail version turrets missed by couple of ship lengths (in uly) while mediavp model was dead accurate.

Also.. do you (keldornkatarn and others) think the firing angle of the weapons, when using the 'fire down normals' flag should be improved? Now it is kinda limited and probably prevents try 'vertical launch system' style launchers from working except when the turret is almost pointing at the target. Or if they work well enough already then that can be left alone

Code: [Select]
...
if ( !(wip->wi_flags & WIF_HOMING) )
{
if ((dist_to_enemy < 75.0f) || (dot > AICODE_TURRET_DUMBFIRE_ANGLE ))
..
else if ( wip->wi_flags & WIF_HOMING_HEAT )
{ // if heat seekers
if ((dist_to_enemy < 50.0f) || (dot > AICODE_TURRET_HEATSEEK_ANGLE ))
..
else if ( wip->wi_flags & WIF_HOMING_ASPECT )
{ // if aspect seeker
if ((dist_to_enemy < 50.0f) || (dot > AICODE_TURRET_DUMBFIRE_ANGLE ))
..
else if ( wip->wi_flags & WIF_HOMING_JAVELIN )
{ // if javelin heat seeker
if ((dist_to_enemy < 50.0f) || (dot > AICODE_TURRET_DUMBFIRE_ANGLE ))
..
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: $Free Flight Time: question
I think it works just fine. I wanted this because we have a "single part forward torpedo launcher tube thing" ;)
That one launches, the missile uses 1 seconds free flight time as specified in weapons.tbl, then turns towards the target.  Whether this works well or not really only depend on the turn rate of the missile and the distance from target. A very close target at 90° to the side will probably be missed, since a torpedo cannot turn fast enough. but otherwise this seems to work just fine, so I don't see why vertical missile launchers shouldn't work. The missile will launcher, then turn towards the target and start homing.

 
Re: $Free Flight Time: question
Ahhh, now I'm seeing what you mean.. No wanderer, the angle can stay exactly the same. Reason:

That 'dot' variable is calculated using the temporary vector to target, NOT the one used for the weapon later. So this angle is always the same, whether you activate the flag or not.

The tv2e vector was calculated exactly for this.. for angle and field of view checks. It is always the same.. pointing from the turret towards the target.

Without the flag this vector is identical to the one later used to launch the weapon. If you set the flag, the weapon will be launched along the turret normal but the vector used to calculate the dot-product will remain unchanged. So there is no need to improve any angles, since they don't change.

 

Offline captain-custard

  • previously known as andicirk
  • 210
  • one sandwich short of a picnic
Re: $Free Flight Time: question
use the modify button .........;
"Duct tape is like the force. It has a light side, a dark side, and it holds the universe together."

 
Re: $Free Flight Time: question
I will if the original information was wrong. Since in this case it is still relevant, I'll post a new message. If any admin wants to merge the two posts.. whatever.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: $Free Flight Time: question
Yes... but what i was referring to is that with the current setup it does seem to be possible to make a sp missile launcher (like the one in Aegis cruisers front deck) that is capable of firing weapons at the true field of view (firing limits) of the turret.

As the dot is the angle between the vectors (of turrets normal - not facing - and the targets direction)

Basically at the moment weapon firing is allowed if target is first within the defined turret fov and then if the target is - depending from weapon type - within certain angle from the turrets normal (axis of the turrets base's rotation). For heat seekers this it atm fixed to 45 degrees and for the rest its 37 degrees. If the target is outside this code weapon firing is not allowed (with the code change and the flag in use).
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: $Free Flight Time: question
I don't see where this code change changes ANYTHING in terms of when firing is allowed. As I said, the firing vector is not used for such calculation. it wasn't before and it isn't now.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: $Free Flight Time: question
Try following... make a single part missile launcher with the 'fire down normals' flag. Arm it with missiles that are fired at your ship and make sure the set fov of the turret is close to 180 degrees. Make sure you are flying at highest difficulty. Then approach the turret very slightly above and from the side of the turret (make a flyover). If the code mentioned above has nothing to do when firing is allowed then turret should start firing the moment (or shortly after) when you fly within the range of the weapon.. Which it doesn't do. However when you approach the turret you will probably go within the firing angle limitations i mentioned in previous post and turret starts firing missiles.
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: $Free Flight Time: question
from what i can see this is not a problem of this flag but a symptom of the "turrets dont fire" bug, and it is very well demonstrated in the test mission I uploaded in that mantis report. For me certain tuurrets, including missile launchers, simply do not fire at all in certain situations, flag set or not.

and if you do not believe me that the flag makes no difference in fov calculation then stop testing missions but look at the code. in missions some other problematic behavior can interfere, in the code you see whats calculated and if that is consistent then the problem lies elsewhere

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: $Free Flight Time: question
Missile turret weapon firing is limited according to difficulty level. I am fully aware of that setting and i was not referring to it at all. Only to issues related to 'fire down normals' flag and fixed firing cone limitations (aicode angle settings).
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: $Free Flight Time: question
Missile turret firing is NOT limited. It is limited if they fire at the player and I'm not talking about turrets not firing at ME I'm talking about turrets not firing at all.

And again: The flag code change doesn't change ONE THING about how the angle is calculated. If you would at least take a look at the code I'm talking about we'd finally be able to talk about the same issue.

If you disagree then show me where it is used, and don't tell me what the game is doing. The game behavior can be caused by all sorts of things but so far I found no evidence in the code whatsoever that the fire-along-normals flag code change changes ANYTHING about when a turret is allowed to fire and I see no point in discussing that any further as long as nobody shows me the spot in the code that I missed.

I cannot comment behavior that I don't see in the code. If it is there, show it to me.


PS: TO clearify, here's the code:

// This line calculates both the global turret position (gpos) and the global turret firing vector(gvec)
ship_get_global_turret_gun_info(&Objects[parent_objnum], ss, &gpos, &gvec, use_angles, &predicted_enemy_pos);


// Here gpos is used to calculate a second direction vector, (v2e) vector to enemy, which may be identical with gvec, if the flag isn't set, or is different if the flag is set.
vm_vec_sub(&v2e, &predicted_enemy_pos, &gpos);
dist_to_enemy = vm_vec_normalize(&v2e);
dot = vm_vec_dot(&v2e, &gvec);

// As you can se, dot is calculated as the cosine of the angle between vector to enemy and the firing vector of the turret.
// Now if the flag was not set, these two vectors would be identical, hence dot would always equal 1 ( cos(0°) = 1 )
// If it is set, then this is used as always to calculate field of view stuff. So this is nothing new, it's just that before dot was ALWAYS 1.

// Now, dot is used in stuff like this:
if ((dist_to_enemy < 75.0f) || (dot > AICODE_TURRET_DUMBFIRE_ANGLE ))

// Now this doesn't change anything. it's just that without the flag, dot is always 1, meaning the dot is ALWAYS larger than the specified angle (unless that one is exactly 1 too. maybe this
// should be a >= instead here.
// WITH the flag, this will be used now. Which is perfectly logical. A turret that fires its missile always at the enemy can shoot always.
// A turret that fires along a normal first should only fire when firing makes sense.

// So I don't see anything new here, it's just that those angles now finally make sense.


If THIS is what you meant, then yes.. those angles migth need checking, but otherwise, the codechange didn't change a thing, since this was the same as before. the turret now only fires in the correct direction. THis checking code works exactly as before since the change doesn't affect this at all.
So the turret's "can I fire" behavior is exactly as before, only that with the flag they now fire along the normal, as originally planned.

Before the calculated vector was only used to check if firing was allowed, but the missile was always launched directly at the enemy.
Now the calculated vector is used to check if firing is allowed AND for the direction the missile will be launched at.
« Last Edit: July 05, 2009, 10:57:15 am by KeldorKatarn »

 
Re: $Free Flight Time: question
I just noticed... that dumbfire angle is used for aspect locking missiles as well as for non-homing weapons... for the latter ones it seems a bit large actually.. (or rather small, since the constant is the cosine of that angle)

0.8 is a 36.8° angle resulting in a 73.3° firing cone. That's a bit much for dumbfire :P It's ok for aspect seekers though.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: $Free Flight Time: question
Just try it out will you?

Replace the AICODE_TURRET_DUMBFIRE_ANGLE (or heatseeker) with both 0.0f and say 0.95f and you should be able to see that it severely affects the turrets
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: $Free Flight Time: question
Have you even read what I just wrote?

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: $Free Flight Time: question
Yes
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: $Free Flight Time: question
Then where did I write that those Constants didn't have any meaning? I just said they work just like before the code change.
The change doesn't affect this at all so if you're not happy with those angles now then you were not happy with them before this change since nothing changed in that calculation.

The only thing that changes is in what direction the missile is launched when the flag is set. Nothing else has changed.