In 1.9 it would be cool to make stealth mechanics more viable and interesting. Here are a few ideas:

Core Concepts

In general, all objects have a stealth value and a perception value. If perception value is equal to stealth value, then the object is visible at 100 light-seconds or less. If stealth is higher, visibility distance decreases; if lower, distance increases.

The targeting computer can acquire a target lock on any visible object. When we have a target lock, we see the object in our targeting computer and get its stats (damage, shield state, etc.). We can also fire tracking missiles at the object.

If the targeted object becomes invisible, then the object is selected but we don't have a target lock. We do not get stats for a selected object and we cannot fire tracking missiles. We can fire omnidirectional weapons, but their aim will have an error proportional to the time since they were last visible.

If the target later becomes visible, we reacquire a target lock.

If a target fires a weapon or thrusts, it loses 4 points of stealth for some (short) period of time.

NPCs may target any visible object. If the targeted object later becomes invisible, the NPC gets a displaced position for the object proportional to the last time it was visible (to the NPC). For example, if an NPC is chasing the player and the player enters a nebula, the NPC will look for the player at a random point away from their true position with distance proportional to the time since the player disappeared. As that distance grows, eventually the NPC might abandon the chase.

Tracking Missiles

Tracking missiles should honor stealth appropriately. When a tracking missile launches, if the target is not visible, the missile will not fire. If the player is launching, they get a beep and "No target lock" appears as a status message.

For NPCs, the AI will not select a missile launcher unless we have a target lock.

If a tracking missile is in flight and the target becomes invisible (to the missile), then the missile loses target lock and stops maneuvering to the target. Some missiles can reacquire the target if the target later becomes visible; others do not.

Different missiles might have different behavior. For example, some missiles might have higher than normal perception. Others might have lower than normal (and would be cheaper). Some missiles might be lock on engine emissions and thus be able to lock if the target is thrusting.

When targeting a stealthy, immobile station, the player can not acquire a target lock until the station is visible (meaning the player must get closer).

Enhancements

  • Cloaking device: This is probably a high-level item (maybe only in Part II?). It increases stealth significantly and is immune to laser weapons, but it takes a shield slot and does not function while thrusting or firing (unless using stealth weapons/engine).
  • Stealth drive: No stealth penalty for thrusting.
  • Dazzler device: Selected target gets -8 perception; all missiles in range get -4 perception.
  • Integrated scanner: Gain extra perception from autons.
  • Stealth launcher: Fire missiles with no stealth penalty.

See Also

derakon 14 May 2019:

Being able to lose pursuing AI ships because you get far enough away from them will be a big change. How will you handle station defense / headhunter ships that appear at a stargate and chase the player? Will you be able to get AI ships to waste their ammo by flying at the limits of their detection radius and periodically "making noise" so they can briefly acquire a target lock?

Rather than have competing perception and stealth values, I think it would be simpler to just have a stealth value and assume everyone (or at least, all AI ships) has equal perception. The main reason for this is to communicate to the player what affects their stealth. It's easy to show a "noisiness" indicator showing how stealthy you're being, and you can e.g. draw a ring in the LRS to show how far out you can be detected. And you can see how that value changes depending on your actions and your gear. But if different ships can see you from closer or further, then it gets a lot harder to tell how effective something is; now there's not just one threshold you need to pass, but a spectrum which varies depending on something you have no real control over.

If you really want to have AI ships that are good at detecting the player, I'd just make it flat-out impossible to hide from them, rather than giving them high perception scores. Maybe this is how you handle station defenders and headhunters. You could put something in the targeting data to indicate that they have stealth-defeating tech or are being guided by a diffuse sensor grid spread throughout the system or something.

the_shrike 14 May 2019:

One thing: AutoAcquireTarget missiles are sometimes usable to aim at something you can't track yet, so should probably be possible to fire regardless. You can also use them as dumb-fire rockets..so I'm not sure that stopping them from firing is the best idea.

Also, the beep will cause problems with rapid-fire weapons causing eardeath.

giantcabbage 15 May 2019:

Shot collision detection

I assume that unguided weapons (e.g. laser etc) will still hit invisible objects. This would allow a (skilled) player an advantage over NPCs as it is possible to find invisible objects just by firing blindly - after which you can simply track the ship via the hit effect / shots disappearing. We could:

  • Decide this does not matter as it is an AI limitation
  • Allow some degree of pass through for invisible objects. Maybe have a change-to-miss which varies from 0 to 90 / 95% as the target becomes invisible (this would not apply to area of effect / shockwave weapons)
  • Apply a temporary penalty to stealth every time an object is hit

Asteroid fields

It would be good if the player (or NPCs) could hide in asteroid fields. The mechanics should be slightly different to nebula. Maybe stationary objects in an asteroid field get a stealth bonus

