perf(awareness): skip echo work for the whole frame while pulses rest

The detection overlay asked the echo field for every visible flight,
military aircraft and vessel on every frame while a subject was
selected, projecting each to the ground before learning the pulses were
resting. It now checks awarenessEchoActive once per frame and builds no
echo paths at rest, and awarenessEchoAt checks the level before the
projection.

A detectionHost test with six echo-eligible flights checks that a
resting frame asks for the level fewer times than there are contacts
and paints no echo; it fails on the per-contact path.

The pulse and echo policy doc comments are attached to their constants
again, and one long comment line is re-wrapped.
This commit is contained in:
Manjunath committed 2026-11-03 21:22:36 +05:30
1 parent 686bc4fd0e
commit 3c6c342b2b
5 files changed
+82 -9

No files matched your search

+3 -1
View File
@@ -54,6 +54,7 @@ import {
isCyberContactThemeActive as isCyberMapThemeActive,
} from '../cyberSonar.js';
import {
awarenessEchoActive,
awarenessEchoBracket,
awarenessEchoColor,
getAwarenessEchoField,
@@ -1344,7 +1345,8 @@ function _drawOverlay(frame) {
const bracketPaths = new Map();
// Global Context sonar echoes: a second bracket, banded by strength, around
// each flight or vessel a pulse front has just crossed.
const echoField = getAwarenessEchoField();
// Resting pulses light nothing, so the per-contact echo work is skipped.
const echoField = awarenessEchoActive(now) ? getAwarenessEchoField() : null;
const echoPaths = echoField ? new Array(ECHO_ALPHA_STEPS + 1) : null;
const pathFor = (map, color, alpha) => {
const band = Math.max(