NPCs cloaking and (not) decloaking
Moderators: winston, another_commander, Getafix
- Commander McLane
- ---- 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
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?
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?
Decloak on performIdle sounds more than enough for the AIs, at least to me.
However, specific cloak commands could be added to js.
However, specific cloak commands could be added to js.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Commander McLane
- ---- 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:
Already there.Kaks wrote:However, specific cloak commands could be added to js.
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?
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: NPCs cloaking and (not) decloaking
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.Commander McLane wrote:It seems the only situation that causes a de-cloak is being low on energy.
Thoughts?
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- 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:
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.
So I have to refine the AI in this regard.
- Cmdr Wyvern
- ---- E L I T E ----
- Posts: 1649
- Joined: Tue Apr 11, 2006 1:47 am
- Location: Somewhere in the great starry void
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.
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
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
- Commander McLane
- ---- 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:
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.
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.
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
..
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
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
- Commander McLane
- ---- 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: