Page 1 of 1

fightOrFleeMissile

Posted: Tue Jun 28, 2011 5:01 pm
by m4r35n357
To quote the docs (my emphasis in italics): "Deals with missiles by searching a missile heading for itself or one of its escorts. When found it uses ECM if available, flees if no ECM available. It marks the launcher as offender if targeting a police. Returns: "FLEEING" or nothing."
So, why, in all the AIs that I have studied, is this invariably followed by "setStateTo: FLEE"? This seems wrong, as it does not allow for the possibility of using ECM and NOT fleeing, and it is also redundant because if there is no ECM then the ship flees THEN sets state to "FLEE", IYSWIM.
Are the docs wrong, or is there a better explanation available. In the meantime I shall experiment with removing the "setStateTo: FLEE" in my code . . . .

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 7:45 pm
by Switeck
What if the NPC ship ECMed, but the ECM-resistant hardhead missile didn't die?
Because from what I've seen, the NPC ships don't seem to consider they need to ECM again and/or flee like mad.

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 8:13 pm
by m4r35n357
Switeck wrote:
What if the NPC ship ECMed, but the ECM-resistant hardhead missile didn't die?
Because from what I've seen, the NPC ships don't seem to consider they need to ECM again and/or flee like mad.
Well for my purposes the ship would just have to consider itself unlucky - I've been there enough times and I have no sympathy whatever ;) Then I return to my second point: ie. the ECM works, but the ship flees anyway.
I'm still experimenting to see if there is an observable effect in practice.

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 8:49 pm
by Eric Walch
m4r35n357 wrote:
......Returns: "FLEEING" or nothing."....
Are the docs wrong, or is there a better explanation available. In the meantime I shall experiment with removing the "setStateTo: FLEE" in my code . . . .
The FLEEING message is a bit of nonsense, there you are right. The only reason for this message I can think of, is that this was the original situation when hardheads were not introduced in Oolite.
With hardheads it is better to always flee to be on the sure side and I don't know of any AI that effectively uses the FLEEING message. All existing AI jumps to a fleeing state no matter of the result. What is missing in the docu, is that the target is switched to the missile by this command. So, with ECM being effective, the AI will soon get a TARGET_LOST message, while with a hardhead, the code still will continue to flee.

The current traderInterceptAI even repeats its ECM action every 10 seconds if there is a hardhead pursuing him that refuses to pop.

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 8:54 pm
by m4r35n357
Eric Walch wrote:
The FLEEING message is a bit of nonsense, there you are right. The only thing is that this was the original situation when hardheads were not introduced in Oolite.
With hardheads it is better to always flee to be on the sure side. What is missing in the docu, is that the target is switched to the missile by this command. So, with ECM being effective, the AI will soon get a TARGET_LOST message, while with a hardhead, the code still will continue to flee.
Thanks Eric, that makes things easy for me - I'll just let the ship take it's chances ;) Fleeing is not as good for the spectacle!

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 9:00 pm
by Eric Walch
What is also missing is that the ship always goes into a performFlee mode by this command alone when there is no ecm available.

So a more logical thing would be to only go to the flee state if you get the FLEEING message, because when you receive that message, you know your ship has no ECM. At least when you want to take your chances when ecm was available.

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 9:14 pm
by m4r35n357
Eric Walch wrote:
What is also missing is that the ship always goes into a performFlee mode by this command alone when there is no ecm available.

So a more logical thing would be to only go to the flee state if you get the FLEEING message, because when you receive that message, you know your ship has no ECM. At least when you want to take your chances when ecm was available.
Hmm, food for thought, digesting . . . thanks.

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 9:19 pm
by m4r35n357
Eric Walch wrote:
What is also missing is that the ship always goes into a performFlee mode by this command alone when there is no ecm available.

So a more logical thing would be to only go to the flee state if you get the FLEEING message, because when you receive that message, you know your ship has no ECM. At least when you want to take your chances when ecm was available.
Right thanks, got it, I'll test this idea and compare it with my more brutal approach & see how they dance!

Re: fightOrFleeMissile

Posted: Tue Jun 28, 2011 10:04 pm
by m4r35n357
Early indications (not statistically significant) are that removing the "flee always" improves general fightiness, and that allowing ill-equipped ships to flee does not spoil the fireworks . . . continuing to monitor.
This might be worth adding to the default scripts maybe?