Proximity Voice Chat

I’m working on a free-for-all shooter and would like to implement voice chat based on the player’s location to each other. Is this an option with UE4 at the moment? I haven’t had much luck investigating it. Right now I’m using OnlineSubsystemSteam to handle the networking and it enables global speech just fine. Any thoughts?

1 Like

The voice implementation requires it to be done within the OnlineSubsystem, which you already have and seams to be working fine. Now it comes to handle that voice the way you want.

Unreal comes with muting/un-muting functionality which you can reuse to mute or un-mute players based on distance. Each PlayerController has ‘MuteList’ member (its a FPlayerMuteList instance). The MuteList provides you with the following methods to implement your muting behaviour:

void FPlayerMuteList::ServerMutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& MuteId)
void FPlayerMuteList::ServerUnmutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& UnmuteId)
void FPlayerMuteList::ClientMutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& MuteId)
void FPlayerMuteList::ClientUnmutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& UnmuteId)
void FPlayerMuteList::GameplayMutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& MuteId)
void FPlayerMuteList::GameplayUnmutePlayer(APlayerController* OwningPC, const FUniqueNetIdRepl& UnmuteId)
bool FPlayerMuteList::IsPlayerMuted(const FUniqueNetId& PlayerId)

I suggest using the GameplayMutePlayer and GameplayUnmutePlayer functions, the others are deeper in the system and used for block lists. Block lists are very important in consoles where they have to conform to quite some certifaction tests.


Thanks for the reply, it seems pretty solid. I’ve been experimenting with AlwaysOn and PushToTalk varieties of voice chat and have noticed there is considerable lag in audio and gameplay when bRequiresPushToTalk=false; Have you run into that issue as well?

The bandwidth requirements are different for each networking platform. For instance, Steam is different from PSN’s voice which is different from Xbox Live’s voice support. Take a look at “stat net” and see what % of your data is coming from voice. As Moss suggested, use the Gameplay muting functions to do your proximity based voice.

Thanks for the advice, we are using 4.2 so Stat Net isn’t functioning properly. I keep having issues trying to mute the players that is hosting the game. From what I have seen the FUniqueNetIdRepl needed for GameplayMuteplayer is null.

How are your test going? Did this solve your question?

I am really not a pro in UE4 @Moss can you help me a little bit further with Proximity Voice Chat for my RolePlay game please?