Page 1 of 1

NPCs with frangible guns

Posted: Sat Nov 16, 2013 8:08 pm
by Disembodied
Is there any way for NPCs to realise that they don't have any guns? I just had a running on-off duel with an Iguana who had obviously been in a fight before I got to him, and had lost both his laser subentities. He'd go hostile and make an attack run, without being able to fire; I'd shoot him up a bit, he'd run away on injectors, only to return again later. He did, eventually, run out of fuel, and we found out he had four missiles (and quite a lot of loot inside him once he popped). But he behaved as if he had lasers.

I've always enjoyed shooting the guns off of Iguanas, Cats, etc. - it makes up for the fact that they've got two of them. But could they be made to notice when they're gone, and behave accordingly? Or would it be simpler (and fairer) just to make one gun on these guys non-frangible?

Re: NPCs with frangible guns

Posted: Sat Nov 16, 2013 8:13 pm
by Cody
Disembodied wrote:
I've always enjoyed shooting the guns off of Iguanas, Cats, etc.
I used to do that to Griff's chopped Kraits - but they're rather sad without guns.

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 8:57 am
by Thargoid
It can be done with scripting, to make a check if the sub-entities are present or not and then steer the AI in the appropriate direction. But it's certainly an advanced player set-up as it needs the two to interact and work with one another.

The new upcoming way of doing AIs with JS may make this simpler for people not so comfortable with scripting to do it, but it is possible anyway in the existing set-up.

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 10:08 am
by cim
The "performAttack" tactical AI in the Oolite core will (or at least it was earlier...perhaps I need to check this) respond to a lack of weapons by deciding "no laser weapons are able to fire - retreat until this changes". It'll still go red on you, but it should back off rather than moving in to attack, and hang around outside of beam laser range (where it could still perform a support role by ECMing missiles, scooping up salvage, and so on)

The strategic AI in the AIs/ folder is harder. It's relatively easy to make it check if it has weapons before attacking - and in 1.79 the lack of laser weapons will go very harshly against it in a combat odds assessment anyway - but it's a check that the majority of ships will never need to do, and it makes all the AIs a little more complex and less efficient to include it. On the other hand, if the check isn't done it makes it much harder to place ships with only frangible lasers in standard roles - like the Iguana or the Cat.

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 11:28 am
by Disembodied
cim wrote:
The "performAttack" tactical AI in the Oolite core will (or at least it was earlier...perhaps I need to check this) respond to a lack of weapons by deciding "no laser weapons are able to fire - retreat until this changes". It'll still go red on you, but it should back off rather than moving in to attack, and hang around outside of beam laser range (where it could still perform a support role by ECMing missiles, scooping up salvage, and so on)
Hm ... this sounds like what the Iguana was probably doing. It did keep on coming back into scanner range, but it didn't close in on me. I think the issue here is "... retreat until this changes", because obviously this wasn't going to change: definitely more of a strategic issue than a tactical one! I can see the merit in an NPC hanging around as part of a group and performing a support role, but in this case our friend Iggie was by itself.
cim wrote:
The strategic AI in the AIs/ folder is harder. It's relatively easy to make it check if it has weapons before attacking - and in 1.79 the lack of laser weapons will go very harshly against it in a combat odds assessment anyway - but it's a check that the majority of ships will never need to do, and it makes all the AIs a little more complex and less efficient to include it. On the other hand, if the check isn't done it makes it much harder to place ships with only frangible lasers in standard roles - like the Iguana or the Cat.
Perhaps it might be worth considering the whole issue of frangible weapons. Like I say, I enjoy shooting off their guns but it does tend to make Iguanas, Wolf Mk IIs, Cats, etc. rather less dangerous than they might otherwise be. If you catch them early enough, a relatively short burst from a military laser - less than it would take to splash a Sidewinder - can render them pretty much harmless. Maybe it would be easier just to make one laser non-frangible. Or maybe frangible lasers could, when franged (?), be replaced with a non-frangible, lower-power "damaged laser"?

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 11:43 am
by cim
Disembodied wrote:
I can see the merit in an NPC hanging around as part of a group and performing a support role, but in this case our friend Iggie was by itself.
Ah, now that probably can be fixed - there's a damage assessment routine in 1.79, so I can add a "how many subentities are we missing" check to that, which combined with the terrible odds assessment for having no weapons is likely to make an Iguana that badly damaged immediately return to base.

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 12:32 pm
by Smivs
cim wrote:
...there's a damage assessment routine in 1.79, so I can add a "how many subentities are we missing" check to that, which combined with the terrible odds assessment for having no weapons is likely to make an Iguana that badly damaged immediately return to base.
Will this be able to cope with non-weapon sub-ents which are intentionally removed by script - in other words those which are intended to be absent sometimes and which have no negative affect on the ships performance either in general or specifically in terms of combat readiness?

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 12:50 pm
by cim
Smivs wrote:
Will this be able to cope with non-weapon sub-ents which are intentionally removed by script - in other words those which are intended to be absent sometimes and which have no negative affect on the ships performance either in general or specifically in terms of combat readiness?
I think it would only make sense to count armed subentities - either laser or plasma turret - in this.

Re: NPCs with frangible guns

Posted: Sun Nov 17, 2013 2:34 pm
by Smivs
<nods>