Sound occlusion

The engine has something to occlude sounds?

I’m using a fasttrace to see if there is some obstacle, like a wall, between the player and the NPC who is talking. Then the soundcue volume is set to 50% and the subtitle is hidden.

But the problem is when the occlusion changes when the sound is still playing. So I need to check it with a timer or in the tick, and this is expensive to use with large number of bots.

Has the engine a way to do this automatically and more eficient?

That’s a tough problem. I’ve never heard of sound occlusion in UDK. But maybe something that might work is in the NPC’s tick event, just check when its LastRenderTime was. If LastRenderTime <= DeltaTime, it’s currently being drawn on screen. If something occludes it, LastRenderTime will go above DeltaTime and you’ll know to reduce the soundcue’s volume. This isn’t perfect: The volume will also decrease if the player looks away from the NPC. But maybe that’s acceptable behavior.

Also, instead of all the bots constantly checking line of sight to the player’s pawn, maybe do it the other way around. If the bot is within a certain distance of the player when it starts playing a sound, add it to the player’s array of sound-making bots. Then make the player trace only to those bots.

I don’t know of any such functionality in the engine, and AFAIK even UE4 doesnt have it
I guess you’ll have to start adding up the tricks mentioned here

to add to the pool of tricks I’ll suggest using Nathaniel’s suggestion of the array of bots heard by the player, and do your tick-based occlusion reducing it to 1 (or a few) per-tick.
this way more bots only mean more delay in the occlusion checks, but never less performance

You may also want to consider using reverb volumes. They allow you to apply low pass filters to sounds eminating from outside the volume and vice-versa.

Thanks, I wanted to know if the engine has anything before do the job. I use reberb volumes in some interiors, but the map is to big and the number of houses with interior is too high.

The solution sugested byseems to be the better option, so the player can adjust the volume ewery few ticks and only for the closest pawns.