NPCs with frangible guns

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

NPCs with frangible guns

Post 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?
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: NPCs with frangible guns

Post 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.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: NPCs with frangible guns

Post 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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: NPCs with frangible guns

Post 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.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: NPCs with frangible guns

Post 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"?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: NPCs with frangible guns

Post 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.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: NPCs with frangible guns

Post 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?
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: NPCs with frangible guns

Post 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.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: NPCs with frangible guns

Post by Smivs »

<nods>
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply