-
-
Notifications
You must be signed in to change notification settings - Fork 537
Description
Is your feature request related to a problem? Please describe.
Yes. Currently, 3D sounds ( like vehicle engines or music ) travel through solid objects like walls and buildings without any volume reduction. This breaks immersion, especially in interior maps or tactical gameplay.
To fix this currently in Lua, we have to use processLineOfSight in every frame or a fast timer for every sound source. This is extremely heavy on the CPU and causes significant FPS drops (performance lag) when multiple sounds are active. It is very inefficient to handle this on the scripting side.
Describe the solution you'd like
I would like a native "Audio Occlusion" system implemented into the MTA engine. This system should automatically check if a physical object (building, vehicle, object) is blocking the path between the 3D sound source and the listener.
Ideally, it could be implemented as:
- An optional argument in
playSound3Dto enable occlusion. - A new function like
setSoundOcclusionEnabled(sound element, bool enabled).
When enabled, the engine should handle the raycasting and apply a Low-pass filter (muffling the sound) and volume attenuation when the source is obscured. This would be much more performance-efficient since it's handled at the C++ engine level.
Describe alternatives you've considered
rrent alternative is to use a Lua-based script that runs every frame using onClientRender. It involves performing a processLineOfSight between the player and every active 3D sound source.
While this works for 1-2 sounds, it scales poorly and causes significant FPS drops (CPU overhead) in servers with high activity, like voice chat or heavy traffic. Another alternative is using raycasting in a low-frequency timer (e.g., every 500ms), but this makes the audio transition feel "laggy" and unnatural.
Additional context
This feature is standard in most modern game engines (Unity, Unreal, Source) and would be a massive quality-of-life improvement for MTA developers. It would enable us to create more immersive interior systems, tactical shooters, and realistic car audio environments without sacrificing player performance
Security Policy
- I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.