NPCs cloaking and (not) decloaking

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

NPCs cloaking and (not) decloaking

Post by Commander McLane »

Quite a number of the personalities ships have cloaking devices (not surprising, of course).

While testing their behaviour in fight, I noticed something which I think is a bug. Certain AI methods cause a ship to enable its cloaking device. The Wiki explicitly mentions performFlee, but I guess the same is true for performAttack.

However, it seems that the ship never again de-cloaks. I found ships which had been fleeing whilst cloaked. They had reached safety and were idling, but still cloaked. Others returned to their usual patrol behaviour after finishing an attacker, but were still cloaked. It seems the only situation that causes a de-cloak is being low on energy.

That seems buggy to me. After a successful fight (or a successful run) there is no reason to stay cloaked, so NPCs should de-cloak at a certain point. I'm not sure, however, which point that should be. The next performIdle? But it may be that they don't get a performIdle before the next action. Anyway, I think it would be a good starting point to make de-cloaking part of the set of actions performed during performIdle.

More control would be achievable with new AI methods switchCloakOn and switchCloakOff, but that's probably not necessary as such.

Thoughts?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Decloak on performIdle sounds more than enough for the AIs, at least to me.

However, specific cloak commands could be added to js.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Kaks wrote:
However, specific cloak commands could be added to js.
Already there.

ship.isCloaked is read/write for ships having a cloaking device, so it can be set to true or false.

So my temporary solution is to de-cloak in my ship script, and to call the function from the AI via sendScriptMessage.

I only don't know whether a direct AI method would be more economical than the sendScriptMessage?
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: NPCs cloaking and (not) decloaking

Post by Eric Walch »

Commander McLane wrote:
It seems the only situation that causes a de-cloak is being low on energy.
Thoughts?
Correct, npc has no off-switch for the cloak other than low energy. That makes cloaked ships actually weak as they only de-cloak when low on energy.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

I still have to work on my solution, anyway. Even de-cloaking when leaving the ATTACK state is insatisfactory, because practically it allows me to force my adversary to de-cloak by simply cloaking myself. He loses his target, exits from the ATTACK state and - de-cloaks. :?

So I have to refine the AI in this regard.
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

Tried putting the cloak_passive key in their shipdata entries?
Cloak_passive supposed to make a ship decloak when firing lasers/missiles.
At least it does for the player's ship. Eh, worth a try.
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

I have put it in for those people who requested it.

Still, it doesn't solve the problem of a NPC fleeing whilst cloaked, and then not de-cloaking when in safety.

EDIT: There is one thing I should add: Most of the personalities ships have very high energy recharge rates. This is because their human counterparts have Extra or Naval Energy Units. These are normally not available for NPCs, which are always stuck with recharge rates of between 3.5 and 5 (normal range). However, for a player ship the Extra Energy Unit will multiply this by 1.8, and the Naval Energy Unit even by 2.6, according to the code.

By the way: In vanilla Oolite this gives a huge advantage to the player. He can easily have about double the energy recharge of his NPC counterparts. Plus he has shields. The only thing NPCs can do is increase their max energy through shield boosters and shield enhancers (which also raises the energy recharge, but only by factor 1.5).

I want the personalities ships as close as possible to the individual players' ships, so I've given them increased energy recharge rates in order to reflect the presence of the one or other energy unit. This makes them quite a bit tougher than usual NPCs, which is actually a desired effect.
Screet
---- E L I T E ----
---- E L I T E ----
Posts: 1883
Joined: Wed Dec 10, 2008 3:02 am
Location: Bremen, Germany

Post by Screet »

Commander McLane wrote:
This makes them quite a bit tougher than usual NPCs, which is actually a desired effect.
Now the only problem is that most players appear to be bounty hunters instead of pirates and thus won't give us tough pirates this way ;)

Screet
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

..

Post by Lestradae »

My 0.2Cr:

I would suggest giving the cloak_passive key to all personalities.

And, concerning general NPC behaviour & cloaking, ships should only cloak when a) in dangerous territory or b) in a fight and their energy is at least half max.

No idea how easily doable the second part is, but that would look convincing imo.

Cheers

L
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Just to inform everybody that I've resolved the issue through a de-cloaking timer. IMO it's even better than to change what performIdle does, because performIdle is in many cases called in a moment when it is not (yet) wise to de-cloak.
Post Reply