Threat score, moods, shared playback
Atmosphere director internals
A server-authoritative music and overlay director. Clients report what they encounter; the server decides the mood, the track and its playback offset; every client plays the same timeline.
Dependency: WebKnight (WBK) Zombies.
FF Horror does not ship zombie units. The atmosphere director, horde pools and AI balancing all assume WBK class
names arrive from the WebKnight addon. FFATM_fnc_zombieProfile is the single place that maps a class to
a threat weight and an urgency radius; substitute it (or override the returned tuple) when you run a different
zombie pack.
1. Client sensor
Each client scans nearby Man entities within 120 m, counts enemies on enemySides, asks
zombieProfile for a per-class weight, and records awareness from knowsAbout (default
threshold 1.5) plus a bounded line-of-sight fallback. Gunfire is captured with FiredMan and
FiredNear handlers into a rolling FFATM_shotEvents window. A report is sent every two
seconds; the server ignores reports older than eight seconds or from dead units.
2. Server pressure and mood
The server evaluates each player's report separately and uses the strongest encounter, never the sum. Encounter pressure is then scaled by nearby players so a crowd does not multiply threat. Two values exist:
- Threat score (0–100): rises from aware enemies and nearby shots, drains passively.
- Gunfire charge (0–35): sustained shots near OPFOR; can raise tension alone but cannot start combat.
| Transition | Threshold |
|---|---|
| Quiet → tension | 25 |
| Tension → quiet | below 10 |
| Tension → combat | 75 |
| Combat → tension | below 40 |
| Combat exit | about 8 s after no OPFOR is detected |
Sudden steep rises can enter tension early, and a large aware horde with heavy shooting can jump straight to combat. Every reduction fades the old track out for at least ten seconds and the new one in over ten seconds.
3. Shared playback
The server selects a track from the mood pool, records a start timestamp and publishes mode, track, source and volume. Clients use the measured track length to seek into the correct offset. That is why a joining player hears the same part of the same song instead of starting from zero. Priority tracks, forced moods with durations and horde cues are server state, so two Zeus clients cannot disagree.
The soul sequence takes precedence: the client stops its own music at death and resumes the shared track two seconds
after a living West character is stable. FFATM_soulActive is an explicit hook for other soul
implementations.
4. Overlay coupling
The same server mood drives FF_Overlay2_fade on each client. Overlay values keep the original inverted
convention (1 = hidden, 0 = visible) so mission scripts can write them directly.
5. Diagnostics
Zeus footer fields show mode, track, source, volume, threat, pressure, slope, gunfire charge, aware vs raw zombies,
weighted danger and recent shots. Setting debugEnabled in the atmosphere config adds a live panel with
the same numbers plus report rejection reasons.
6. Extension points
extraTracksfor mission-owned intro/outro music — the catalog is appended, not replaced.moodPoolsto remap which track keys belong to each mood.playerSides/enemySidesfor non-NATO missions.zombieProfilefor class-name conventions other than WBK.
Related functions
FFATM_fnc_report— Server-side entry for client threat reports. Validates the reporting unit and age, storesFFATM_fnc_zombieProfile— Returns [kind, weight, closeUrgency] for an enemy unit, recognizing WBK class names and faFFATM_fnc_zeusRequest— Server-side atmosphere control request used by the ZEN dialog: automatic mode, track, forcFF_horror_fnc_registerZeusFooterStatus— Calls the shared Zeus tools.