fightOrFleeMissile

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

fightOrFleeMissile

Post 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 . . . .
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: fightOrFleeMissile

Post 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.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: fightOrFleeMissile

Post 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.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: fightOrFleeMissile

Post 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.
Last edited by Eric Walch on Tue Jun 28, 2011 8:56 pm, edited 1 time in total.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: fightOrFleeMissile

Post 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!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: fightOrFleeMissile

Post 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.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: fightOrFleeMissile

Post 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.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: fightOrFleeMissile

Post 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!
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: fightOrFleeMissile

Post 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?
Post Reply