Page 2 of 2
Posted: Tue Jan 01, 2008 8:14 pm
by Cmdr James
Also, ShipEntity.m trackPrimaryTarget at about line 4577 returns if scanClass is missile (it executes the new supercool code we are talking about
)
So I think the code at about 4655 if not reachable.
Code: Select all
// treat missiles specially
if ((scanClass == CLASS_MISSILE) && (d_forward > cos(delta_t * max_flight_pitch)))
{
OOLog(@"missile.track", @"missile %@ in tracking mode", self);
[self trackOntoTarget: delta_t withDForward: d_forward];
return d_forward;
}
[code]
If I understand correctly (and objective C is not my forte) we can remove this code completely, as it should never be reachable, (unless an item can become a missile due to some kind of race condition while this method is executing, which seems kind of unlikely). Maybe the OOLog should be moved up to the first block around 4577 so that we get the expected output?
Posted: Thu Jan 03, 2008 12:59 pm
by Arexack_Heretic
how about pilot-rating/bounty/ship-price etc determine some fraction of the missile random accuracy?
In effect making it an inherited value from the launcher's skills.
edit:
or equipment check for missile guidance and tracking systems, giving a boost to the semi-random value if found. This would favour well equiped, rich, thus presumably also experienced pilots.
Posted: Thu Jan 03, 2008 2:35 pm
by Hoopy
except that a good pilot with a good ship etc is less likely to have need of a good missile as they're likely to be good with lasers already. And the novice pilot with a Mk III and pulse lasers is likely to rely on missiles early on so needs them to be good.
I like the idea of variable ability for missiles but I can't think of way to use it which makes actually the game better.
Maybe missiles bought at lower tech worlds could be worse?
or maybe have several types of missle of varying cost/ability/tech level required?
Posted: Thu Jan 03, 2008 2:39 pm
by another_commander
Have a look at the missile options OXP by Cmdr Maegil. Details in the Expansion Pack section. This is a good way of using the new functionality for missiles.
Posted: Thu Jan 03, 2008 3:29 pm
by Arexack_Heretic
I was thinking of the NPCs use of and skill with missiles actually, not really the player.
(who can buy and use missiles as his own skill and money allow, I wouldn't want to script the player ...not like this anyhow.
)
Posted: Thu Jan 03, 2008 3:42 pm
by Captain Hesperus
Arexack_Heretic wrote:( I wouldn't want to script the player ...not like this anyhow.
)
More like:
Code: Select all
playership.BuyTrumble.SetToAccept
playership.AllowTrumbleMultiplication.SetToAccept
playership.DeliverTrumblesToTrumbleCollector.SetToAccept
Captain Hesperus
....
Posted: Thu Jan 03, 2008 5:32 pm
by Cmdr. Maegil
newspeak.oxp?
Re: Missile intercept code
Posted: Sat Aug 27, 2011 2:23 pm
by Eric Walch
Cmdr James wrote:Guys, I have made a small modification to the code used for the missile interception logic. It is now, normally much more likely to strike a target, as it will predict the target location based upon its current velocity. I guess it might be better to add some damping due to the imperfect ability to read a target velocity?
There is one bug in the prediction code. For a long time I use missiles to shoot away incoming hardheads. I have a special set with an accuracy of 8 and very often they start flying the wrong way. Today I looked a bit deeper in it. For 90% of the time of the incoming missile, my fired missile even stayed behind me and did not fly towards the incoming one. Setting accuracy to zero fixed the problem.
Looking at your code, I see that it assumes the missile is in pursuit of the target and heads not for the missile itself but for a position in front of the target, based on the travel time. But with a head-on approach towards a fast flying ship, it can happen that it calculates an interception point that even lies further away than the current distance. I have not tested this, but it should also mean that when you inject towards an incoming missile, that missile might get confused.
(EDIT: I just tested it with a missile with accuracy=8 that was fired at me:
player.ship.heading.dot(player.ship.target.heading)= 0.9703339338302612
The value near 1 means the missile was fleeing from me when I injected toward it
)
I suggest adding a line that calculates the dot product between own and target forward_vector. And only use your accuracy code when in persuit.
Code: Select all
inPursuit = (dot_product([target forwardVector], v_forward) > 0.0f);
With this addition, my missiles now hit the incoming ones from the air when a high accuracy was defined. Before it only worked correct when defining a low accuracy what seemed a bit strange.
Browsing through some missile containing oxps I could only find one using the accuracy setting and that was the abs missile from nukes.oxp. For any other missiles without an accuracy setting, this effect will be not present.
Re: Missile intercept code
Posted: Sat Aug 27, 2011 5:55 pm
by Cmdr James
Good work. I think you are right.
Unfortunately I never got around to sorting out my git access properly, maybe someone else can commit your change?
Re: Missile intercept code
Posted: Sat Aug 27, 2011 8:26 pm
by Eric Walch
Committed it now.
Those strange missile launches made me wonder for over a year, but I always thought it was part of the normal randomness. Only today when looking at the code the pieces fell together that the defined accuracy of my missile had to do with it. And normally ships flee for missiles and is a missile always in pursuit.