Simple Voice Chat voicechat/detection_chance

SVC Detection Chance

Calculates the probability (0.0 – 1.0) that a voice is audible at a given distance, with configurable min/max range and a falloff curve.

Note: Formula: chance = (1 − normalised_distance) ^ falloffCurve, where normalised_distance = (distance − minRange) / (maxRange − minRange) Falloff curve guide (chance at the midpoint between minRange and maxRange): • 0.5 → sharp drop-off (~29 % at midpoint) • 1.0 → linear drop-off (50 % at midpoint) ← default • 1.5 → gradual drop-off (~65 % at midpoint) • 2.0 → very gradual drop-off (~75 % at midpoint) Tip: use **SVC Voice Range** to compute a volume-scaled maxRange and feed it here for dynamic detection.

Inputs

NameTypeOptionalDescription
distance number Distance in blocks between the listener and the speaker.
minRange number Distance within which detection is guaranteed (100 %).
maxRange number Distance beyond which detection is impossible (0 %).

Outputs

NameTypeDescription
detectionChance number Probability from 0.0 (cannot hear) to 1.0 (guaranteed).
canHear boolean True if detectionChance is greater than 0.

Properties

KeyTypeDefaultDescription
falloffCurve number 1 Controls how quickly detection chance falls off between minRange and maxRange.

Examples

Probabilistic mob detection

Give mobs a realistic chance of detecting a nearby speaking player based on distance.

  1. SVC Speaking Trigger → player → Get Player Location
  2. Get Player Location + Mob Location → Distance Between Locations → SVC Detection Chance (distance)
  3. Constant (5) → SVC Detection Chance (minRange)
  4. Constant (30) → SVC Detection Chance (maxRange)
  5. SVC Detection Chance → detectionChance → Random Number Check (0–1)
  6. Random Number Check → pass branch → Trigger mob alert

Combine with volume-scaled range

Louder voices are detectable from further away.

  1. SVC Speaking Trigger → decibels → SVC Voice Range (decibels)
  2. Constant (48) → SVC Voice Range (baseRange)
  3. SVC Voice Range → effectiveRange → SVC Detection Chance (maxRange)
  4. Constant (5) → SVC Detection Chance (minRange)
  5. Distance Between Locations → SVC Detection Chance (distance)
  6. SVC Detection Chance → detectionChance → <use as probability>