Other

  • Shields - should shields include a stealth penalty when active (i.e. player must disable shields to improve stealth)?
  • Blind - should apply a penalty to perception (Blind doesn't do anything to NPCS)
  • Chaff - could provide a short stealth bonus to help break missile lock
  • Blinding missiles - some heavy weapons (e.g. nukes etc.) could apply a temporary perception penalty to any objects in range (this could be a side effect or the main aim of the weapon).
  • Sensor device - could have improved sensors / military sensors which provide increased perception. Some could also have a penalty to stealth (e.g. for active radar-like sensors)

Rather than have competing perception and stealth values, I think it would be simpler to just have a stealth value and assume everyone (or at least, all AI ships) has equal perception.

I think different AI ships should have different perception values e.g. it should be much harder to hide from an Ares destroyer than a Centauri raider.

derakon 16 May 2019:

My experience with stealth in other games is that it works best when it's clear where you can and cannot go without being seen. That was the motivation behind suggesting all ships have the same perception scores (and to be clear, that's only a suggestion, and I'm not going to defend it vociferously :)). From a simulationist perspective, yes absolutely different ships should have different perception scores. From a gameplay and understanding-what-is-going-on perspective, all ships having the same perception means that there's a very clear line of "ships closer than this distance can see you".

That said, being able to blind ships seems perfectly reasonable. That suggests three levels of perception: can always see you, can never seen you, and can only see you if they're closer than your noise radius. I also like the idea of nebulae/asteroid belts providing a stealth bonus to the ships that are in them.

george moromisato 16 May 2019:

I love all the ideas here. A few comments:

  • It might help if the player could tell whether they are hidden or not. I'm not sure exactly how to show this. Perhaps when you target an object it tells you whether they can see you. Or perhaps there is a general indicator that tells you whether anyone is scanning you right now.
  • I agree on blinding; that should impact the enemy ship's perception. This should be relatively easy to implement once the other AI changes are in place.
  • It's true that firing blind would hit invisible objects, and I think that's OK. NPCs should also fire blind. In the algorithm that I'm thinking of, the NPCs would still think they see the target, but the position they get is offset from the true position. The offset would grow over time, so at first the NPC might be somewhat accurate. Note also that if an invisible target fires, they lose stealth for a bit of time (the offset would reset to 0). But we should try it out and see how it works.
  • @Derakon has some good questions on whether it will be possible to trick NPCs into wasting ammo. I'm not sure exactly how they'll behave or whether the behavior will be worse than today (you can trick them into wasting ammo today by dodging or point-defense). I'd like to try it out and then adjust as necessary. We may need to make the AI smarter, which is never a bad thing.
  • I'd love to have a line-of-sight algorithm to allow you to hide behind asteroids/planets (and conversely to have enemies hidden behind them). But I don't think the performance will be acceptable (and even if it is, I think it would be a lot of work).
  • Note also that nebulae only hide you if you're actually inside. They do not block line-of-sight. For example, if an enemy is inside a nebula, then it gets +6 stealth. But if it is in a pocket of empty space inside a nebula, then it is visible normally. Similarly, if a ship is in empty space on the other side of a nebula, you can see it perfectly well, even if the nebula is in the way. In the future, I'd love to do a line-of-sight calculation so that we can have more hiding places.
  • But I do like the idea of asteroid belts providing a stealth bonus. This requires a bit of work because we would have to define asteroid regions (the way we define nebula regions).
giantcabbage 16 May 2019:

Rather than a full line-of-sight algorithm you could try having fuzzy edges to environmental stealth bonuses, with the stealth bonus gradually decreasing across the border. This way a pocket inside a nebula would likely still provide a moderate stealth bonus so you avoid the problem of objects suddenly becoming visible on the other side of the nebula.

Line-of-sight performance might be acceptable if it was only applied to planets (not asteroids). But it would still be a lot of work to implement. Perhaps planets could provide a stealth bonus to objects on top of them instead of blocking weapon fire.

derakon 16 May 2019:

You could implement detection near environmental obstacles by having the ship fire an invisible zero-damage homing lightspeed projectile at the player, which pierces ships/stations but is blocked by asteroids, planets, and nebulae. If it hits the player then the ship can see the player, if it misses then it can't. Fire projectiles once a second or so, only when the player is close enough to the ship, and only if the ship is hostile to the player. I doubt that would hurt performance any.

relanat 22 May 2019:

I agree with Song/Shrike about the tracking missiles still firing when the lock is disabled but the target still selected. It can be useful to launch a barrage of tracking missiles into the general area where the target was, even if they aren't actively tracking.

Possibly the targeting display could still show the ship name, etc but the image background could show a static/screen snow effect (like the LRS in nebula) when the target is no longer 'visible'.

And the stats could be frozen until the target is visible again, and then update?