Disembodied wrote:As Albee points out, there's no really good defensive strategy for dealing with cloaked ships (especially fast cloaked ships). A range of responses – including scattering in all directions, occasionally milling about in panic (performTumble combined with "What? Where? How?", etc.) – might be appropriate. The cloaking device should be unique to the player, or at the least, very very rare, so most ships won't really know what's going on most of the time.
I have been playing a bit with this. In trunk the pirates now have code that remembers the identity of a
known ship that suddenly cloaks. I ported that code also to traderInterceptAI (used by traders) and to interceptAI (used by escorts, hunters and police). It looks good that a ship reacts in some way on a target that suddenly disappears. (Almost always the player)
Starting cloaked and than attacking is a different situation. The ship than has no idea who attacked him. And when a ship suddenly re-appears on the scanner, the victim can't be sure that this is the attacker. (Easy to make it known in code, but that feels as cheating). That means there is no reason to attack that ship. However, the current situation that a ship does not react at all to cloaked attacks, feels also wrong. It should at least alter its course as respond to an attack.
Fleeing ships currently jink away during fleeing. This jink position is placed on the attacker and when the attacker moves, the jink position moves also and the fleeing ship responds to it. For an invisible attacker this is impossible and the current AI gives no option to let ships alter course in a different direction. performTumble is no option as it is actually a bug in itself as it instantly sets the speed to zero. (You can scrape the pilot from its cockpit screen after that command) There is a command to set the destination to its current location. When starting with zero speed that leads to departing in random directions. I did test it, but for a moving ship it means that the current position will always lie behind the ship and the ship will just keep flying in the same direction. That asked for a new command:
setDestinationToJinkPosition
. That seems to work. There has always been a special AI message for a cloaked hit, but I never fond a suitable use for it. This command will do the trick. After every hit, it than changes course in a random direction. For the player it will be almost as easy to kill the ship, but at least it does not feels so stupid anymore.